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