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