1# Copyright © 2017 Intel Corporation 2# SPDX-License-Identifier: MIT 3 4tu_entrypoints = custom_target( 5 'tu_entrypoints', 6 input : [vk_entrypoints_gen, vk_api_xml], 7 output : ['tu_entrypoints.h', 'tu_entrypoints.cc'], 8 command : [ 9 prog_python, '@INPUT0@', '--xml', '@INPUT1@', '--proto', '--weak', 10 '--out-h', '@OUTPUT0@', '--out-c', '@OUTPUT1@', '--prefix', 'tu', 11 '--include', 'adreno_common.xml.h', 12 '--tmpl-prefix', 'tu', '--tmpl-param', 'chip CHIP', 13 '--tmpl-variants', '<A6XX>', '<A7XX>', 14 '--beta', with_vulkan_beta.to_string(), 15 ], 16 depend_files : vk_entrypoints_gen_depend_files, 17) 18 19 20libtu_files = files( 21 'tu_autotune.cc', 22 'tu_clear_blit.cc', 23 'tu_cmd_buffer.cc', 24 'tu_cs_breadcrumbs.cc', 25 'tu_cs.cc', 26 'tu_device.cc', 27 'tu_descriptor_set.cc', 28 'tu_dynamic_rendering.cc', 29 'tu_formats.cc', 30 'tu_image.cc', 31 'tu_knl.cc', 32 'tu_lrz.cc', 33 'tu_nir_lower_multiview.cc', 34 'tu_pass.cc', 35 'tu_pipeline.cc', 36 'tu_query.cc', 37 'tu_shader.cc', 38 'tu_suballoc.cc', 39 'tu_util.cc', 40) 41 42libtu_includes = [ 43 inc_include, 44 inc_src, 45 inc_freedreno, 46] 47 48tu_link_with = [] 49tu_deps = [] 50tu_flags = [] 51 52tu_wsi = false 53 54if with_platform_x11 55 tu_deps += dep_xcb_dri3 56 tu_wsi = true 57endif 58 59if with_platform_wayland 60 tu_deps += dep_wayland_client 61 tu_wsi = true 62endif 63 64if system_has_kms_drm and not with_platform_android 65 tu_wsi = true 66endif 67 68if tu_wsi 69 libtu_files += 'tu_wsi.cc' 70endif 71 72if with_platform_android 73 libtu_files += files('tu_android.cc') 74 tu_deps += [dep_android] 75endif 76 77if with_xlib_lease 78 tu_deps += [dep_xlib_xrandr] 79endif 80 81if freedreno_kmds.contains('kgsl') 82 tu_flags += '-DTU_HAS_KGSL' 83 libtu_files += files('tu_knl_kgsl.cc') 84endif 85 86if freedreno_kmds.contains('msm') 87 tu_flags += '-DTU_HAS_MSM' 88 libtu_files += files('tu_knl_drm_msm.cc', 'tu_knl_drm.cc') 89 tu_deps += dep_libdrm 90endif 91 92if freedreno_kmds.contains('virtio') 93 tu_flags += '-DTU_HAS_VIRTIO' 94 libtu_files += files('tu_knl_drm_virtio.cc', 'tu_knl_drm.cc') 95 libtu_includes += [ 96 inc_virtio_gpu, 97 inc_virtio_vdrm, 98 ] 99 tu_link_with += libvdrm 100 tu_deps += dep_libdrm 101endif 102 103tu_tracepoints = custom_target( 104 'tu_tracepoints.[ch]', 105 input: 'tu_tracepoints.py', 106 output: ['tu_tracepoints.cc', 'tu_tracepoints.h', 'tu_tracepoints_perfetto.h'], 107 command: [ 108 prog_python, '@INPUT@', 109 '-p', join_paths(dir_source_root, 'src/util/perf/'), 110 '--utrace-src', '@OUTPUT0@', 111 '--utrace-hdr', '@OUTPUT1@', 112 '--perfetto-hdr', '@OUTPUT2@', 113 ], 114 depend_files: u_trace_py, 115) 116 117if with_perfetto 118 libtu_files += ['tu_perfetto.cc'] 119 tu_deps += dep_perfetto 120endif 121 122tu_cpp_args = [] 123tu_cpp_args += cpp.get_supported_arguments([ 124 '-fno-exceptions', 125 '-fno-rtti', 126 '-Wno-address-of-temporary', 127 '-Wno-array-bounds', 128 '-Wno-c99-designator', 129 '-Wno-class-memaccess', 130 '-Wno-missing-braces', 131 '-Wno-narrowing', 132 '-Wno-pointer-arith', 133 '-Wno-reorder-init-list', 134 '-Wno-sign-compare', 135 '-Wno-switch', 136 '-Wno-unused-function', 137 '-Wno-writable-strings', 138 '-Wno-write-strings', 139]) 140 141# HACK compiler.get_supported_arguments()/has_argument() do not seem 142# to be reliable for cross builds (!?!) so just jam in some args we 143# need and hope for the best 144if meson.is_cross_build() 145 tu_cpp_args += '-Wno-array-bounds' 146 tu_cpp_args += '-Wno-c++11-narrowing' 147 tu_cpp_args += '-Wno-missing-braces' 148 tu_cpp_args += '-Wno-unused-function' 149 tu_cpp_args += '-Wno-writable-strings' 150endif 151 152libvulkan_freedreno = shared_library( 153 'vulkan_freedreno', 154 [libtu_files, tu_entrypoints, tu_tracepoints, freedreno_xml_header_files, sha1_h, u_format_pack_h], 155 include_directories : libtu_includes, 156 link_with : [ 157 libfreedreno_ir3, 158 libfreedreno_layout, 159 libfreedreno_perfcntrs, 160 tu_link_with, 161 ], 162 dependencies : [ 163 idep_libfreedreno_common, 164 dep_dl, 165 dep_elf, 166 dep_m, 167 dep_thread, 168 dep_valgrind, 169 idep_nir, 170 tu_deps, 171 idep_vulkan_util, 172 idep_vulkan_runtime, 173 idep_vulkan_wsi, 174 idep_mesautil, 175 ], 176 c_args : [no_override_init_args, tu_flags], 177 cpp_args : [tu_cpp_args, tu_flags], 178 gnu_symbol_visibility : 'hidden', 179 link_args : [vulkan_icd_link_args, ld_args_bsymbolic, ld_args_gc_sections, ld_args_build_id], 180 link_depends : vulkan_icd_link_depends, 181 install : true, 182) 183 184if with_symbols_check 185 test( 186 'tu symbols check', 187 symbols_check, 188 args : [ 189 '--lib', libvulkan_freedreno, 190 '--symbols-file', vulkan_icd_symbols, 191 symbols_check_args, 192 ], 193 suite : ['freedreno'], 194 ) 195endif 196 197freedreno_icd = custom_target( 198 'freedreno_icd', 199 input : [vk_icd_gen, vk_api_xml], 200 output : 'freedreno_icd.@0@.json'.format(host_machine.cpu()), 201 command : [ 202 prog_python, '@INPUT0@', 203 '--api-version', '1.1', '--xml', '@INPUT1@', 204 '--lib-path', join_paths(get_option('prefix'), get_option('libdir'), 205 'libvulkan_freedreno.so'), 206 '--out', '@OUTPUT@', 207 ], 208 build_by_default : true, 209 install_dir : with_vulkan_icd_dir, 210 install_tag : 'runtime', 211 install : true, 212) 213 214_dev_icdname = 'freedreno_devenv_icd.@0@.json'.format(host_machine.cpu()) 215_dev_icd = custom_target( 216 'freedreno_devenv_icd', 217 input : [vk_icd_gen, vk_api_xml], 218 output : _dev_icdname, 219 command : [ 220 prog_python, '@INPUT0@', 221 '--api-version', '1.1', '--xml', '@INPUT1@', 222 '--lib-path', meson.current_build_dir() / 'libvulkan_freedreno.so', 223 '--out', '@OUTPUT@', 224 ], 225 build_by_default : true, 226) 227 228devenv.append('VK_ICD_FILENAMES', _dev_icd.full_path()) 229