1bf215546Sopenharmony_ci# Copyright © 2022 Imagination Technologies Ltd. 2bf215546Sopenharmony_ci 3bf215546Sopenharmony_ci# Permission is hereby granted, free of charge, to any person obtaining a copy 4bf215546Sopenharmony_ci# of this software and associated documentation files (the "Software"), to deal 5bf215546Sopenharmony_ci# in the Software without restriction, including without limitation the rights 6bf215546Sopenharmony_ci# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7bf215546Sopenharmony_ci# copies of the Software, and to permit persons to whom the Software is 8bf215546Sopenharmony_ci# furnished to do so, subject to the following conditions: 9bf215546Sopenharmony_ci 10bf215546Sopenharmony_ci# The above copyright notice and this permission notice (including the next 11bf215546Sopenharmony_ci# paragraph) shall be included in all copies or substantial portions of the 12bf215546Sopenharmony_ci# Software. 13bf215546Sopenharmony_ci 14bf215546Sopenharmony_ci# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15bf215546Sopenharmony_ci# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16bf215546Sopenharmony_ci# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17bf215546Sopenharmony_ci# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18bf215546Sopenharmony_ci# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19bf215546Sopenharmony_ci# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 20bf215546Sopenharmony_ci# SOFTWARE. 21bf215546Sopenharmony_ci 22bf215546Sopenharmony_cisubdir('pds') 23bf215546Sopenharmony_ci 24bf215546Sopenharmony_cipvr_entrypoints = custom_target( 25bf215546Sopenharmony_ci 'pvr_entrypoints', 26bf215546Sopenharmony_ci input : [vk_entrypoints_gen, vk_api_xml], 27bf215546Sopenharmony_ci output : ['pvr_entrypoints.h', 'pvr_entrypoints.c'], 28bf215546Sopenharmony_ci command : [ 29bf215546Sopenharmony_ci prog_python, '@INPUT0@', '--xml', '@INPUT1@', '--proto', '--weak', 30bf215546Sopenharmony_ci '--out-h', '@OUTPUT0@', '--out-c', '@OUTPUT1@', '--prefix', 'pvr', 31bf215546Sopenharmony_ci ], 32bf215546Sopenharmony_ci depend_files : vk_entrypoints_gen_depend_files, 33bf215546Sopenharmony_ci) 34bf215546Sopenharmony_ci 35bf215546Sopenharmony_cipvr_files = files( 36bf215546Sopenharmony_ci 'winsys/powervr/pvr_drm.c', 37bf215546Sopenharmony_ci 'winsys/pvr_winsys.c', 38bf215546Sopenharmony_ci 'winsys/pvr_winsys_helper.c', 39bf215546Sopenharmony_ci 'pvr_blit.c', 40bf215546Sopenharmony_ci 'pvr_bo.c', 41bf215546Sopenharmony_ci 'pvr_cmd_buffer.c', 42bf215546Sopenharmony_ci 'pvr_csb.c', 43bf215546Sopenharmony_ci 'pvr_descriptor_set.c', 44bf215546Sopenharmony_ci 'pvr_device.c', 45bf215546Sopenharmony_ci 'pvr_formats.c', 46bf215546Sopenharmony_ci 'pvr_hardcode.c', 47bf215546Sopenharmony_ci 'pvr_hw_pass.c', 48bf215546Sopenharmony_ci 'pvr_image.c', 49bf215546Sopenharmony_ci 'pvr_job_common.c', 50bf215546Sopenharmony_ci 'pvr_job_compute.c', 51bf215546Sopenharmony_ci 'pvr_job_context.c', 52bf215546Sopenharmony_ci 'pvr_job_render.c', 53bf215546Sopenharmony_ci 'pvr_job_transfer.c', 54bf215546Sopenharmony_ci 'pvr_pass.c', 55bf215546Sopenharmony_ci 'pvr_pipeline.c', 56bf215546Sopenharmony_ci 'pvr_pipeline_cache.c', 57bf215546Sopenharmony_ci 'pvr_query.c', 58bf215546Sopenharmony_ci 'pvr_queue.c', 59bf215546Sopenharmony_ci 'pvr_shader.c', 60bf215546Sopenharmony_ci 'pvr_tex_state.c', 61bf215546Sopenharmony_ci 'pvr_wsi.c', 62bf215546Sopenharmony_ci) 63bf215546Sopenharmony_ci 64bf215546Sopenharmony_cipvr_includes = [ 65bf215546Sopenharmony_ci include_directories('usc/programs'), 66bf215546Sopenharmony_ci include_directories('winsys'), 67bf215546Sopenharmony_ci libpowervr_pds_includes, 68bf215546Sopenharmony_ci] 69bf215546Sopenharmony_ci 70bf215546Sopenharmony_cipvr_deps = [ 71bf215546Sopenharmony_ci dep_csbgen, 72bf215546Sopenharmony_ci dep_libdrm, 73bf215546Sopenharmony_ci dep_valgrind, 74bf215546Sopenharmony_ci idep_vulkan_runtime, 75bf215546Sopenharmony_ci idep_vulkan_util, 76bf215546Sopenharmony_ci idep_vulkan_wsi, 77bf215546Sopenharmony_ci] 78bf215546Sopenharmony_ci 79bf215546Sopenharmony_cipvr_flags = [ 80bf215546Sopenharmony_ci no_override_init_args, 81bf215546Sopenharmony_ci] 82bf215546Sopenharmony_ci 83bf215546Sopenharmony_ciif with_imagination_srv 84bf215546Sopenharmony_ci pvr_files += files( 85bf215546Sopenharmony_ci 'winsys/pvrsrvkm/pvr_srv.c', 86bf215546Sopenharmony_ci 'winsys/pvrsrvkm/pvr_srv_bo.c', 87bf215546Sopenharmony_ci 'winsys/pvrsrvkm/pvr_srv_bridge.c', 88bf215546Sopenharmony_ci 'winsys/pvrsrvkm/pvr_srv_job_common.c', 89bf215546Sopenharmony_ci 'winsys/pvrsrvkm/pvr_srv_job_compute.c', 90bf215546Sopenharmony_ci 'winsys/pvrsrvkm/pvr_srv_job_null.c', 91bf215546Sopenharmony_ci 'winsys/pvrsrvkm/pvr_srv_job_render.c', 92bf215546Sopenharmony_ci 'winsys/pvrsrvkm/pvr_srv_job_transfer.c', 93bf215546Sopenharmony_ci 'winsys/pvrsrvkm/pvr_srv_sync.c', 94bf215546Sopenharmony_ci ) 95bf215546Sopenharmony_ci pvr_flags += '-DPVR_SUPPORT_SERVICES_DRIVER' 96bf215546Sopenharmony_ciendif 97bf215546Sopenharmony_ci 98bf215546Sopenharmony_cilibvulkan_powervr_mesa = shared_library( 99bf215546Sopenharmony_ci 'vulkan_powervr_mesa', 100bf215546Sopenharmony_ci [pvr_files, pvr_entrypoints], 101bf215546Sopenharmony_ci include_directories : [ 102bf215546Sopenharmony_ci pvr_includes, 103bf215546Sopenharmony_ci inc_gallium_aux, 104bf215546Sopenharmony_ci inc_imagination, 105bf215546Sopenharmony_ci inc_include, 106bf215546Sopenharmony_ci inc_src, 107bf215546Sopenharmony_ci inc_mesa, 108bf215546Sopenharmony_ci inc_gallium, 109bf215546Sopenharmony_ci inc_compiler, 110bf215546Sopenharmony_ci ], 111bf215546Sopenharmony_ci link_with : [ 112bf215546Sopenharmony_ci libpowervr_common, 113bf215546Sopenharmony_ci libpowervr_pds, 114bf215546Sopenharmony_ci libpowervr_rogue, 115bf215546Sopenharmony_ci libvulkan_wsi, 116bf215546Sopenharmony_ci ], 117bf215546Sopenharmony_ci dependencies : [ 118bf215546Sopenharmony_ci pvr_deps, 119bf215546Sopenharmony_ci idep_nir, 120bf215546Sopenharmony_ci ], 121bf215546Sopenharmony_ci c_args : pvr_flags, 122bf215546Sopenharmony_ci link_args : [ 123bf215546Sopenharmony_ci ld_args_build_id, 124bf215546Sopenharmony_ci ld_args_bsymbolic, 125bf215546Sopenharmony_ci ld_args_gc_sections 126bf215546Sopenharmony_ci ], 127bf215546Sopenharmony_ci gnu_symbol_visibility : 'hidden', 128bf215546Sopenharmony_ci install : true, 129bf215546Sopenharmony_ci) 130bf215546Sopenharmony_ci 131bf215546Sopenharmony_ciif with_symbols_check 132bf215546Sopenharmony_ci test( 133bf215546Sopenharmony_ci 'pvr symbols check', 134bf215546Sopenharmony_ci symbols_check, 135bf215546Sopenharmony_ci args : [ 136bf215546Sopenharmony_ci '--lib', libvulkan_powervr_mesa, 137bf215546Sopenharmony_ci '--symbols-file', vulkan_icd_symbols, 138bf215546Sopenharmony_ci symbols_check_args, 139bf215546Sopenharmony_ci ], 140bf215546Sopenharmony_ci suite : ['imagination'], 141bf215546Sopenharmony_ci ) 142bf215546Sopenharmony_ciendif 143bf215546Sopenharmony_ci 144bf215546Sopenharmony_cipowervr_mesa_icd = custom_target( 145bf215546Sopenharmony_ci 'powervr_mesa_icd', 146bf215546Sopenharmony_ci input : [vk_icd_gen, vk_api_xml], 147bf215546Sopenharmony_ci output : 'powervr_mesa_icd.@0@.json'.format(host_machine.cpu()), 148bf215546Sopenharmony_ci command : [ 149bf215546Sopenharmony_ci prog_python, '@INPUT0@', 150bf215546Sopenharmony_ci '--api-version', '1.0', '--xml', '@INPUT1@', 151bf215546Sopenharmony_ci '--lib-path', join_paths(get_option('prefix'), get_option('libdir'), 152bf215546Sopenharmony_ci 'libvulkan_powervr_mesa.so'), 153bf215546Sopenharmony_ci '--out', '@OUTPUT@', 154bf215546Sopenharmony_ci ], 155bf215546Sopenharmony_ci build_by_default : true, 156bf215546Sopenharmony_ci install_dir : with_vulkan_icd_dir, 157bf215546Sopenharmony_ci install : true, 158bf215546Sopenharmony_ci) 159bf215546Sopenharmony_ci 160bf215546Sopenharmony_ciif meson.version().version_compare('>= 0.58') 161bf215546Sopenharmony_ci _dev_icdname = 'powervr_mesa_devenv_icd.@0@.json'.format(host_machine.cpu()) 162bf215546Sopenharmony_ci custom_target( 163bf215546Sopenharmony_ci 'powervr_mesa_devenv_icd', 164bf215546Sopenharmony_ci input : [vk_icd_gen, vk_api_xml], 165bf215546Sopenharmony_ci output : _dev_icdname, 166bf215546Sopenharmony_ci command : [ 167bf215546Sopenharmony_ci prog_python, '@INPUT0@', 168bf215546Sopenharmony_ci '--api-version', '1.0', '--xml', '@INPUT1@', 169bf215546Sopenharmony_ci '--lib-path', meson.current_build_dir() / 'libvulkan_powervr_mesa.so', 170bf215546Sopenharmony_ci '--out', '@OUTPUT@', 171bf215546Sopenharmony_ci ], 172bf215546Sopenharmony_ci build_by_default : true, 173bf215546Sopenharmony_ci ) 174bf215546Sopenharmony_ci 175bf215546Sopenharmony_ci devenv.append('VK_ICD_FILENAMES', meson.current_build_dir() / _dev_icdname) 176bf215546Sopenharmony_ciendif 177