xref: /aosp_15_r20/external/mesa3d/src/intel/vulkan_hasvk/meson.build (revision 6104692788411f58d303aa86923a9ff6ecaded22)
1# Copyright © 2017-2019 Intel Corporation
2# SPDX-License-Identifier: MIT
3
4anv_hasvk_entrypoints = custom_target(
5  'anv_hasvk_entrypoints',
6  input : [vk_entrypoints_gen, vk_api_xml],
7  output : ['anv_entrypoints.h', 'anv_entrypoints.c'],
8  command : [
9    prog_python, '@INPUT0@', '--xml', '@INPUT1@', '--proto', '--weak',
10    '--out-h', '@OUTPUT0@', '--out-c', '@OUTPUT1@', '--prefix', 'anv',
11    '--beta', with_vulkan_beta.to_string(),
12    '--device-prefix', 'gfx7', '--device-prefix', 'gfx75',
13    '--device-prefix', 'gfx8',
14    '--device-prefix', 'doom64',
15  ],
16  depend_files : vk_entrypoints_gen_depend_files,
17)
18
19intel_hasvk_icd = custom_target(
20  'intel_hasvk_icd',
21  input : [vk_icd_gen, vk_api_xml],
22  output : 'intel_hasvk_icd.@[email protected]'.format(host_machine.cpu()),
23  command : [
24    prog_python, '@INPUT0@',
25    '--api-version', '1.3', '--xml', '@INPUT1@',
26    '--lib-path', join_paths(get_option('prefix'), get_option('libdir'),
27                             'libvulkan_intel_hasvk.so'),
28    '--out', '@OUTPUT@',
29  ],
30  build_by_default : true,
31  install_dir : with_vulkan_icd_dir,
32  install_tag : 'runtime',
33  install : true,
34)
35
36_dev_icdname = 'intel_hasvk_devenv_icd.@[email protected]'.format(host_machine.cpu())
37_dev_icd = custom_target(
38  'intel_hasvk_devenv_icd',
39  input : [vk_icd_gen, vk_api_xml],
40  output : _dev_icdname,
41  command : [
42    prog_python, '@INPUT0@',
43    '--api-version', '1.3', '--xml', '@INPUT1@',
44    '--lib-path', meson.current_build_dir() / 'libvulkan_intel_hasvk.so',
45    '--out', '@OUTPUT@',
46  ],
47  build_by_default : true,
48)
49
50devenv.append('VK_DRIVER_FILES', _dev_icd.full_path())
51# Deprecated: replaced by VK_DRIVER_FILES above
52devenv.append('VK_ICD_FILENAMES', _dev_icd.full_path())
53
54libanv_per_hw_ver_libs = []
55anv_per_hw_ver_files = files(
56  'genX_blorp_exec.c',
57  'genX_cmd_buffer.c',
58  'genX_gpu_memcpy.c',
59  'genX_pipeline.c',
60  'genX_query.c',
61  'genX_state.c',
62)
63foreach g : [['70', ['gfx7_cmd_buffer.c']],
64             ['75', ['gfx7_cmd_buffer.c']],
65             ['80', ['gfx8_cmd_buffer.c']]]
66  _gfx_ver = g[0]
67  libanv_per_hw_ver_libs += static_library(
68    'anv_per_hw_ver@0@'.format(_gfx_ver),
69    [anv_per_hw_ver_files, g[1], anv_hasvk_entrypoints[0]],
70    include_directories : [
71      inc_include, inc_src, inc_intel,
72    ],
73    c_args : [
74      no_override_init_args, sse2_args,
75      '-DGFX_VERx10=@0@'.format(_gfx_ver),
76    ],
77    gnu_symbol_visibility : 'hidden',
78    dependencies : [
79      dep_libdrm, dep_valgrind, idep_nir_headers, idep_genxml,
80      idep_vulkan_util_headers, idep_vulkan_wsi_headers,
81      idep_vulkan_runtime_headers, idep_intel_driver_ds_headers,
82      idep_intel_blorp_elk, idep_mesautil,
83    ],
84  )
85endforeach
86
87libanv_files = files(
88  'layers/anv_doom64.c',
89  'anv_allocator.c',
90  'anv_android.h',
91  'anv_batch_chain.c',
92  'anv_blorp.c',
93  'anv_bo_sync.c',
94  'anv_cmd_buffer.c',
95  'anv_descriptor_set.c',
96  'anv_device.c',
97  'anv_formats.c',
98  'anv_genX.h',
99  'anv_image.c',
100  'anv_measure.c',
101  'anv_measure.h',
102  'anv_nir.h',
103  'anv_nir_apply_pipeline_layout.c',
104  'anv_nir_compute_push_layout.c',
105  'anv_nir_lower_multiview.c',
106  'anv_nir_lower_ubo_loads.c',
107  'anv_nir_lower_ycbcr_textures.c',
108  'anv_perf.c',
109  'anv_pipeline.c',
110  'anv_pipeline_cache.c',
111  'anv_private.h',
112  'anv_queue.c',
113  'anv_util.c',
114  'anv_utrace.c',
115  'anv_wsi.c',
116)
117
118anv_deps = [
119  dep_libdrm,
120  dep_valgrind,
121  idep_genxml,
122  idep_mesautil,
123  idep_nir_headers,
124  idep_vulkan_util_headers,
125  idep_vulkan_runtime_headers,
126  idep_vulkan_wsi_headers,
127]
128anv_flags = [
129  no_override_init_args,
130  sse2_args,
131]
132
133anv_cpp_flags = []
134
135if with_platform_x11
136  anv_deps += dep_xcb_dri3
137endif
138
139if with_platform_wayland
140  anv_deps += dep_wayland_client
141endif
142
143if with_xlib_lease
144  anv_deps += [dep_xlib_xrandr]
145endif
146
147if with_platform_android
148  libanv_files += files('anv_android.c')
149else
150  libanv_files += files('anv_android_stubs.c')
151endif
152
153anv_deps += idep_intel_driver_ds_headers
154
155libanv_hasvk_common = static_library(
156  'anv_hasvk_common',
157  [
158    libanv_files, anv_hasvk_entrypoints, sha1_h,
159    gen_xml_pack,
160  ],
161  include_directories : [
162    inc_include, inc_src, inc_intel,
163    inc_util,
164  ],
165  c_args : anv_flags,
166  cpp_args : anv_cpp_flags,
167  gnu_symbol_visibility : 'hidden',
168  dependencies : anv_deps,
169)
170
171libvulkan_intel_hasvk = shared_library(
172  'vulkan_intel_hasvk',
173  [files('anv_gem.c'), anv_hasvk_entrypoints[0]],
174  include_directories : [
175    inc_include, inc_src, inc_intel,
176  ],
177  link_whole : [libanv_hasvk_common, libanv_per_hw_ver_libs],
178  link_with : [
179    libisl, libintel_perf,
180  ],
181  dependencies : [
182    dep_thread, dep_dl, dep_m, anv_deps, idep_libintel_common,
183    idep_nir, idep_genxml, idep_vulkan_util, idep_vulkan_wsi,
184    idep_vulkan_runtime, idep_mesautil, idep_xmlconfig,
185    idep_intel_driver_ds, idep_intel_dev, idep_intel_blorp_elk,
186    idep_intel_decoder_elk, idep_intel_compiler_elk,
187  ],
188  c_args : anv_flags,
189  gnu_symbol_visibility : 'hidden',
190  link_args : [vulkan_icd_link_args, ld_args_build_id,
191               ld_args_bsymbolic, ld_args_gc_sections],
192  link_depends : vulkan_icd_link_depends,
193  install : true,
194)
195
196if with_symbols_check
197  test(
198    'anv symbols check',
199    symbols_check,
200    args : [
201      '--lib', libvulkan_intel_hasvk,
202      '--symbols-file', vulkan_icd_symbols,
203      symbols_check_args,
204    ],
205    suite : ['intel'],
206  )
207endif
208
209if with_tests
210  libvulkan_intel_hasvk_test = static_library(
211    'vulkan_intel_hasvk_test',
212    [files('anv_gem_stubs.c'), anv_hasvk_entrypoints[0]],
213    include_directories : [
214      inc_include, inc_src, inc_intel,
215    ],
216    link_whole : libanv_hasvk_common,
217    link_with : [
218      libanv_per_hw_ver_libs, libintel_common,
219      libisl, libintel_perf,
220    ],
221    dependencies : [
222      dep_thread, dep_dl, dep_m, anv_deps,
223      idep_nir, idep_vulkan_util, idep_vulkan_wsi, idep_vulkan_runtime,
224      idep_mesautil, idep_intel_dev, idep_intel_blorp_elk,
225      idep_intel_decoder_elk, idep_intel_compiler_elk,
226    ],
227    c_args : anv_flags,
228    gnu_symbol_visibility : 'hidden',
229  )
230
231  files_hasvk_tests = files(
232    'tests/hasvk_tests.cpp',
233
234    'tests/state_pool.c',
235    'tests/state_pool_free_list_only.c',
236    'tests/state_pool_no_free.c',
237    'tests/state_pool_padding.c',
238    'tests/block_pool_no_free.c',
239    'tests/block_pool_grow_first.c',
240  )
241
242  test(
243    'hasvk_tests',
244    executable(
245      'hasvk_tests',
246      [files_hasvk_tests, anv_hasvk_entrypoints[0]],
247      c_args : [ sse2_args ],
248      link_with : libvulkan_intel_hasvk_test,
249      dependencies : [
250        idep_gtest, dep_libdrm, dep_thread, dep_m, dep_valgrind,
251        idep_vulkan_util, idep_vulkan_wsi_headers,
252        idep_vulkan_runtime, idep_intel_driver_ds, idep_intel_dev,
253      ],
254      include_directories : [
255        inc_include, inc_src, inc_intel,
256      ],
257    ),
258    suite : ['intel'],
259    protocol : 'gtest',
260  )
261endif
262