1# Copyright © 2021 Collabora Ltd. 2# 3# Derived from the freedreno driver which is: 4# Copyright © 2017 Intel Corporation 5 6# Permission is hereby granted, free of charge, to any person obtaining a copy 7# of this software and associated documentation files (the "Software"), to deal 8# in the Software without restriction, including without limitation the rights 9# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10# copies of the Software, and to permit persons to whom the Software is 11# furnished to do so, subject to the following conditions: 12 13# The above copyright notice and this permission notice shall be included in 14# all copies or substantial portions of the Software. 15 16# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22# SOFTWARE. 23 24panvk_entrypoints = custom_target( 25 'panvk_entrypoints.[ch]', 26 input : [vk_entrypoints_gen, vk_api_xml], 27 output : ['panvk_entrypoints.h', 'panvk_entrypoints.c'], 28 command : [ 29 prog_python, '@INPUT0@', '--xml', '@INPUT1@', '--proto', '--weak', 30 '--out-h', '@OUTPUT0@', '--out-c', '@OUTPUT1@', '--prefix', 'panvk', 31 '--device-prefix', 'panvk_v6', '--device-prefix', 'panvk_v7', 32 '--beta', with_vulkan_beta.to_string() 33 ], 34 depend_files : vk_entrypoints_gen_depend_files, 35) 36 37libpanvk_files = files( 38 'panvk_cmd_buffer.c', 39 'panvk_cs.c', 40 'panvk_device.c', 41 'panvk_descriptor_set.c', 42 'panvk_formats.c', 43 'panvk_image.c', 44 'panvk_mempool.c', 45 'panvk_pass.c', 46 'panvk_pipeline.c', 47 'panvk_pipeline_cache.c', 48 'panvk_private.h', 49 'panvk_query.c', 50 'panvk_shader.c', 51 'panvk_wsi.c', 52) + [vk_cmd_enqueue_entrypoints[0], vk_common_entrypoints[0]] 53 54panvk_deps = [] 55panvk_flags = [] 56panvk_per_arch_libs = [] 57 58foreach arch : ['6', '7'] 59 panvk_per_arch_libs += static_library( 60 'panvk_v@0@'.format(arch), 61 [ 62 panvk_entrypoints[0], 63 'panvk_vX_cmd_buffer.c', 64 'panvk_vX_cs.c', 65 'panvk_vX_descriptor_set.c', 66 'panvk_vX_device.c', 67 'panvk_vX_image.c', 68 'panvk_vX_meta.c', 69 'panvk_vX_meta_blit.c', 70 'panvk_vX_meta_copy.c', 71 'panvk_vX_meta_clear.c', 72 'panvk_vX_nir_lower_descriptors.c', 73 'panvk_vX_pipeline.c', 74 'panvk_vX_shader.c', 75 ], 76 include_directories : [ 77 inc_include, 78 inc_src, 79 inc_gallium, # XXX: util/format/u_formats.h 80 inc_gallium_aux, # XXX: renderonly 81 inc_panfrost, 82 ], 83 dependencies : [ 84 idep_nir_headers, 85 idep_pan_packers, 86 idep_vulkan_util_headers, 87 idep_vulkan_runtime_headers, 88 idep_vulkan_wsi_headers, 89 dep_libdrm, 90 dep_valgrind, 91 ], 92 c_args : [no_override_init_args, panvk_flags, '-DPAN_ARCH=@0@'.format(arch)], 93 ) 94endforeach 95 96if with_platform_wayland 97 panvk_deps += dep_wayland_client 98 libpanvk_files += [wayland_drm_client_protocol_h, wayland_drm_protocol_c] 99endif 100 101if with_platform_android 102 panvk_deps += [dep_android] 103 panvk_flags += '-DVK_USE_PLATFORM_ANDROID_KHR' 104 libpanvk_files += files('panvk_android.c') 105endif 106 107libvulkan_panfrost = shared_library( 108 'vulkan_panfrost', 109 [libpanvk_files, panvk_entrypoints], 110 include_directories : [ 111 inc_include, 112 inc_src, 113 inc_gallium, # XXX: util/format/u_formats.h 114 inc_gallium_aux, # XXX: renderonly 115 inc_panfrost, 116 ], 117 link_whole : [panvk_per_arch_libs], 118 link_with : [ 119 libpanfrost_shared, 120 libpanfrost_midgard, 121 libpanfrost_bifrost, 122 libpanfrost_decode, 123 libpanfrost_lib, 124 libpanfrost_util, 125 ], 126 dependencies : [ 127 dep_dl, 128 dep_elf, 129 dep_libdrm, 130 dep_m, 131 dep_thread, 132 dep_valgrind, 133 idep_nir, 134 idep_pan_packers, 135 panvk_deps, 136 idep_vulkan_util, 137 idep_vulkan_runtime, 138 idep_vulkan_wsi, 139 idep_mesautil, 140 ], 141 c_args : [no_override_init_args, panvk_flags], 142 link_args : [ld_args_bsymbolic, ld_args_gc_sections], 143 install : true, 144) 145 146panfrost_icd = custom_target( 147 'panfrost_icd', 148 input : [vk_icd_gen, vk_api_xml], 149 output : 'panfrost_icd.@0@.json'.format(host_machine.cpu()), 150 command : [ 151 prog_python, '@INPUT0@', 152 '--api-version', '1.0', '--xml', '@INPUT1@', 153 '--lib-path', join_paths(get_option('prefix'), get_option('libdir'), 154 'libvulkan_panfrost.so'), 155 '--out', '@OUTPUT@', 156 ], 157 build_by_default : true, 158 install_dir : with_vulkan_icd_dir, 159 install_tag : 'runtime', 160 install : true, 161) 162 163_dev_icdname = 'panfrost_devenv_icd.@0@.json'.format(host_machine.cpu()) 164_dev_icd = custom_target( 165 'panfrost_devenv_icd', 166 input : [vk_icd_gen, vk_api_xml], 167 output : _dev_icdname, 168 command : [ 169 prog_python, '@INPUT0@', 170 '--api-version', '1.0', '--xml', '@INPUT1@', 171 '--lib-path', meson.current_build_dir() / 'libvulkan_panfrost.so', 172 '--out', '@OUTPUT@', 173 ], 174 build_by_default : true, 175) 176 177devenv.append('VK_ICD_FILENAMES', _dev_icd.full_path()) 178