About Social Code
aboutsummaryrefslogtreecommitdiff
path: root/src/intel/vulkan/meson.build
blob: cf20ae2c81a46470d437d9ade30fd4a259add95c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
# Copyright © 2017-2019 Intel Corporation
# SPDX-License-Identifier: MIT

inc_anv = include_directories('.')

anv_flags = [
  no_override_init_args,
  sse2_args,
]

anv_cpp_flags = []

anv_entrypoints = custom_target(
  'anv_entrypoints',
  input : [vk_entrypoints_gen, vk_api_xml],
  output : ['anv_entrypoints.h', 'anv_entrypoints.c'],
  command : [
    prog_python, '@INPUT0@', '--xml', '@INPUT1@', '--proto', '--weak',
    '--out-h', '@OUTPUT0@', '--out-c', '@OUTPUT1@', '--prefix', 'anv',
    '--beta', with_vulkan_beta.to_string(),
    '--device-prefix', 'gfx9',
    '--device-prefix', 'gfx11',
    '--device-prefix', 'gfx12',
    '--device-prefix', 'gfx125',
    '--device-prefix', 'gfx20',
    '--device-prefix', 'gfx30',
    '--device-prefix', 'anv_doom64',
    '--device-prefix', 'anv_hitman3',
    '--device-prefix', 'anv_android',
    '--device-prefix', 'anv_rmv',
  ],
  depend_files : vk_entrypoints_gen_depend_files,
)

idep_anv_headers = declare_dependency(
  sources : [anv_entrypoints[0]],
  include_directories : inc_anv,
)

bvh_spv = []
if with_intel_vk_rt
  subdir('bvh')
  anv_flags += '-DANV_SUPPORT_RT=1'
else
  anv_flags += '-DANV_SUPPORT_RT=0'
endif

icd_file_name = libname_prefix + 'vulkan_intel.' + libname_suffix

intel_icd = custom_target(
  'intel_icd',
  input : [vk_icd_gen, vk_api_xml],
  output : 'intel_icd.@0@.json'.format(host_machine.cpu()),
  command : [
    prog_python, '@INPUT0@',
    '--api-version', '1.4', '--xml', '@INPUT1@',
    '--sizeof-pointer', sizeof_pointer,
    '--lib-path', join_paths(get_option('prefix'), get_option('libdir'),
                             icd_file_name),
    '--out', '@OUTPUT@',
  ],
  build_by_default : true,
  install_dir : with_vulkan_icd_dir,
  install_tag : 'runtime',
  install : true,
)

_dev_icdname = 'intel_devenv_icd.@0@.json'.format(host_machine.cpu())
_dev_icd = custom_target(
  'intel_devenv_icd',
  input : [vk_icd_gen, vk_api_xml],
  output : _dev_icdname,
  command : [
    prog_python, '@INPUT0@',
    '--api-version', '1.4', '--xml', '@INPUT1@',
    '--sizeof-pointer', sizeof_pointer,
    '--lib-path', meson.current_build_dir() / icd_file_name,
    '--out', '@OUTPUT@',
  ],
  build_by_default : true,
)

devenv.append('VK_DRIVER_FILES', _dev_icd.full_path())
# Deprecated: replaced by VK_DRIVER_FILES above
devenv.append('VK_ICD_FILENAMES', _dev_icd.full_path())

libanv_per_hw_ver_libs = []
anv_per_hw_ver_files = files(
  'genX_blorp_exec.c',
  'genX_cmd_buffer.c',
  'genX_cmd_compute.c',
  'genX_cmd_draw.c',
  'genX_cmd_draw_generated_flush.h',
  'genX_cmd_draw_generated_indirect.h',
  'genX_cmd_video.c',
  'genX_cmd_video_enc.c',
  'genX_gfx_state.c',
  'genX_gpu_memcpy.c',
  'genX_init_state.c',
  'genX_internal_kernels.c',
  'genX_query.c',
  'genX_simple_shader.c',
  'genX_shader.c',
)
if with_intel_vk_rt
  anv_per_hw_ver_files += files(
    'genX_acceleration_structure.c',
  )
