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