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_v5', '--device-prefix', 'panvk_v6', '--device-prefix', 'panvk_v7', 32 ], 33 depend_files : vk_entrypoints_gen_depend_files, 34) 35 36libpanvk_files = files( 37 'panvk_cmd_buffer.c', 38 'panvk_cs.c', 39 'panvk_device.c', 40 'panvk_descriptor_set.c', 41 'panvk_formats.c', 42 'panvk_image.c', 43 'panvk_mempool.c', 44 'panvk_pass.c', 45 'panvk_pipeline.c', 46 'panvk_pipeline_cache.c', 47 'panvk_private.h', 48 'panvk_query.c', 49 'panvk_shader.c', 50 'panvk_sync.c', 51 'panvk_util.c', 52 'panvk_wsi.c', 53) 54 55panvk_deps = [] 56panvk_flags = [] 57panvk_per_arch_libs = [] 58 59foreach arch : ['5', '6', '7'] 60 panvk_per_arch_libs += static_library( 61 'panvk_v@0@'.format(arch), 62 [ 63 panvk_entrypoints[0], 64 'panvk_vX_cmd_buffer.c', 65 'panvk_vX_cs.c', 66 'panvk_vX_descriptor_set.c', 67 'panvk_vX_device.c', 68 'panvk_vX_image.c', 69 'panvk_vX_meta.c', 70 'panvk_vX_meta_blit.c', 71 'panvk_vX_meta_copy.c', 72 'panvk_vX_meta_clear.c', 73 'panvk_vX_pipeline.c', 74 'panvk_vX_shader.c', 75 ], 76 include_directories : [ 77 inc_include, 78 inc_src, 79 inc_compiler, 80 inc_gallium, # XXX: pipe/p_format.h 81 inc_gallium_aux, # XXX: renderonly 82 inc_panfrost, 83 ], 84 dependencies : [ 85 idep_nir_headers, 86 idep_pan_packers, 87 idep_vulkan_util_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, dep_wl_protocols] 98 libpanvk_files += [wayland_drm_client_protocol_h, wayland_drm_protocol_c] 99endif 100 101libvulkan_panfrost = shared_library( 102 'vulkan_panfrost', 103 [libpanvk_files, panvk_entrypoints], 104 include_directories : [ 105 inc_include, 106 inc_src, 107 inc_compiler, 108 inc_gallium, # XXX: pipe/p_format.h 109 inc_gallium_aux, # XXX: renderonly 110 inc_panfrost, 111 ], 112 link_whole : [panvk_per_arch_libs], 113 link_with : [ 114 libpanfrost_shared, 115 libpanfrost_midgard, 116 libpanfrost_bifrost, 117 libpanfrost_decode, 118 libpanfrost_lib, 119 libpanfrost_util, 120 ], 121 dependencies : [ 122 dep_dl, 123 dep_elf, 124 dep_libdrm, 125 dep_m, 126 dep_thread, 127 dep_valgrind, 128 idep_nir, 129 idep_pan_packers, 130 panvk_deps, 131 idep_vulkan_util, 132 idep_vulkan_wsi, 133 idep_mesautil, 134 ], 135 c_args : [no_override_init_args, panvk_flags], 136 link_args : [ld_args_bsymbolic, ld_args_gc_sections], 137 install : true, 138) 139 140panfrost_icd = custom_target( 141 'panfrost_icd', 142 input : [vk_icd_gen, vk_api_xml], 143 output : 'panfrost_icd.@0@.json'.format(host_machine.cpu()), 144 command : [ 145 prog_python, '@INPUT0@', 146 '--api-version', '1.1', '--xml', '@INPUT1@', 147 '--lib-path', join_paths(get_option('prefix'), get_option('libdir'), 148 'libvulkan_panfrost.so'), 149 '--out', '@OUTPUT@', 150 ], 151 build_by_default : true, 152 install_dir : with_vulkan_icd_dir, 153 install : true, 154) 155