Skip to content
This repository was archived by the owner on Jan 31, 2025. It is now read-only.

Commit bb92421

Browse files
ceyusaxhaihao
authored andcommitted
Add meson support
1 parent b4787d6 commit bb92421

File tree

4 files changed

+446
-0
lines changed

4 files changed

+446
-0
lines changed

meson.build

+102
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
project(
2+
'intel-vaapi-driver', 'c',
3+
version : '2.1.1.1',
4+
meson_version : '>= 0.43.0',
5+
default_options : [ 'warning_level=1',
6+
'buildtype=debugoptimized' ])
7+
8+
version_arr = meson.project_version().split('.')
9+
intel_vaapi_driver_major_version = version_arr[0]
10+
intel_vaapi_driver_minor_version = version_arr[1]
11+
intel_vaapi_driver_micro_version = version_arr[2]
12+
intel_vaapi_driver_version = '@0@.@1@.@2@'.format(intel_vaapi_driver_major_version,
13+
intel_vaapi_driver_minor_version,
14+
intel_vaapi_driver_micro_version)
15+
if version_arr.length() == 4
16+
intel_vaapi_driver_pre_version = version_arr[3]
17+
intel_vaapi_driver_version = '@[email protected]@1@'.format(intel_vaapi_driver_version,
18+
intel_vaapi_driver_pre_version)
19+
endif
20+
21+
cc = meson.get_compiler('c')
22+
dl_dep = cc.find_library('dl')
23+
mathlib_dep = cc.find_library('m', required : false)
24+
25+
git = find_program('git', required : false)
26+
27+
thread_dep = dependency('threads')
28+
libdrm_dep = dependency('libdrm', version : '>= 2.4.52')
29+
libdrm_intel_dep = dependency('libdrm_intel')
30+
31+
libva_version = '>= 1.1.0'
32+
libva_dep = dependency('libva', version : libva_version,
33+
fallback : [ 'libva', 'libva_dep' ])
34+
if get_option ('enable_tests')
35+
libva_drm_dep = dependency('libva-drm', version : libva_version,
36+
fallback : [ 'libva', 'libva_drm_dep' ])
37+
endif
38+
39+
va_api_major_version = '0'
40+
va_api_minor_version = '33'
41+
driverdir = get_option('driverdir')
42+
if libva_dep.type_name() == 'pkgconfig'
43+
if driverdir == ''
44+
driverdir = libva_dep.get_pkgconfig_variable('driverdir')
45+
endif
46+
va_api_version_array = libva_dep.version().split('.')
47+
va_api_major_version = va_api_version_array[0]
48+
va_api_minor_version = va_api_version_array[1]
49+
else
50+
libva = subproject('libva')
51+
if driverdir == ''
52+
driverdir = libva.get_variable('driverdir')
53+
endif
54+
va_api_major_version = libva.get_variable('va_api_major_version')
55+
va_api_minor_version = libva.get_variable('va_api_minor_version')
56+
endif
57+
58+
if driverdir == ''
59+
driverdir = '@0@/@1@/@2@'.format(get_option('prefix'), get_option('libdir'), 'dri')
60+
endif
61+
62+
va_driver_init_func = '__vaDriverInit_@0@_@1@'.format(va_api_major_version,
63+
va_api_minor_version)
64+
65+
WITH_X11 = false
66+
if get_option('with_x11') != 'no'
67+
libva_x11_dep = dependency(
68+
'libva-x11',
69+
version : libva_version,
70+
required : get_option('with_x11') == 'yes')
71+
72+
HAVE_X11 = libva_x11_dep.found()
73+
endif
74+
75+
WITH_WAYLAND = false
76+
if get_option('with_wayland') != 'no'
77+
wayland_client_dep = dependency(
78+
'wayland-client',
79+
version : '>= 1.11.0',
80+
required : get_option('with_wayland') == 'yes')
81+
82+
if wayland_client_dep.found()
83+
prefix = wayland_client_dep.get_pkgconfig_variable('prefix')
84+
wl_scanner = find_program(
85+
'wayland-scanner',
86+
join_paths(prefix, '/bin/wayland-scanner'))
87+
endif
88+
89+
libva_wayland_dep = dependency(
90+
'libva-wayland',
91+
version : libva_version,
92+
required : get_option('with_wayland') == 'yes')
93+
94+
WITH_WAYLAND = wl_scanner.found() and libva_wayland_dep.found()
95+
endif
96+
97+
subdir('src')
98+
99+
if get_option('enable_tests')
100+
srcdir = include_directories('src')
101+
subdir('test')
102+
endif

meson_options.txt

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
option('driverdir', type : 'string', description : 'drivers path')
2+
option('with_x11', type : 'combo', choices : ['yes', 'no', 'auto'], value : 'auto')
3+
option('with_wayland', type : 'combo', choices : ['yes', 'no', 'auto'], value : 'auto')
4+
option('enable_hybrid_codec', type : 'boolean', value : false)
5+
option('enable_tests', type : 'boolean', value : false)

src/meson.build

