xref: /aosp_15_r20/external/mesa3d/src/intel/vulkan/meson.build (revision 6104692788411f58d303aa86923a9ff6ecaded22)
1# Copyright © 2017-2019 Intel Corporation
2# SPDX-License-Identifier: MIT
3
4inc_anv = include_directories('.')
5
6anv_flags = [
7  no_override_init_args,
8  sse2_args,
9]
10
11anv_cpp_flags = []
12
13anv_entrypoints = custom_target(
14  'anv_entrypoints',
15  input : [vk_entrypoints_gen, vk_api_xml],
16  output : ['anv_entrypoints.h', 'anv_entrypoints.c'],
17  command : [
18    prog_python, '@INPUT0@', '--xml', '@INPUT1@', '--proto', '--weak',
19    '--out-h', '@OUTPUT0@', '--out-c', '@OUTPUT1@', '--prefix', 'anv',
20    '--beta', with_vulkan_beta.to_string(),
21    '--device-prefix', 'gfx9',
22    '--device-prefix', 'gfx11',
23    '--device-prefix', 'gfx12',
24    '--device-prefix', 'gfx125',
25    '--device-prefix', 'gfx20',
26    '--device-prefix', 'anv_doom64',
27    '--device-prefix', 'anv_hitman3',
28    '--device-prefix', 'anv_android',
29    '--device-prefix', 'anv_rmv',
30  ],
31  depend_files : vk_entrypoints_gen_depend_files,
32)
33
34idep_anv_headers = declare_dependency(
35  sources : [anv_entrypoints[0]],
36  include_directories : inc_anv,
37)
38
39if with_intel_vk_rt
40  subdir('grl')
41  optional_libgrl = [libgrl]
42  anv_flags += '-DANV_SUPPORT_RT=1'
43else
44  idep_grl = null_dep
45  optional_libgrl = []
46  anv_flags += '-DANV_SUPPORT_RT=0'
47endif
48
49intel_icd = custom_target(
50  'intel_icd',
51  input : [vk_icd_gen, vk_api_xml],
52  output : 'intel_icd.@[email protected]'.format(host_machine.cpu()),
53  command : [
54    prog_python, '@INPUT0@',
55    '--api-version', '1.3', '--xml', '@INPUT1@',
56    '--lib-path', join_paths(get_option('prefix'), get_option('libdir'),
57                             'libvulkan_intel.so'),
58    '--out', '@OUTPUT@',
59  ],
60  build_by_default : true,
61  install_dir : with_vulkan_icd_dir,
62  install_tag : 'runtime',
63  install : true,
64)
65
66_dev_icdname = 'intel_devenv_icd.@[email protected]'.format(host_machine.cpu())
67_dev_icd = custom_target(
68  'intel_devenv_icd',
69  input : [vk_icd_gen, vk_api_xml],
70  output : _dev_icdname,
71  command : [
72    prog_python, '@INPUT0@',
73    '--api-version', '1.3', '--xml', '@INPUT1@',
74    '--lib-path', meson.current_build_dir() / 'libvulkan_intel.so',
75    '--out', '@OUTPUT@',
76  ],
77  build_by_default : true,
78)
79
80devenv.append('VK_DRIVER_FILES', _dev_icd.full_path())
81# Deprecated: replaced by VK_DRIVER_FILES above
82devenv.append('VK_ICD_FILENAMES', _dev_icd.full_path())
83
84libanv_per_hw_ver_libs = []
85anv_per_hw_ver_files = files(
86  'genX_blorp_exec.c',
87  'genX_cmd_buffer.c',
88  'genX_cmd_compute.c',
89  'genX_cmd_draw.c',
90  'genX_cmd_draw_generated_flush.h',
91  'genX_cmd_draw_generated_indirect.h',
92  'genX_cmd_video.c',
93  'genX_cmd_video_enc.c',
94  'genX_gfx_state.c',
95  'genX_gpu_memcpy.c',
96  'genX_init_state.c',
97  'genX_internal_kernels.c',
98  'genX_pipeline.c',
99  'genX_query.c',
100  'genX_simple_shader.c',
101)
102if with_intel_vk_rt
103  anv_per_hw_ver_files += files('genX_acceleration_structure.c',)
104endif
105
106foreach _gfx_ver : ['90', '110', '120', '125', '200']
107  libanv_per_hw_ver_libs += static_library(
108    'anv_per_hw_ver@0@'.format(_gfx_ver),
109    [anv_per_hw_ver_files, anv_entrypoints[0]],
110    include_directories : [
111      inc_include, inc_src, inc_intel,
112    ],
113    c_args : anv_flags + ['-DGFX_VERx10=@0@'.format(_gfx_ver)],
114    gnu_symbol_visibility : 'hidden',
115    dependencies : [
116      dep_libdrm, dep_valgrind, idep_nir_headers, idep_genxml,
117      idep_vulkan_util_headers, idep_vulkan_wsi_headers,
118      idep_vulkan_runtime_headers, idep_mesautil,
119      idep_intel_driver_ds_headers, idep_grl,
120      idep_intel_shaders, idep_intel_blorp,
121    ],
122  )
123endforeach
124
125libanv_files = files(
126  'i915/anv_batch_chain.c',
127  'i915/anv_batch_chain.h',
128  'i915/anv_device.c',
129  'i915/anv_device.h',
130  'i915/anv_gem.c',
131  'i915/anv_gem.h',
132  'i915/anv_kmd_backend.c',
133  'i915/anv_queue.c',
134  'i915/anv_queue.h',
135  'layers/anv_android_layer.c',
136  'layers/anv_doom64.c',
137  'layers/anv_hitman3.c',
138  'layers/anv_rmv_layer.c',
139  'xe/anv_batch_chain.c',
140  'xe/anv_batch_chain.h',
141  'xe/anv_kmd_backend.c',
142  'xe/anv_device.c',
143  'xe/anv_device.h',
144  'xe/anv_queue.c',
145  'xe/anv_queue.h',
146  'anv_allocator.c',
147  'anv_android.h',
148  'anv_astc_emu.c',
149  'anv_batch_chain.c',
150  'anv_blorp.c',
151  'anv_bo_sync.c',
152  'anv_buffer.c',
153  'anv_buffer_view.c',
154  'anv_cmd_buffer.c',
155  'anv_descriptor_set.c',
156  'anv_device.c',
157  'anv_event.c',
158  'anv_formats.c',
159  'anv_genX.h',
160  'anv_image.c',
161  'anv_image_view.c',
162  'anv_internal_kernels.c',
163  'anv_internal_kernels.h',
164  'anv_instance.c',
165  'anv_kmd_backend.c',
166  'anv_kmd_backend.h',
167  'anv_measure.c',
168  'anv_measure.h',
169  'anv_mesh_perprim_wa.c',
170  'anv_nir.h',
171  'anv_nir_apply_pipeline_layout.c',
172  'anv_nir_compute_push_layout.c',
173  'anv_nir_lower_multiview.c',
174  'anv_nir_lower_load_patch_vertices_in.c',
175  'anv_nir_lower_ubo_loads.c',
176  'anv_nir_lower_resource_intel.c',
177  'anv_nir_push_descriptor_analysis.c',
178  'anv_perf.c',
179  'anv_physical_device.c',
180  'anv_pipeline.c',
181  'anv_pipeline_cache.c',
182  'anv_private.h',
183  'anv_queue.c',
184  'anv_rmv.c',
185  'anv_rmv.h',
186  'anv_sampler.c',
187  'anv_sparse.c',
188  'anv_util.c',
189  'anv_utrace.c',
190  'anv_va.c',
191  'anv_video.c',
192  'anv_wsi.c',
193)
194
195anv_deps = [
196  dep_libdrm,
197  dep_valgrind,
198  idep_genxml,
199  idep_mesautil,
200  idep_nir_headers,
201  idep_vulkan_util_headers,
202  idep_vulkan_runtime_headers,
203  idep_vulkan_wsi_headers,
204  idep_intel_shaders,
205  idep_intel_blorp,
206]
207
208if with_platform_x11
209  anv_deps += dep_xcb_dri3
210endif
211
212if with_platform_wayland
213  anv_deps += dep_wayland_client
214endif
215
216if with_xlib_lease
217  anv_deps += [dep_xlib_xrandr]
218endif
219
220if with_platform_android
221  anv_deps += idep_u_gralloc
222  libanv_files += files('anv_android.c')
223else
224  libanv_files += files('anv_android_stubs.c')
225endif
226
227anv_deps += idep_intel_driver_ds_headers
228
229libanv_common = static_library(
230  'anv_common',
231  [
232    libanv_files, anv_entrypoints, sha1_h,
233    gen_xml_pack, intel_float64_spv_h,
234  ],
235  include_directories : [
236    inc_include, inc_src, inc_intel,
237    inc_util,
238  ],
239  c_args : anv_flags,
240  cpp_args : anv_cpp_flags,
241  gnu_symbol_visibility : 'hidden',
242  dependencies : anv_deps
243)
244
245libvulkan_intel = shared_library(
246  'vulkan_intel',
247  [files('anv_gem.c'), anv_entrypoints[0]],
248  include_directories : [
249    inc_include, inc_src, inc_intel,
250  ],
251  link_whole : [libanv_common, libanv_per_hw_ver_libs] + optional_libgrl,
252  link_with : [
253    libisl, libintel_perf,
254  ],
255  dependencies : [
256    dep_thread, dep_dl, dep_m, anv_deps, idep_libintel_common,
257    idep_nir, idep_genxml, idep_vulkan_util, idep_vulkan_wsi,
258    idep_vulkan_runtime, idep_mesautil, idep_xmlconfig,
259    idep_intel_driver_ds, idep_intel_dev, idep_intel_blorp,
260    idep_intel_compiler_brw, idep_intel_decoder_brw,
261  ],
262  c_args : anv_flags,
263  gnu_symbol_visibility : 'hidden',
264  link_args : [vulkan_icd_link_args, ld_args_build_id, ld_args_bsymbolic, ld_args_gc_sections],
265  link_depends : vulkan_icd_link_depends,
266  install : true,
267)
268
269if with_symbols_check
270  test(
271    'anv symbols check',
272    symbols_check,
273    args : [
274      '--lib', libvulkan_intel,
275      '--symbols-file', vulkan_icd_symbols,
276      symbols_check_args,
277    ],
278    suite : ['intel'],
279  )
280endif
281
282if with_tests
283  libvulkan_intel_test = static_library(
284    'vulkan_intel_test',
285    [files('anv_gem_stubs.c'), anv_entrypoints[0]],
286    include_directories : [
287      inc_include, inc_src, inc_intel,
288    ],
289    link_whole : libanv_common,
290    link_with : [
291      libanv_per_hw_ver_libs, libintel_common,
292      libisl, libintel_perf,
293    ] + optional_libgrl,
294    dependencies : [
295      dep_thread, dep_dl, dep_m, anv_deps,
296      idep_nir, idep_vulkan_util, idep_vulkan_wsi, idep_vulkan_runtime,
297      idep_mesautil, idep_intel_dev, idep_intel_shaders, idep_intel_blorp,
298      idep_intel_compiler_brw, idep_intel_decoder_brw,
299    ],
300    c_args : anv_flags,
301    gnu_symbol_visibility : 'hidden',
302  )
303
304  files_anv_tests = files(
305    'tests/anv_tests.cpp',
306
307    'tests/state_pool.c',
308    'tests/state_pool_free_list_only.c',
309    'tests/state_pool_max_size.c',
310    'tests/state_pool_no_free.c',
311    'tests/state_pool_padding.c',
312    'tests/block_pool_no_free.c',
313    'tests/block_pool_grow_first.c',
314    'tests/block_pool_max_size.c',
315  )
316
317  test(
318    'anv_tests',
319    executable(
320      'anv_tests',
321      [files_anv_tests, anv_entrypoints[0]],
322      c_args : [ sse2_args ],
323      link_with : libvulkan_intel_test,
324      dependencies : [
325        idep_gtest, dep_libdrm, dep_thread, dep_m, dep_valgrind,
326        idep_vulkan_util, idep_vulkan_wsi_headers,
327        idep_vulkan_runtime, idep_intel_driver_ds, idep_intel_dev,
328        idep_intel_shaders,
329      ],
330      include_directories : [
331        inc_include, inc_src, inc_intel,
332      ],
333    ),
334    suite : ['intel'],
335    protocol : 'gtest',
336    is_parallel : false,
337    timeout : 60,
338  )
339endif
340