endif

foreach _gfx_ver : ['90', '110', '120', '125', '200', '300']
  libanv_per_hw_ver_libs += static_library(
    'anv_per_hw_ver@0@'.format(_gfx_ver),
    [anv_per_hw_ver_files, anv_entrypoints[0]] + bvh_spv,
    include_directories : [
      inc_include, inc_src, inc_intel,
    ],
    c_args : anv_flags + ['-DGFX_VERx10=@0@'.format(_gfx_ver)],
    gnu_symbol_visibility : 'hidden',
    dependencies : [
      dep_libdrm, dep_valgrind, idep_nir_headers, idep_genxml,
      idep_vulkan_util_headers, idep_vulkan_wsi_headers,
      idep_vulkan_runtime_headers, idep_mesautil,
      idep_intel_dev, idep_intel_driver_ds_headers,
      idep_intel_shaders, idep_intel_blorp,
    ],
  )
endforeach

libanv_files = files(
  'i915/anv_batch_chain.c',
  'i915/anv_batch_chain.h',
  'i915/anv_device.c',
  'i915/anv_device.h',
  'i915/anv_gem.c',
  'i915/anv_gem.h',
  'i915/anv_kmd_backend.c',
  'i915/anv_queue.c',
  'i915/anv_queue.h',
  'layers/anv_android_layer.c',
  'layers/anv_doom64.c',
  'layers/anv_hitman3.c',
  'layers/anv_rmv_layer.c',
  'xe/anv_batch_chain.c',
  'xe/anv_batch_chain.h',
  'xe/anv_kmd_backend.c',
  'xe/anv_device.c',
  'xe/anv_device.h',
  'xe/anv_queue.c',
  'xe/anv_queue.h',
  'anv_allocator.c',
  'anv_android.h',
  'anv_astc_emu.c',
  'anv_batch_chain.c',
  'anv_blorp.c',
  'anv_buffer.c',
  'anv_buffer_view.c',
  'anv_cmd_buffer.c',
  'anv_descriptor_set.c',
  'anv_device.c',
  'anv_embedded_sampler.c',
  'anv_event.c',
  'anv_formats.c',
  'anv_genX.h',
  'anv_image.c',
  'anv_image_host_copy.c',
  'anv_image_view.c',
  'anv_internal_kernels.c',
  'anv_internal_kernels.h',
  'anv_instance.c',
  'anv_kmd_backend.c',
  'anv_kmd_backend.h',
  'anv_measure.c',
  'anv_measure.h',
  'anv_nir.h',
  'anv_nir_apply_pipeline_layout.c',
  'anv_nir_compute_push_layout.c',
  'anv_nir_lower_multiview.c',
  'anv_nir_lower_ubo_loads.c',
  'anv_nir_lower_resource_intel.c',
  'anv_nir_lower_unaligned_dispatch.c',
  'anv_nir_push_descriptor_analysis.c',
  'anv_perf.c',
  'anv_physical_device.c',
  'anv_pipeline_cache.c',
  'anv_private.h',
  'anv_queue.c',
  'anv_rmv.c',
  'anv_rmv.h',
  'anv_sampler.c',
  'anv_shader.c',
  'anv_shader_compile.c',
  'anv_slab_bo.c',
  'anv_slab_bo.h',
  'anv_sparse.c',
  'anv_util.c',
  'anv_utrace.c',
  'anv_va.c',
  'anv_video.c',
  'anv_wsi.c',
  'bvh/anv_bvh.h',
  'bvh/anv_build_interface.h',
)

anv_deps = [
  dep_libdrm,
  dep_valgrind,
  idep_genxml,
  idep_mesautil,
  idep_nir_headers,
  idep_vulkan_util_headers,
  idep_vulkan_runtime_headers,
  idep_vulkan_wsi_headers,
  idep_intel_shaders,
  idep_intel_blorp,
  idep_mda,
]

if with_platform_x11
  anv_deps += dep_xcb_dri3
endif

if with_platform_wayland
  anv_deps += dep_wayland_client
endif

