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_extensions_py = files('anv_extensions.py') 22 23anv_entrypoints = custom_target( 24 'anv_entrypoints.[ch]', 25 input : ['anv_entrypoints_gen.py', vk_api_xml], 26 output : ['anv_entrypoints.h', 'anv_entrypoints.c'], 27 command : [ 28 prog_python, '@INPUT0@', '--xml', '@INPUT1@', 29 '--outdir', meson.current_build_dir(), 30 ], 31 depend_files : anv_extensions_py, 32) 33 34anv_extensions_c = custom_target( 35 'anv_extensions.c', 36 input : ['anv_extensions_gen.py', vk_api_xml], 37 output : 'anv_extensions.c', 38 command : [ 39 prog_python, '@INPUT0@', '--xml', '@INPUT1@', 40 '--out-c', '@OUTPUT@', 41 ], 42 depend_files : anv_extensions_py, 43) 44 45anv_extensions_h = custom_target( 46 'anv_extensions.h', 47 input : ['anv_extensions_gen.py', vk_api_xml], 48 output : 'anv_extensions.h', 49 command : [ 50 prog_python, '@INPUT0@', '--xml', '@INPUT1@', 51 '--out-h', '@OUTPUT@', 52 ], 53 depend_files : anv_extensions_py, 54) 55 56intel_icd = custom_target( 57 'intel_icd', 58 input : 'anv_icd.py', 59 output : 'intel_icd.@0@.json'.format(host_machine.cpu()), 60 command : [ 61 prog_python, '@INPUT@', 62 '--lib-path', join_paths(get_option('prefix'), get_option('libdir')), 63 '--out', '@OUTPUT@', 64 ], 65 depend_files : anv_extensions_py, 66 build_by_default : true, 67 install_dir : with_vulkan_icd_dir, 68 install : true, 69) 70 71libanv_gen_libs = [] 72anv_gen_files = files( 73 'genX_blorp_exec.c', 74 'genX_cmd_buffer.c', 75 'genX_gpu_memcpy.c', 76 'genX_pipeline.c', 77 'genX_query.c', 78 'genX_state.c', 79) 80foreach g : [['70', ['gen7_cmd_buffer.c']], ['75', ['gen7_cmd_buffer.c']], 81 ['80', ['gen8_cmd_buffer.c']], ['90', ['gen8_cmd_buffer.c']], 82 ['110', ['gen8_cmd_buffer.c']], ['120', ['gen8_cmd_buffer.c']]] 83 _gen = g[0] 84 libanv_gen_libs += static_library( 85 'anv_gen@0@'.format(_gen), 86 [anv_gen_files, g[1], anv_entrypoints[0], anv_extensions_h], 87 include_directories : [ 88 inc_include, inc_src, inc_mapi, inc_mesa, inc_gallium, inc_compiler, inc_intel, inc_vulkan_wsi, 89 ], 90 c_args : [ 91 no_override_init_args, c_sse2_args, 92 '-DGEN_VERSIONx10=@0@'.format(_gen), 93 ], 94 gnu_symbol_visibility : 'hidden', 95 dependencies : [ 96 dep_libdrm, dep_valgrind, idep_nir_headers, idep_genxml, idep_vulkan_util_headers, 97 ], 98 ) 99endforeach 100 101libanv_files = files( 102 'anv_allocator.c', 103 'anv_android.h', 104 'anv_batch_chain.c', 105 'anv_blorp.c', 106 'anv_cmd_buffer.c', 107 'anv_descriptor_set.c', 108 'anv_device.c', 109 'anv_dump.c', 110 'anv_formats.c', 111 'anv_genX.h', 112 'anv_image.c', 113 'anv_intel.c', 114 'anv_nir.h', 115 'anv_nir_add_base_work_group_id.c', 116 'anv_nir_apply_pipeline_layout.c', 117 'anv_nir_compute_push_layout.c', 118 'anv_nir_lower_multiview.c', 119 'anv_nir_lower_ycbcr_textures.c', 120 'anv_pass.c', 121 'anv_perf.c', 122 'anv_pipeline.c', 123 'anv_pipeline_cache.c', 124 'anv_private.h', 125 'anv_queue.c', 126 'anv_util.c', 127 'anv_wsi.c', 128 'vk_format_info.h', 129) 130 131anv_deps = [ 132 dep_libdrm, 133 dep_valgrind, 134 idep_nir_headers, 135 idep_vulkan_util_headers, 136] 137anv_flags = [ 138 no_override_init_args, 139 c_sse2_args, 140] 141 142if with_platform_x11 143 anv_deps += dep_xcb_dri3 144 anv_flags += [ 145 '-DVK_USE_PLATFORM_XCB_KHR', 146 '-DVK_USE_PLATFORM_XLIB_KHR', 147 ] 148 libanv_files += files('anv_wsi_x11.c') 149endif 150 151if with_platform_wayland 152 anv_deps += dep_wayland_client 153 anv_flags += '-DVK_USE_PLATFORM_WAYLAND_KHR' 154 libanv_files += files('anv_wsi_wayland.c') 155endif 156 157if system_has_kms_drm and not with_platform_android 158 anv_flags += '-DVK_USE_PLATFORM_DISPLAY_KHR' 159 libanv_files += files('anv_wsi_display.c') 160endif 161 162if with_xlib_lease 163 anv_deps += [dep_xcb_xrandr, dep_xlib_xrandr] 164 anv_flags += '-DVK_USE_PLATFORM_XLIB_XRANDR_EXT' 165endif 166 167if with_platform_android 168 anv_flags += '-DVK_USE_PLATFORM_ANDROID_KHR' 169 libanv_files += files('anv_android.c') 170else 171 libanv_files += files('anv_android_stubs.c') 172endif 173 174libanv_common = static_library( 175 'anv_common', 176 [ 177 libanv_files, anv_entrypoints, anv_extensions_c, anv_extensions_h, sha1_h, 178 gen_xml_pack, 179 ], 180 include_directories : [ 181 inc_include, inc_src, inc_mapi, inc_mesa, inc_gallium, inc_intel, inc_compiler, 182 inc_vulkan_wsi, inc_util, 183 ], 184 c_args : anv_flags, 185 gnu_symbol_visibility : 'hidden', 186 dependencies : anv_deps, 187) 188 189libvulkan_intel = shared_library( 190 'vulkan_intel', 191 [files('anv_gem.c'), anv_entrypoints[0], anv_extensions_h], 192 include_directories : [ 193 inc_include, inc_src, inc_mapi, inc_mesa, inc_gallium, inc_intel, inc_compiler, inc_vulkan_wsi, 194 ], 195 link_whole : [libanv_common, libanv_gen_libs], 196 link_with : [ 197 libintel_compiler, libintel_dev, libisl, libblorp, libvulkan_wsi, 198 libintel_perf, 199 ], 200 dependencies : [ 201 dep_thread, dep_dl, dep_m, anv_deps, idep_libintel_common, 202 idep_nir, idep_genxml, idep_vulkan_util, idep_mesautil, idep_xmlconfig, 203 ], 204 c_args : anv_flags, 205 gnu_symbol_visibility : 'hidden', 206 link_args : [ld_args_build_id, ld_args_bsymbolic, ld_args_gc_sections], 207 install : true, 208) 209 210if with_symbols_check 211 if get_option('buildtype') == 'debug' # Same rule as `-DDEBUG` in /meson.build 212 _extra_args = [ 213 '--ignore-symbol', 'anv_dump_start', 214 '--ignore-symbol', 'anv_dump_finish', 215 ] 216 else 217 _extra_args = [] 218 endif 219 220 test( 221 'anv symbols check', 222 symbols_check, 223 args : [ 224 '--lib', libvulkan_intel, 225 '--symbols-file', vulkan_icd_symbols, 226 _extra_args, 227 symbols_check_args, 228 ], 229 suite : ['intel'], 230 ) 231endif 232 233if with_tests 234 libvulkan_intel_test = static_library( 235 'vulkan_intel_test', 236 [files('anv_gem_stubs.c'), anv_entrypoints[0], anv_extensions_h], 237 include_directories : [ 238 inc_include, inc_src, inc_mapi, inc_mesa, inc_gallium, inc_intel, inc_compiler, inc_vulkan_wsi, 239 ], 240 link_whole : libanv_common, 241 link_with : [ 242 libanv_gen_libs, libintel_compiler, libintel_common, libintel_dev, 243 libisl, libblorp, libvulkan_wsi, libintel_perf, 244 ], 245 dependencies : [ 246 dep_thread, dep_dl, dep_m, anv_deps, 247 idep_nir, idep_vulkan_util, idep_mesautil, 248 ], 249 c_args : anv_flags, 250 gnu_symbol_visibility : 'hidden', 251 ) 252 253 foreach t : ['block_pool_no_free', 'block_pool_grow_first', 254 'state_pool_no_free', 'state_pool_free_list_only', 255 'state_pool', 'state_pool_padding'] 256 test( 257 'anv_@0@'.format(t), 258 executable( 259 t, 260 ['tests/@0@.c'.format(t), anv_entrypoints[0], anv_extensions_h], 261 c_args : [ c_sse2_args ], 262 link_with : libvulkan_intel_test, 263 dependencies : [dep_libdrm, dep_thread, dep_m, dep_valgrind, idep_vulkan_util, ], 264 include_directories : [ 265 inc_include, inc_src, inc_mapi, inc_mesa, inc_gallium, inc_intel, inc_compiler, inc_vulkan_wsi, 266 ], 267 ), 268 suite : ['intel'], 269 ) 270 endforeach 271endif 272