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.c'],
8  command : [
9    prog_python, '@INPUT0@', '--xml', '@INPUT1@', '--proto', '--weak',
10    '--out-h', '@OUTPUT0@', '--out-c', '@OUTPUT1@', '--prefix', 'tu',
11  ],
12  depend_files : vk_entrypoints_gen_depend_files,
13)
14
15
16libtu_files = files(
17  'tu_autotune.c',
18  'tu_clear_blit.c',
19  'tu_cmd_buffer.c',
20  'tu_cs_breadcrumbs.c',
21  'tu_cs.c',
22  'tu_device.c',
23  'tu_descriptor_set.c',
24  'tu_dynamic_rendering.c',
25  'tu_formats.c',
26  'tu_image.c',
27  'tu_lrz.c',
28  'tu_nir_lower_multiview.c',
29  'tu_pass.c',
30  'tu_pipeline.c',
31  'tu_query.c',
32  'tu_shader.c',
33  'tu_suballoc.c',
34  'tu_util.c',
35)
36
37tu_deps = []
38tu_flags = []
39
40tu_wsi = false
41
42if with_platform_x11
43  tu_deps += dep_xcb_dri3
44  tu_wsi = true
45endif
46
47if with_platform_wayland
48  tu_deps += dep_wayland_client
49  tu_wsi = true
50endif
51
52if system_has_kms_drm and not with_platform_android
53  tu_wsi = true
54endif
55
56if tu_wsi
57  libtu_files += 'tu_wsi.c'
58endif
59
60if with_platform_android
61  libtu_files += files('tu_android.c')
62  tu_deps += [dep_android]
63endif
64
65if with_xlib_lease
66  tu_deps += [dep_xlib_xrandr]
67endif
68
69if with_freedreno_kgsl
70  tu_flags += '-DTU_USE_KGSL'
71  # Even if libdrm is available we shouldn't use it in KGSL build
72  tu_flags += '-UHAVE_LIBDRM'
73  libtu_files += files('tu_kgsl.c')
74else
75  libtu_files += files('tu_drm.c')
76  tu_deps += dep_libdrm
77endif
78
79tu_tracepoints = custom_target(
80  'tu_tracepoints.[ch]',
81  input: 'tu_tracepoints.py',
82  output: ['tu_tracepoints.c', 'tu_tracepoints.h', 'tu_tracepoints_perfetto.h'],
83  command: [
84    prog_python, '@INPUT@',
85    '-p', join_paths(meson.source_root(), 'src/util/perf/'),
86    '--utrace-src', '@OUTPUT0@',
87    '--utrace-hdr', '@OUTPUT1@',
88    '--perfetto-hdr', '@OUTPUT2@',
89  ],
90  depend_files: u_trace_py,
91)
92
93if with_perfetto
94  libtu_files += ['tu_perfetto.cc', 'tu_perfetto_util.c']
95  tu_deps += dep_perfetto
96endif
97
98libvulkan_freedreno = shared_library(
99  'vulkan_freedreno',
100  [libtu_files, tu_entrypoints, tu_tracepoints, freedreno_xml_header_files, sha1_h, u_format_pack_h],
101  include_directories : [
102    inc_include,
103    inc_src,
104    inc_mapi,
105    inc_mesa,
106    inc_gallium,
107    inc_gallium_aux,
108    inc_compiler,
109    inc_freedreno,
110  ],
111  link_with : [
112    libfreedreno_ir3,
113    libfreedreno_layout,
114    libfreedreno_perfcntrs,
115  ],
116  dependencies : [
117    idep_libfreedreno_common,
118    dep_dl,
119    dep_elf,
120    dep_m,
121    dep_thread,
122    dep_valgrind,
123    idep_nir,
124    tu_deps,
125    idep_vulkan_util,
126    idep_vulkan_runtime,
127    idep_vulkan_wsi,
128    idep_mesautil,
129  ],
130  c_args : [no_override_init_args, tu_flags],
131  gnu_symbol_visibility : 'hidden',
132  link_args : [ld_args_bsymbolic, ld_args_gc_sections, ld_args_build_id],
133  install : true,
134)
135
136if with_symbols_check
137  test(
138    'tu symbols check',
139    symbols_check,
140    args : [
141      '--lib', libvulkan_freedreno,
142      '--symbols-file', vulkan_icd_symbols,
143      symbols_check_args,
144    ],
145    suite : ['freedreno'],
146  )
147endif
148
149freedreno_icd = custom_target(
150  'freedreno_icd',
151  input : [vk_icd_gen, vk_api_xml],
152  output : 'freedreno_icd.@0@.json'.format(host_machine.cpu()),
153  command : [
154    prog_python, '@INPUT0@',
155    '--api-version', '1.1', '--xml', '@INPUT1@',
156    '--lib-path', join_paths(get_option('prefix'), get_option('libdir'),
157                             'libvulkan_freedreno.so'),
158    '--out', '@OUTPUT@',
159  ],
160  build_by_default : true,
161  install_dir : with_vulkan_icd_dir,
162  install : true,
163)
164
165if meson.version().version_compare('>= 0.58')
166  _dev_icdname = 'freedreno_devenv_icd.@0@.json'.format(host_machine.cpu())
167  custom_target(
168    'freedreno_devenv_icd',
169    input : [vk_icd_gen, vk_api_xml],
170    output : _dev_icdname,
171    command : [
172      prog_python, '@INPUT0@',
173      '--api-version', '1.1', '--xml', '@INPUT1@',
174      '--lib-path', meson.current_build_dir() / 'libvulkan_freedreno.so',
175      '--out', '@OUTPUT@',
176    ],
177    build_by_default : true,
178  )
179
180  devenv.append('VK_ICD_FILENAMES', meson.current_build_dir() / _dev_icdname)
181endif
182