1361fc4cbSmaya# Copyright © 2017 Intel Corporation
2361fc4cbSmaya
3361fc4cbSmaya# Permission is hereby granted, free of charge, to any person obtaining a copy
4361fc4cbSmaya# of this software and associated documentation files (the "Software"), to deal
5361fc4cbSmaya# in the Software without restriction, including without limitation the rights
6361fc4cbSmaya# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7361fc4cbSmaya# copies of the Software, and to permit persons to whom the Software is
8361fc4cbSmaya# furnished to do so, subject to the following conditions:
9361fc4cbSmaya
10361fc4cbSmaya# The above copyright notice and this permission notice shall be included in
11361fc4cbSmaya# all copies or substantial portions of the Software.
12361fc4cbSmaya
13361fc4cbSmaya# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14361fc4cbSmaya# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15361fc4cbSmaya# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16361fc4cbSmaya# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17361fc4cbSmaya# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18361fc4cbSmaya# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19361fc4cbSmaya# SOFTWARE.
20361fc4cbSmaya
21361fc4cbSmayatu_entrypoints = custom_target(
227ec681f3Smrg  'tu_entrypoints',
237ec681f3Smrg  input : [vk_entrypoints_gen, vk_api_xml],
24361fc4cbSmaya  output : ['tu_entrypoints.h', 'tu_entrypoints.c'],
25361fc4cbSmaya  command : [
267ec681f3Smrg    prog_python, '@INPUT0@', '--xml', '@INPUT1@', '--proto', '--weak',
277ec681f3Smrg    '--out-h', '@OUTPUT0@', '--out-c', '@OUTPUT1@', '--prefix', 'tu',
28361fc4cbSmaya  ],
297ec681f3Smrg  depend_files : vk_entrypoints_gen_depend_files,
30361fc4cbSmaya)
31361fc4cbSmaya
32361fc4cbSmaya
33361fc4cbSmayalibtu_files = files(
347ec681f3Smrg  'tu_clear_blit.c',
35361fc4cbSmaya  'tu_cmd_buffer.c',
36361fc4cbSmaya  'tu_cs.c',
377ec681f3Smrg  'tu_cs.h',
38361fc4cbSmaya  'tu_device.c',
39361fc4cbSmaya  'tu_descriptor_set.c',
40361fc4cbSmaya  'tu_descriptor_set.h',
41361fc4cbSmaya  'tu_formats.c',
42361fc4cbSmaya  'tu_image.c',
437ec681f3Smrg  'tu_legacy.c',
447ec681f3Smrg  'tu_nir_lower_multiview.c',
45361fc4cbSmaya  'tu_pass.c',
46361fc4cbSmaya  'tu_pipeline.c',
47361fc4cbSmaya  'tu_pipeline_cache.c',
48361fc4cbSmaya  'tu_private.h',
49361fc4cbSmaya  'tu_query.c',
50361fc4cbSmaya  'tu_shader.c',
51361fc4cbSmaya  'tu_util.c',
52361fc4cbSmaya  'tu_util.h',
537ec681f3Smrg  'tu_perfetto.h',
54361fc4cbSmaya  'vk_format.h',
55361fc4cbSmaya)
56361fc4cbSmaya
57361fc4cbSmayatu_deps = []
58361fc4cbSmayatu_flags = []
59361fc4cbSmaya
607ec681f3Smrgtu_wsi = false
617ec681f3Smrg
627ec681f3Smrgif with_platform_x11
637ec681f3Smrg  tu_deps += dep_xcb_dri3
647ec681f3Smrg  tu_wsi = true
657ec681f3Smrgendif
667ec681f3Smrg
67361fc4cbSmayaif with_platform_wayland
68361fc4cbSmaya  tu_deps += dep_wayland_client
697ec681f3Smrg  tu_wsi = true
707ec681f3Smrgendif
717ec681f3Smrg
727ec681f3Smrgif system_has_kms_drm and not with_platform_android
737ec681f3Smrg  libtu_files += files('tu_wsi_display.c')
747ec681f3Smrg  tu_wsi = true
757ec681f3Smrgendif
767ec681f3Smrg
777ec681f3Smrgif tu_wsi
787ec681f3Smrg  libtu_files += 'tu_wsi.c'
797ec681f3Smrgendif
807ec681f3Smrg
817ec681f3Smrgif with_platform_android
827ec681f3Smrg  libtu_files += files('tu_android.c')
837ec681f3Smrg  tu_deps += [dep_android]
847ec681f3Smrgendif
857ec681f3Smrg
867ec681f3Smrgif with_xlib_lease
877ec681f3Smrg  tu_deps += [dep_xlib_xrandr]
887ec681f3Smrgendif
897ec681f3Smrg
907ec681f3Smrgif with_freedreno_kgsl
917ec681f3Smrg  tu_flags += '-DTU_USE_KGSL'
927ec681f3Smrg  libtu_files += files('tu_kgsl.c')
937ec681f3Smrgelse
947ec681f3Smrg  libtu_files += files('tu_drm.c')
957ec681f3Smrg  tu_deps += dep_libdrm
967ec681f3Smrgendif
977ec681f3Smrg
987ec681f3Smrgtu_tracepoints = custom_target(
997ec681f3Smrg  'tu_tracepoints.[ch]',
1007ec681f3Smrg  input: 'tu_tracepoints.py',
1017ec681f3Smrg  output: ['tu_tracepoints.c', 'tu_tracepoints.h', 'tu_tracepoints_perfetto.h'],
1027ec681f3Smrg  command: [
1037ec681f3Smrg    prog_python, '@INPUT@',
1047ec681f3Smrg    '-p', join_paths(meson.source_root(), 'src/util/perf/'),
1057ec681f3Smrg    '--utrace-src', '@OUTPUT0@',
1067ec681f3Smrg    '--utrace-hdr', '@OUTPUT1@',
1077ec681f3Smrg    '--perfetto-hdr', '@OUTPUT2@',
1087ec681f3Smrg  ],
1097ec681f3Smrg  depend_files: u_trace_py,
1107ec681f3Smrg)
1117ec681f3Smrg
1127ec681f3Smrgif with_perfetto
1137ec681f3Smrg  libtu_files += ['tu_perfetto.cc', 'tu_perfetto_util.c']
1147ec681f3Smrg  tu_deps += dep_perfetto
115361fc4cbSmayaendif
116361fc4cbSmaya
117361fc4cbSmayalibvulkan_freedreno = shared_library(
118361fc4cbSmaya  'vulkan_freedreno',
1197ec681f3Smrg  [libtu_files, tu_entrypoints, tu_tracepoints, freedreno_xml_header_files, sha1_h],
120361fc4cbSmaya  include_directories : [
1217ec681f3Smrg    inc_include,
1227ec681f3Smrg    inc_src,
1237ec681f3Smrg    inc_mapi,
1247ec681f3Smrg    inc_mesa,
1257ec681f3Smrg    inc_gallium,
1267ec681f3Smrg    inc_gallium_aux,
127361fc4cbSmaya    inc_compiler,
128361fc4cbSmaya    inc_freedreno,
129361fc4cbSmaya  ],
130361fc4cbSmaya  link_with : [
131361fc4cbSmaya    libfreedreno_ir3,
1327ec681f3Smrg    libfreedreno_layout,
1337ec681f3Smrg    libfreedreno_perfcntrs,
134361fc4cbSmaya  ],
135361fc4cbSmaya  dependencies : [
1367ec681f3Smrg    idep_libfreedreno_common,
137361fc4cbSmaya    dep_dl,
138361fc4cbSmaya    dep_elf,
139361fc4cbSmaya    dep_m,
140361fc4cbSmaya    dep_thread,
141361fc4cbSmaya    dep_valgrind,
142361fc4cbSmaya    idep_nir,
143361fc4cbSmaya    tu_deps,
144361fc4cbSmaya    idep_vulkan_util,
1457ec681f3Smrg    idep_vulkan_wsi,
1467ec681f3Smrg    idep_mesautil,
147361fc4cbSmaya  ],
1487ec681f3Smrg  c_args : [no_override_init_args, tu_flags],
1497ec681f3Smrg  gnu_symbol_visibility : 'hidden',
1507ec681f3Smrg  link_args : [ld_args_bsymbolic, ld_args_gc_sections, ld_args_build_id],
151361fc4cbSmaya  install : true,
152361fc4cbSmaya)
153361fc4cbSmaya
1547ec681f3Smrgif with_symbols_check
1557ec681f3Smrg  test(
1567ec681f3Smrg    'tu symbols check',
1577ec681f3Smrg    symbols_check,
1587ec681f3Smrg    args : [
1597ec681f3Smrg      '--lib', libvulkan_freedreno,
1607ec681f3Smrg      '--symbols-file', vulkan_icd_symbols,
1617ec681f3Smrg      symbols_check_args,
1627ec681f3Smrg    ],
1637ec681f3Smrg    suite : ['freedreno'],
1647ec681f3Smrg  )
1657ec681f3Smrgendif
1667ec681f3Smrg
167361fc4cbSmayafreedreno_icd = custom_target(
168361fc4cbSmaya  'freedreno_icd',
1697ec681f3Smrg  input : [vk_icd_gen, vk_api_xml],
170361fc4cbSmaya  output : 'freedreno_icd.@0@.json'.format(host_machine.cpu()),
171361fc4cbSmaya  command : [
1727ec681f3Smrg    prog_python, '@INPUT0@',
1737ec681f3Smrg    '--api-version', '1.1', '--xml', '@INPUT1@',
1747ec681f3Smrg    '--lib-path', join_paths(get_option('prefix'), get_option('libdir'),
1757ec681f3Smrg                             'libvulkan_freedreno.so'),
176361fc4cbSmaya    '--out', '@OUTPUT@',
177361fc4cbSmaya  ],
178361fc4cbSmaya  build_by_default : true,
179361fc4cbSmaya  install_dir : with_vulkan_icd_dir,
180361fc4cbSmaya  install : true,
181361fc4cbSmaya)
182