• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright © 2017-2019 Intel Corporation
2
3# Permission is hereby granted, free of charge, to any person obtaining a copy
4# of this software and associated documentation files (the "Software"), to deal
5# in the Software without restriction, including without limitation the rights
6# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7# copies of the Software, and to permit persons to whom the Software is
8# furnished to do so, subject to the following conditions:
9
10# The above copyright notice and this permission notice shall be included in
11# all copies or substantial portions of the Software.
12
13# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19# SOFTWARE.
20
21inc_anv = include_directories('.')
22
23anv_flags = [
24  no_override_init_args,
25  sse2_args,
26]
27
28anv_cpp_flags = []
29
30anv_entrypoints = custom_target(
31  'anv_entrypoints',
32  input : [vk_entrypoints_gen, vk_api_xml],
33  output : ['anv_entrypoints.h', 'anv_entrypoints.c'],
34  command : [
35    prog_python, '@INPUT0@', '--xml', '@INPUT1@', '--proto', '--weak',
36    '--out-h', '@OUTPUT0@', '--out-c', '@OUTPUT1@', '--prefix', 'anv',
37    '--beta', with_vulkan_beta.to_string(),
38    '--device-prefix', 'gfx9',
39    '--device-prefix', 'gfx11',
40    '--device-prefix', 'gfx12',
41    '--device-prefix', 'gfx125',
42    '--device-prefix', 'gfx20',
43    '--device-prefix', 'anv_doom64',
44    '--device-prefix', 'anv_hitman3',
45    '--device-prefix', 'anv_android',
46    '--device-prefix', 'anv_rmv',
47  ],
48  depend_files : vk_entrypoints_gen_depend_files,
49)
50
51idep_anv_headers = declare_dependency(
52  sources : [anv_entrypoints[0]],
53  include_directories : inc_anv,
54)
55
56if with_intel_vk_rt
57  subdir('grl')
58  optional_libgrl = [libgrl]
59  anv_flags += '-DANV_SUPPORT_RT=1'
60else
61  idep_grl = null_dep
62  optional_libgrl = []
63  anv_flags += '-DANV_SUPPORT_RT=0'
64endif
65
66intel_icd = custom_target(
67  'intel_icd',
68  input : [vk_icd_gen, vk_api_xml],
69  output : 'intel_icd.@0@.json'.format(host_machine.cpu()),
70  command : [
71    prog_python, '@INPUT0@',
72    '--api-version', '1.3', '--xml', '@INPUT1@',
73    '--lib-path', join_paths(get_option('prefix'), get_option('libdir'),
74                             'libvulkan_intel.so'),
75    '--out', '@OUTPUT@',
76  ],
77  build_by_default : true,
78  install_dir : with_vulkan_icd_dir,
79  install_tag : 'runtime',
80  install : true,
81)
82
83_dev_icdname = 'intel_devenv_icd.@0@.json'.format(host_machine.cpu())
84_dev_icd = custom_target(
85  'intel_devenv_icd',
86  input : [vk_icd_gen, vk_api_xml],
87  output : _dev_icdname,
88  command : [
89    prog_python, '@INPUT0@',
90    '--api-version', '1.3', '--xml', '@INPUT1@',
91    '--lib-path', meson.current_build_dir() / 'libvulkan_intel.so',
92    '--out', '@OUTPUT@',
93  ],
94  build_by_default : true,
95)
96
97devenv.append('VK_ICD_FILENAMES', _dev_icd.full_path())
98
99libanv_per_hw_ver_libs = []
100anv_per_hw_ver_files = files(
101  'genX_blorp_exec.c',
102  'genX_cmd_buffer.c',
103  'genX_cmd_compute.c',
104  'genX_cmd_draw.c',
105  'genX_cmd_draw_generated_flush.h',
106  'genX_cmd_draw_generated_indirect.h',
107  'genX_cmd_video.c',
108  'genX_gfx_state.c',
109  'genX_gpu_memcpy.c',
110  'genX_init_state.c',
111  'genX_internal_kernels.c',
112  'genX_pipeline.c',
113  'genX_query.c',
114  'genX_simple_shader.c',
115)
116if with_intel_vk_rt
117  anv_per_hw_ver_files += files('genX_acceleration_structure.c',)
118endif
119
120foreach _gfx_ver : ['90', '110', '120', '125', '200']
121  libanv_per_hw_ver_libs += static_library(
122    'anv_per_hw_ver@0@'.format(_gfx_ver),
123    [anv_per_hw_ver_files, anv_entrypoints[0]],
124    include_directories : [
125      inc_include, inc_src, inc_intel,
126    ],
127    c_args : anv_flags + ['-DGFX_VERx10=@0@'.format(_gfx_ver)],
128    gnu_symbol_visibility : 'hidden',
129    dependencies : [
130      dep_libdrm, dep_valgrind, idep_nir_headers, idep_genxml,
131      idep_vulkan_util_headers, idep_vulkan_wsi_headers,
132      idep_vulkan_runtime_headers, idep_intel_driver_ds_headers,
133      idep_grl, idep_intel_shaders, idep_intel_blorp,
134    ],
135  )
136endforeach
137
138libanv_files = files(
139  'i915/anv_batch_chain.c',
140  'i915/anv_batch_chain.h',
141  'i915/anv_device.c',
142  'i915/anv_device.h',
143  'i915/anv_gem.c',
144  'i915/anv_gem.h',
145  'i915/anv_kmd_backend.c',
146  'i915/anv_queue.c',
147  'i915/anv_queue.h',
148  'layers/anv_android_layer.c',
149  'layers/anv_doom64.c',
150  'layers/anv_hitman3.c',
151  'layers/anv_rmv_layer.c',
152  'xe/anv_batch_chain.c',
153  'xe/anv_batch_chain.h',
154  'xe/anv_kmd_backend.c',
155  'xe/anv_device.c',
156  'xe/anv_device.h',
157  'xe/anv_queue.c',
158  'xe/anv_queue.h',
159  'anv_allocator.c',
160  'anv_android.h',
161  'anv_astc_emu.c',
162  'anv_batch_chain.c',
163  'anv_blorp.c',
164  'anv_bo_sync.c',
165  'anv_cmd_buffer.c',
166  'anv_descriptor_set.c',
167  'anv_device.c',
168  'anv_formats.c',
169  'anv_genX.h',
170  'anv_image.c',
171  'anv_internal_kernels.c',
172  'anv_internal_kernels.h',
173  'anv_kmd_backend.c',
174  'anv_kmd_backend.h',
175  'anv_measure.c',
176  'anv_measure.h',
177  'anv_mesh_perprim_wa.c',
178  'anv_nir.h',
179  'anv_nir_apply_pipeline_layout.c',
180  'anv_nir_compute_push_layout.c',
181  'anv_nir_lower_multiview.c',
182  'anv_nir_lower_load_patch_vertices_in.c',
183  'anv_nir_lower_ubo_loads.c',
184  'anv_nir_lower_resource_intel.c',
185  'anv_nir_push_descriptor_analysis.c',
186  'anv_perf.c',
187  'anv_pipeline.c',
188  'anv_pipeline_cache.c',
189  'anv_private.h',
190  'anv_queue.c',
191  'anv_rmv.c',
192  'anv_rmv.h',
193  'anv_sparse.c',
194  'anv_util.c',
195  'anv_utrace.c',
196  'anv_va.c',
197  'anv_video.c',
198  'anv_wsi.c',
199)
200
201anv_deps = [
202  dep_libdrm,
203  dep_valgrind,
204  idep_genxml,
205  idep_nir_headers,
206  idep_vulkan_util_headers,
207  idep_vulkan_runtime_headers,
208  idep_vulkan_wsi_headers,
209  idep_intel_shaders,
210  idep_intel_blorp,
211]
212
213if with_platform_x11
214  anv_deps += dep_xcb_dri3
215endif
216
217if with_platform_wayland
218  anv_deps += dep_wayland_client
219endif
220
221if with_xlib_lease
222  anv_deps += [dep_xlib_xrandr]
223endif
224
225if with_platform_android
226  anv_deps += idep_u_gralloc
227  libanv_files += files('anv_android.c')
228else
229  libanv_files += files('anv_android_stubs.c')
230endif
231
232anv_deps += idep_intel_driver_ds_headers
233
234libanv_common = static_library(
235  'anv_common',
236  [
237    libanv_files, anv_entrypoints, sha1_h,
238    gen_xml_pack, intel_float64_spv_h,
239  ],
240  include_directories : [
241    inc_include, inc_src, inc_intel,
242    inc_util,
243  ],
244  c_args : anv_flags,
245  cpp_args : anv_cpp_flags,
246  gnu_symbol_visibility : 'hidden',
247  dependencies : anv_deps
248)
249
250libvulkan_intel = shared_library(
251  'vulkan_intel',
252  [files('anv_gem.c'), anv_entrypoints[0]],
253  include_directories : [
254    inc_include, inc_src, inc_intel,
255  ],
256  link_whole : [libanv_common, libanv_per_hw_ver_libs] + optional_libgrl,
257  link_with : [
258    libintel_compiler_brw, libisl, libintel_perf,
259  ],
260  dependencies : [
261    dep_thread, dep_dl, dep_m, anv_deps, idep_libintel_common,
262    idep_nir, idep_genxml, idep_vulkan_util, idep_vulkan_wsi,
263    idep_vulkan_runtime, idep_mesautil, idep_xmlconfig,
264    idep_intel_driver_ds, idep_intel_dev, idep_intel_blorp,
265    idep_intel_decoder_brw,
266  ],
267  c_args : anv_flags,
268  gnu_symbol_visibility : 'hidden',
269  link_args : [vulkan_icd_link_args, ld_args_build_id, ld_args_bsymbolic, ld_args_gc_sections],
270  link_depends : vulkan_icd_link_depends,
271  install : true,
272)
273
274if with_symbols_check
275  test(
276    'anv symbols check',
277    symbols_check,
278    args : [
279      '--lib', libvulkan_intel,
280      '--symbols-file', vulkan_icd_symbols,
281      symbols_check_args,
282    ],
283    suite : ['intel'],
284  )
285endif
286
287if with_tests
288  libvulkan_intel_test = static_library(
289    'vulkan_intel_test',
290    [files('anv_gem_stubs.c'), anv_entrypoints[0]],
291    include_directories : [
292      inc_include, inc_src, inc_intel,
293    ],
294    link_whole : libanv_common,
295    link_with : [
296      libanv_per_hw_ver_libs, libintel_compiler_brw, libintel_common,
297      libisl, libintel_perf,
298    ] + optional_libgrl,
299    dependencies : [
300      dep_thread, dep_dl, dep_m, anv_deps,
301      idep_nir, idep_vulkan_util, idep_vulkan_wsi, idep_vulkan_runtime,
302      idep_mesautil, idep_intel_dev, idep_intel_shaders, idep_intel_blorp,
303      idep_intel_decoder_brw,
304    ],
305    c_args : anv_flags,
306    gnu_symbol_visibility : 'hidden',
307  )
308
309  files_anv_tests = files(
310    'tests/anv_tests.cpp',
311
312    'tests/state_pool.c',
313    'tests/state_pool_free_list_only.c',
314    'tests/state_pool_max_size.c',
315    'tests/state_pool_no_free.c',
316    'tests/state_pool_padding.c',
317    'tests/block_pool_no_free.c',
318    'tests/block_pool_grow_first.c',
319    'tests/block_pool_max_size.c',
320  )
321
322  test(
323    'anv_tests',
324    executable(
325      'anv_tests',
326      [files_anv_tests, anv_entrypoints[0]],
327      c_args : [ sse2_args ],
328      link_with : libvulkan_intel_test,
329      dependencies : [
330        idep_gtest, dep_libdrm, dep_thread, dep_m, dep_valgrind,
331        idep_vulkan_util, idep_vulkan_wsi_headers,
332        idep_vulkan_runtime, idep_intel_driver_ds, idep_intel_dev,
333        idep_intel_shaders,
334      ],
335      include_directories : [
336        inc_include, inc_src, inc_intel,
337      ],
338    ),
339    suite : ['intel'],
340    protocol : 'gtest',
341  )
342endif
343