1# Copyright © 2019 Raspberry Pi 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 21v3dv_entrypoints = custom_target( 22 'v3dv_entrypoints.[ch]', 23 input : ['v3dv_entrypoints_gen.py', vk_api_xml], 24 output : ['v3dv_entrypoints.h', 'v3dv_entrypoints.c'], 25 command : [ 26 prog_python, '@INPUT0@', '--xml', '@INPUT1@', '--outdir', 27 meson.current_build_dir() 28 ], 29 depend_files : files('v3dv_extensions.py'), 30) 31 32v3dv_extensions_c = custom_target( 33 'v3dv_extensions.c', 34 input : ['v3dv_extensions_gen.py', vk_api_xml], 35 output : 'v3dv_extensions.c', 36 command : [ 37 prog_python, '@INPUT0@', '--xml', '@INPUT1@', 38 '--out-c', '@OUTPUT@', 39 ], 40 depend_files : files('v3dv_extensions.py'), 41) 42 43v3dv_extensions_h = custom_target( 44 'v3dv_extensions.h', 45 input : ['v3dv_extensions_gen.py', vk_api_xml], 46 output : 'v3dv_extensions.h', 47 command : [ 48 prog_python, '@INPUT0@', '--xml', '@INPUT1@', 49 '--out-h', '@OUTPUT@', 50 ], 51 depend_files : files('v3dv_extensions.py'), 52) 53 54libv3dv_files = files( 55 'v3dv_bo.c', 56 'v3dv_cl.c', 57 'v3dv_cmd_buffer.c', 58 'v3dv_debug.c', 59 'v3dv_debug.h', 60 'v3dv_descriptor_set.c', 61 'v3dv_device.c', 62 'v3dv_formats.c', 63 'v3dv_image.c', 64 'v3dv_limits.h', 65 'v3dv_meta_clear.c', 66 'v3dv_meta_copy.c', 67 'v3dv_pass.c', 68 'v3dv_pipeline.c', 69 'v3dv_pipeline_cache.c', 70 'v3dv_private.h', 71 'v3dv_query.c', 72 'v3dv_queue.c', 73 'v3dv_uniforms.c', 74 'v3dv_util.c', 75 'v3dv_wsi.c', 76 'v3d_tiling.c', 77) 78 79# The vulkan driver only supports version >= 42, which is the version present in 80# Rpi4. We need to explicitly set it as we are reusing pieces from the GL v3d 81# driver. 82v3dv_flags = ['-DV3D_VERSION=42'] 83 84dep_v3dv3 = dependency('v3dv3', required : false) 85if dep_v3dv3.found() 86 v3dv_flags += '-DUSE_V3D_SIMULATOR' 87endif 88 89v3dv_deps = [ 90 dep_dl, 91 dep_libdrm, 92 dep_valgrind, 93 dep_v3dv3, 94 idep_nir, 95 idep_nir_headers, 96 idep_vulkan_util, 97] 98 99if with_platform_x11 100 v3dv_deps += dep_xcb_dri3 101 v3dv_flags += [ 102 '-DVK_USE_PLATFORM_XCB_KHR', 103 '-DVK_USE_PLATFORM_XLIB_KHR', 104 ] 105 libv3dv_files += files('v3dv_wsi_x11.c') 106endif 107 108libvulkan_broadcom = shared_library( 109 'vulkan_broadcom', 110 [libv3dv_files, v3dv_entrypoints, v3dv_extensions_c, v3dv_extensions_h, sha1_h], 111 include_directories : [ 112 inc_include, inc_src, inc_mapi, inc_mesa, inc_gallium, inc_gallium_aux, inc_broadcom, inc_compiler, inc_util, inc_vulkan_wsi, 113 ], 114 link_with : [ 115 libbroadcom_cle, 116 libbroadcom_v3d, 117 # For glsl_type_singleton_init_or_ref: 118 libglsl, 119 libvulkan_wsi, 120 ], 121 dependencies : v3dv_deps, 122 c_args : v3dv_flags, 123 link_args : ['-Wl,--build-id=sha1', ld_args_bsymbolic, ld_args_gc_sections], 124 gnu_symbol_visibility : 'hidden', 125 install : true, 126) 127 128if with_symbols_check 129 test( 130 'v3dv symbols check', 131 symbols_check, 132 args : [ 133 '--lib', libvulkan_broadcom, 134 '--symbols-file', vulkan_icd_symbols, 135 symbols_check_args, 136 ], 137 suite : ['broadcom'], 138 ) 139endif 140 141broadcom_icd = custom_target( 142 'broadcom_icd', 143 input : 'v3dv_icd.py', 144 output : 'broadcom_icd.@0@.json'.format(host_machine.cpu()), 145 command : [ 146 prog_python, '@INPUT@', 147 '--lib-path', join_paths(get_option('prefix'), get_option('libdir')), 148 '--out', '@OUTPUT@', 149 ], 150 depend_files : files('v3dv_extensions.py'), 151 build_by_default : true, 152 install_dir : with_vulkan_icd_dir, 153 install : true, 154) 155