+253
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,253 @@
1+
config_cfg = configuration_data()
2+
config_cfg.set('VERSION', intel_vaapi_driver_version)
3+
config_cfg.set('VA_DRIVER_INIT_FUNC', va_driver_init_func)
4+
config_cfg.set('INTEL_DRIVER_MAJOR_VERSION', intel_vaapi_driver_major_version)
5+
config_cfg.set('INTEL_DRIVER_MINOR_VERSION', intel_vaapi_driver_minor_version)
6+
config_cfg.set('INTEL_DRIVER_MICRO_VERSION', intel_vaapi_driver_micro_version)
7+
config_cfg.set('INTEL_DRIVER_PRE_VERSION', intel_vaapi_driver_pre_version)
8+
config_cfg.set10('HAVE_HYBRID_CODEC', get_option('enable_hybrid_codec'))
9+
if WITH_X11
10+
config_cfg.set10('HAVE_VA_X11', 1)
11+
endif
12+
if WITH_WAYLAND
13+
config_cfg.set10('HAVE_VA_WAYLAND', 1)
14+
endif
15+
if cc.has_function('log2f')
16+
config_cfg.set('HAVE_LOG2F', 1)
17+
endif
18+
19+
config_file = configure_file(
20+
output : 'config.h',
21+
configuration : config_cfg)
22+
23+
if git.found()
24+
git_version = run_command(
25+
git, '--git-dir', join_paths(meson.source_root(), '.git'),
26+
'describe', '--tags')
27+
intel_driver_git_version = git_version.stdout().strip()
28+
else
29+
intel_driver_git_version = intel_vaapi_driver_version
30+
endif
31+
32+
version_cfg = configuration_data()
33+
version_cfg.set('INTEL_DRIVER_GIT_VERSION', intel_driver_git_version)
34+
35+
version_file = configure_file(
36+
input : 'intel_version.h.in',
37+
output : 'intel_version.h',
38+
configuration : version_cfg)
39+
40+
sources = [
41+
'dso_utils.c',
42+
'gen6_mfc.c',
43+
'gen6_mfc_common.c',
44+
'gen6_mfd.c',
45+
'gen6_vme.c',
46+
'gen7_vme.c',
47+
'gen7_mfc.c',
48+
'gen7_mfd.c',
49+
'gen75_mfd.c',
50+
'gen75_mfc.c',
51+
'gen8_encoder_vp8.c',
52+
'gen8_mfc.c',
53+
'gen8_mfd.c',
54+
'gen8_vme.c',
55+
'gen9_encoder_vp8.c',
56+
'gen9_vme.c',
57+
'gen9_mfc.c',
58+
'gen9_mfc_hevc.c',
59+
'gen9_mfd.c',
60+
'gen9_vdenc.c',
61+
'gen75_picture_process.c',
62+
'gen75_vme.c',
63+
'gen75_vpp_gpe.c',
64+
'gen75_vpp_vebox.c',
65+
'gen9_post_processing.c',
66+
'i965_avc_bsd.c',
67+
'i965_avc_hw_scoreboard.c',
68+
'i965_avc_ildb.c',
69+
'i965_decoder_utils.c',
70+
'i965_device_info.c',
71+
'i965_drv_video.c',
72+
'i965_encoder.c',
73+
'i965_encoder_utils.c',
74+
'i965_encoder_vp8.c',
75+
'i965_media.c',
76+
'i965_media_h264.c',
77+
'i965_media_mpeg2.c',
78+
'i965_gpe_utils.c',
79+
'i965_post_processing.c',
80+
'i965_yuv_coefs.c',
81+
'gen8_post_processing.c',
82+
'i965_render.c',
83+
'i965_vpp_avs.c',
84+
'gen8_render.c',
85+
'gen9_render.c',
86+
'intel_batchbuffer.c',
87+
'intel_batchbuffer_dump.c',
88+
'intel_driver.c',
89+
'intel_memman.c',
90+
'object_heap.c',
91+
'intel_media_common.c',
92+
'vp8_probs.c',
93+
'vp9_probs.c',
94+
'vpx_quant.c',
95+
'gen9_vp9_encoder_kernels.c',
96+
'gen9_vp9_const_def.c',
97+
'gen9_vp9_encoder.c',
98+
'intel_common_vpp_internal.c',
99+
'i965_encoder_const_def.c',
100+
'i965_avc_const_def.c',
101+
'i965_avc_encoder_kernels.c',
102+
'i965_avc_encoder_common.c',
103+
'i965_avc_encoder.c',
104+
'gen9_hevc_enc_kernels_binary.c',
105+
'gen9_hevc_encoder.c',
106+
'gen9_hevc_enc_utils.c',
107+
'gen10_encoder_vp8.c',
108+
'gen10_hcp_common.c',
109+
'gen10_hevc_enc_kernels_binary.c',
110+
'gen10_hevc_enc_common.c',
111+
'gen10_hevc_encoder.c',
112+
'gen10_huc_common.c',
113+
'gen10_vdenc_common.c',
114+
'gen10_vdenc_vp9.c',
115+
]
116+
117+
headers = [
118+
'dso_utils.h',
119+
'gen6_mfc.h',
120+
'gen6_mfd.h',
121+
'gen6_vme.h',
122+
'gen7_mfd.h',
123+
'gen75_picture_process.h',
124+
'gen75_vpp_gpe.h',
125+
'gen75_vpp_vebox.h',
126+
'gen8_post_processing.h',
127+
'gen9_mfd.h',
128+
'gen9_mfc.h',
129+
'gen9_vdenc.h',
130+
'i965_avc_bsd.h',
131+
'i965_avc_hw_scoreboard.h',
132+
'i965_avc_ildb.h',
133+
'i965_decoder.h',
134+
'i965_decoder_utils.h',
135+
'i965_defines.h',
136+
'i965_drv_video.h',
137+
'i965_encoder.h',
138+
'i965_encoder_utils.h',
139+
'i965_encoder_vp8.h',
140+
'i965_media.h',
141+
'i965_media_h264.h',
142+
'i965_media_mpeg2.h',
143+
'i965_mutext.h',
144+
'i965_gpe_utils.h',
145+
'i965_pciids.h',
146+
'i965_post_processing.h',
147+
'i965_render.h',
148+
'i965_structs.h',
149+
'i965_vpp_avs.h',
150+
'i965_yuv_coefs.h',
151+
'intel_batchbuffer.h',
152+
'intel_batchbuffer_dump.h',
153+
'intel_compiler.h',
154+
'intel_driver.h',
155+
'intel_media.h',
156+
'intel_memman.h',
157+
'object_heap.h',
158+
'vp8_probs.h',
159+
'vp9_probs.h',
160+
'vpx_quant.h',
161+
'sysdeps.h',
162+
'va_backend_compat.h',
163+
'i965_fourcc.h',
164+
'gen9_vp9_encoder.h',
165+
'gen9_vp9_encapi.h',
166+
'gen9_vp9_const_def.h',
167+
'gen9_vp9_encoder_kernels.h',
168+
'intel_gen_vppapi.h',
169+
'intel_common_vpp_internal.h',
170+
'i965_encoder_common.h',
171+
'i965_encoder_api.h',
172+
'i965_avc_const_def.h',
173+
'i965_avc_encoder_kernels.h',
174+
'i965_avc_encoder.h',
175+
'i965_avc_encoder_common.h',
176+
'gen9_hevc_enc_const_def.h',
177+
'gen9_hevc_enc_kernels.h',
178+
'gen9_hevc_enc_kernels_binary.h',
179+
'gen9_hevc_enc_utils.h',
180+
'gen9_hevc_encoder.h',
181+
'gen10_hcp_common.h',
182+
'gen10_hevc_enc_kernels_binary.h',
183+
'gen10_hevc_enc_common.h',
184+
'gen10_hevc_encoder.h',
185+
'gen10_hevc_enc_const_def.h',
186+
'gen10_huc_common.h',
187+
'gen10_vdenc_common.h',
188+
'gen10_vdenc_vp9.h',
189+
]
190+
191+
if WITH_X11
192+
sources += 'i965_output_dri.c'
193+
headers += 'i965_output_dri.h'
194+
endif
195+
196+
if WITH_WAYLAND
197+
protocol_header = custom_target(
198+
'wayland-drm-client-protocol_h',
199+
output : 'wayland-drm-client-protocol.h',
200+
input : 'wayland-drm.xml',
201+
command : [ wl_scanner, 'client-header', '@INPUT@', '@OUTPUT@' ])
202+
203+
sources += 'i965_output_wayland.c'
204+
headers += [ 'i965_output_wayland.h',
205+
protocol_header ]
206+
endif
207+
208+
cflags = [
209+
'-DVA_DRIVERS_PATH="' + driverdir + '"',
210+
'-DHAVE_CONFIG_H'
211+
]
212+
213+
if thread_dep.found()
214+
cflags += [ '-DPTHREADS' ]
215+
endif
216+
217+
shared_deps = [
218+
dl_dep,
219+
mathlib_dep,
220+
thread_dep,
221+
libdrm_dep,
222+
libdrm_intel_dep,
223+
libva_dep,
224+
]
225+
226+
if WITH_X11
227+
shared_deps += [ libva_x11_dep ]
228+
endif
229+
230+
if WITH_WAYLAND
231+
shared_deps += [ wayland_client_dep, libva_wayland_dep ]
232+
endif
233+
234+
shared_sources = [
235+
sources,
236+
headers,
237+
config_file,
238+
version_file,
239+
]
240+
241+
libi965_drv_video = static_library(
242+
'i965_drv_video',
243+
c_args : cflags,
244+
sources : shared_sources,
245+
dependencies : shared_deps)
246+
247+
i965_drv_video = shared_module(
248+
'i965_drv_video',
249+
name_prefix : '',
250+
install : true,
251+
install_dir : driverdir,
252+
link_whole : libi965_drv_video,
253+
dependencies : shared_deps)

0 commit comments

Comments
 (0)