1# Copyright © 2019 Raspberry Pi Ltd 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', 23 input : [vk_entrypoints_gen, vk_api_xml], 24 output : ['v3dv_entrypoints.h', 'v3dv_entrypoints.c'], 25 command : [ 26 prog_python, '@INPUT0@', '--xml', '@INPUT1@', '--proto', '--weak', 27 '--out-h', '@OUTPUT0@', '--out-c', '@OUTPUT1@', '--prefix', 'v3dv', 28 '--device-prefix', 'ver42', 29 ], 30 depend_files : vk_entrypoints_gen_depend_files, 31) 32 33libv3dv_files = files( 34 'v3dv_bo.c', 35 'v3dv_cl.c', 36 'v3dv_cmd_buffer.c', 37 'v3dv_debug.c', 38 'v3dv_debug.h', 39 'v3dv_descriptor_set.c', 40 'v3dv_device.c', 41 'v3dv_formats.c', 42 'v3dv_image.c', 43 'v3dv_limits.h', 44 'v3dv_meta_clear.c', 45 'v3dv_meta_copy.c', 46 'v3dv_pass.c', 47 'v3dv_pipeline.c', 48 'v3dv_pipeline_cache.c', 49 'v3dv_private.h', 50 'v3dv_query.c', 51 'v3dv_queue.c', 52 'v3dv_uniforms.c', 53 'v3dv_wsi.c', 54) + [v3d_xml_pack, vk_common_entrypoints[0], wsi_entrypoints[0]] 55 56files_per_version = files( 57 'v3dvx_cmd_buffer.c', 58 'v3dvx_descriptor_set.c', 59 'v3dvx_device.c', 60 'v3dvx_formats.c', 61 'v3dvx_image.c', 62 'v3dvx_pipeline.c', 63 'v3dvx_meta_common.c', 64 'v3dvx_pipeline.c', 65 'v3dvx_queue.c', 66) 67 68# The vulkan driver only supports version >= 42, which is the version present in 69# Rpi4. We need to explicitly set it as we are reusing pieces from the GL v3d 70# driver. 71v3d_versions = ['42'] 72 73v3dv_flags = [] 74 75dep_v3dv3 = dependency('v3dv3', required : false) 76if dep_v3dv3.found() 77 v3dv_flags += '-DUSE_V3D_SIMULATOR' 78endif 79 80v3dv_deps = [ 81 dep_dl, 82 dep_libdrm, 83 dep_valgrind, 84 dep_v3dv3, 85 idep_nir, 86 idep_nir_headers, 87 idep_vulkan_util, 88 idep_vulkan_runtime, 89 idep_vulkan_wsi, 90] 91 92if with_platform_x11 93 v3dv_deps += dep_xcb_dri3 94endif 95 96if with_platform_wayland 97 v3dv_deps += [dep_wayland_client, dep_wl_protocols] 98 libv3dv_files += [wayland_drm_client_protocol_h, wayland_drm_protocol_c] 99endif 100 101if with_platform_android 102 v3dv_deps += dep_android 103 v3dv_flags += '-DVK_USE_PLATFORM_ANDROID_KHR' 104 libv3dv_files += files('v3dv_android.c') 105endif 106 107per_version_libs = [] 108foreach ver : v3d_versions 109 per_version_libs += static_library( 110 'v3dv-v' + ver, 111 [files_per_version, v3d_xml_pack, v3dv_entrypoints[0]], 112 include_directories : [ 113 inc_src, inc_include, inc_gallium, inc_gallium_aux, inc_broadcom, 114 inc_compiler, inc_util, 115 ], 116 c_args : [v3dv_flags, '-DV3D_VERSION=' + ver], 117 gnu_symbol_visibility : 'hidden', 118 dependencies : [v3dv_deps], 119) 120endforeach 121 122libvulkan_broadcom = shared_library( 123 'vulkan_broadcom', 124 [libv3dv_files, v3dv_entrypoints, sha1_h], 125 include_directories : [ 126 inc_include, inc_src, inc_mapi, inc_mesa, inc_gallium, inc_gallium_aux, inc_broadcom, inc_compiler, inc_util, 127 ], 128 link_with : [ 129 libbroadcom_cle, 130 libbroadcom_v3d, 131 per_version_libs, 132 ], 133 dependencies : v3dv_deps, 134 c_args : v3dv_flags, 135 link_args : ['-Wl,--build-id=sha1', ld_args_bsymbolic, ld_args_gc_sections], 136 gnu_symbol_visibility : 'hidden', 137 install : true, 138) 139 140if with_symbols_check 141 test( 142 'v3dv symbols check', 143 symbols_check, 144 args : [ 145 '--lib', libvulkan_broadcom, 146 '--symbols-file', vulkan_icd_symbols, 147 symbols_check_args, 148 ], 149 suite : ['broadcom'], 150 ) 151endif 152 153broadcom_icd = custom_target( 154 'broadcom_icd', 155 input : [vk_icd_gen, vk_api_xml], 156 output : 'broadcom_icd.@0@.json'.format(host_machine.cpu()), 157 command : [ 158 prog_python, '@INPUT0@', 159 '--api-version', '1.2', '--xml', '@INPUT1@', 160 '--lib-path', join_paths(get_option('prefix'), get_option('libdir'), 161 'libvulkan_broadcom.so'), 162 '--out', '@OUTPUT@', 163 ], 164 build_by_default : true, 165 install_dir : with_vulkan_icd_dir, 166 install : true, 167) 168 169if meson.version().version_compare('>= 0.58') 170 _dev_icdname = 'broadcom_devenv_icd.@0@.json'.format(host_machine.cpu()) 171 custom_target( 172 'broadcom_devenv_icd', 173 input : [vk_icd_gen, vk_api_xml], 174 output : _dev_icdname, 175 command : [ 176 prog_python, '@INPUT0@', 177 '--api-version', '1.3', '--xml', '@INPUT1@', 178 '--lib-path', meson.current_build_dir() / 'libvulkan_broadcom.so', 179 '--out', '@OUTPUT@', 180 ], 181 build_by_default : true, 182 ) 183 184 devenv.append('VK_ICD_FILENAMES', meson.current_build_dir() / _dev_icdname) 185endif 186