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