if with_xlib_lease
  anv_deps += [dep_xlib_xrandr]
endif

if with_platform_android
  anv_deps += idep_u_gralloc
  libanv_files += files('anv_android.c')
else
  libanv_files += files('anv_android_stubs.c')
endif

anv_deps += idep_intel_driver_ds_headers

libanv_common = static_library(
  'anv_common',
  [
    libanv_files, anv_entrypoints, sha1_h,
    gen_xml_pack, intel_float64_spv_h,
  ],
  include_directories : [
    inc_include, inc_src, inc_intel,
    inc_util,
  ],
  c_args : anv_flags,
  cpp_args : anv_cpp_flags,
  gnu_symbol_visibility : 'hidden',
  dependencies : anv_deps
)

libvulkan_intel = shared_library(
  'vulkan_intel',
  [files('anv_gem.c'), anv_entrypoints[0], bvh_spv],
  include_directories : [
    inc_include, inc_src, inc_intel,
  ],
  link_whole : [libanv_common, libanv_per_hw_ver_libs],
  link_with : [
    libisl, libintel_perf,
  ],
  dependencies : [
    dep_thread, dep_dl, dep_m, anv_deps, idep_libintel_common,
    idep_nir, idep_genxml, idep_vulkan_util, idep_vulkan_wsi,
    idep_vulkan_runtime, idep_mesautil, idep_xmlconfig,
    idep_intel_driver_ds, idep_intel_dev, idep_intel_blorp,
    idep_intel_compiler_brw, idep_intel_decoder_brw,
  ],
  c_args : anv_flags,
  gnu_symbol_visibility : 'hidden',
  link_args : [vulkan_icd_link_args, ld_args_build_id, ld_args_bsymbolic, ld_args_gc_sections],
  link_depends : vulkan_icd_link_depends,
  install : true,
)

if with_symbols_check
  test(
    'anv symbols check',
    symbols_check,
    args : [
      '--lib', libvulkan_intel,
      '--symbols-file', vulkan_icd_symbols,
      symbols_check_args,
    ],
    suite : ['intel'],
  )
endif

if with_tests
  libvulkan_intel_test = static_library(
    'vulkan_intel_test',
    [files('anv_gem_stubs.c'), anv_entrypoints[0]],
    include_directories : [
      inc_include, inc_src, inc_intel,
    ],
    link_whole : libanv_common,
    link_with : [
      libanv_per_hw_ver_libs, libintel_common,
      libisl, libintel_perf,
    ],
    dependencies : [
      dep_thread, dep_dl, dep_m, anv_deps,
      idep_nir, idep_vulkan_util, idep_vulkan_wsi, idep_vulkan_runtime,
      idep_mesautil, idep_intel_dev, idep_intel_blorp,
      idep_intel_compiler_brw, idep_intel_decoder_brw,
    ],
    c_args : anv_flags,
    gnu_symbol_visibility : 'hidden',
  )

  files_anv_tests = files(
    'tests/anv_tests.cpp',

    'tests/state_pool.c',
    'tests/state_pool_free_list_only.c',
    'tests/state_pool_max_size.c',
    'tests/state_pool_no_free.c',
    'tests/state_pool_padding.c',
    'tests/block_pool_no_free.c',
    'tests/block_pool_grow_first.c',
    'tests/block_pool_max_size.c',
  )

  test(
    'anv_tests',
    executable(
      'anv_tests',
      [files_anv_tests, anv_entrypoints[0]],
      c_args : [ sse2_args ],
      link_with : libvulkan_intel_test,
      dependencies : [
        idep_gtest, dep_libdrm, dep_thread, dep_m, dep_valgrind,
        idep_vulkan_util, idep_vulkan_wsi_headers,
        idep_vulkan_runtime, idep_intel_driver_ds, idep_intel_dev,
        anv_deps,
      ],
      include_directories : [
        inc_include, inc_src, inc_intel, inc_compiler, inc_nir
      ],
    ),
    suite : ['intel'],
    protocol : 'gtest',
    is_parallel : false,
    timeout : 60,
  )
endif