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