• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright © 2021 Collabora Ltd.
2#
3# Derived from the freedreno driver which is:
4# Copyright © 2017 Intel Corporation
5
6# Permission is hereby granted, free of charge, to any person obtaining a copy
7# of this software and associated documentation files (the "Software"), to deal
8# in the Software without restriction, including without limitation the rights
9# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10# copies of the Software, and to permit persons to whom the Software is
11# furnished to do so, subject to the following conditions:
12
13# The above copyright notice and this permission notice shall be included in
14# all copies or substantial portions of the Software.
15
16# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22# SOFTWARE.
23
24panvk_entrypoints = custom_target(
25  'panvk_entrypoints.[ch]',
26  input : [vk_entrypoints_gen, vk_api_xml],
27  output : ['panvk_entrypoints.h', 'panvk_entrypoints.c'],
28  command : [
29    prog_python, '@INPUT0@', '--xml', '@INPUT1@', '--proto', '--weak',
30    '--out-h', '@OUTPUT0@', '--out-c', '@OUTPUT1@', '--prefix', 'panvk',
31    '--device-prefix', 'panvk_v6', '--device-prefix', 'panvk_v7',
32  ],
33  depend_files : vk_entrypoints_gen_depend_files,
34)
35
36libpanvk_files = files(
37  'panvk_cmd_buffer.c',
38  'panvk_cs.c',
39  'panvk_device.c',
40  'panvk_descriptor_set.c',
41  'panvk_formats.c',
42  'panvk_image.c',
43  'panvk_mempool.c',
44  'panvk_pass.c',
45  'panvk_pipeline.c',
46  'panvk_pipeline_cache.c',
47  'panvk_private.h',
48  'panvk_query.c',
49  'panvk_shader.c',
50  'panvk_util.c',
51  'panvk_wsi.c',
52) + [vk_cmd_enqueue_entrypoints[0], vk_common_entrypoints[0]]
53
54panvk_deps = []
55panvk_flags = []
56panvk_per_arch_libs = []
57
58foreach arch : ['6', '7']
59  panvk_per_arch_libs += static_library(
60    'panvk_v@0@'.format(arch),
61    [
62      panvk_entrypoints[0],
63      'panvk_vX_cmd_buffer.c',
64      'panvk_vX_cs.c',
65      'panvk_vX_descriptor_set.c',
66      'panvk_vX_device.c',
67      'panvk_vX_image.c',
68      'panvk_vX_meta.c',
69      'panvk_vX_meta_blit.c',
70      'panvk_vX_meta_copy.c',
71      'panvk_vX_meta_clear.c',
72      'panvk_vX_nir_lower_descriptors.c',
73      'panvk_vX_pipeline.c',
74      'panvk_vX_shader.c',
75    ],
76    include_directories : [
77      inc_include,
78      inc_src,
79      inc_compiler,
80      inc_gallium, # XXX: pipe/p_format.h
81      inc_gallium_aux, # XXX: renderonly
82      inc_panfrost,
83    ],
84    dependencies : [
85      idep_nir_headers,
86      idep_pan_packers,
87      idep_vulkan_util_headers,
88      idep_vulkan_runtime_headers,
89      idep_vulkan_wsi_headers,
90      dep_libdrm,
91      dep_valgrind,
92    ],
93    c_args : [no_override_init_args, panvk_flags, '-DPAN_ARCH=@0@'.format(arch)],
94  )
95endforeach
96
97if with_platform_wayland
98  panvk_deps += [dep_wayland_client, dep_wl_protocols]
99  libpanvk_files += [wayland_drm_client_protocol_h, wayland_drm_protocol_c]
100endif
101
102libvulkan_panfrost = shared_library(
103  'vulkan_panfrost',
104  [libpanvk_files, panvk_entrypoints],
105  include_directories : [
106    inc_include,
107    inc_src,
108    inc_compiler,
109    inc_gallium, # XXX: pipe/p_format.h
110    inc_gallium_aux, # XXX: renderonly
111    inc_panfrost,
112  ],
113  link_whole : [panvk_per_arch_libs],
114  link_with : [
115    libpanfrost_shared,
116    libpanfrost_midgard,
117    libpanfrost_bifrost,
118    libpanfrost_decode,
119    libpanfrost_lib,
120    libpanfrost_util,
121  ],
122  dependencies : [
123    dep_dl,
124    dep_elf,
125    dep_libdrm,
126    dep_m,
127    dep_thread,
128    dep_valgrind,
129    idep_nir,
130    idep_pan_packers,
131    panvk_deps,
132    idep_vulkan_util,
133    idep_vulkan_runtime,
134    idep_vulkan_wsi,
135    idep_mesautil,
136  ],
137  c_args : [no_override_init_args, panvk_flags],
138  link_args : [ld_args_bsymbolic, ld_args_gc_sections],
139  install : true,
140)
141
142panfrost_icd = custom_target(
143  'panfrost_icd',
144  input : [vk_icd_gen, vk_api_xml],
145  output : 'panfrost_icd.@0@.json'.format(host_machine.cpu()),
146  command : [
147    prog_python, '@INPUT0@',
148    '--api-version', '1.1', '--xml', '@INPUT1@',
149    '--lib-path', join_paths(get_option('prefix'), get_option('libdir'),
150                             'libvulkan_panfrost.so'),
151    '--out', '@OUTPUT@',
152  ],
153  build_by_default : true,
154  install_dir : with_vulkan_icd_dir,
155  install : true,
156)
157
158if meson.version().version_compare('>= 0.58')
159  _dev_icdname = 'panfrost_devenv_icd.@0@.json'.format(host_machine.cpu())
160  custom_target(
161    'panfrost_devenv_icd',
162    input : [vk_icd_gen, vk_api_xml],
163    output : _dev_icdname,
164    command : [
165      prog_python, '@INPUT0@',
166      '--api-version', '1.1', '--xml', '@INPUT1@',
167      '--lib-path', meson.current_build_dir() / 'libvulkan_panfrost.so',
168      '--out', '@OUTPUT@',
169    ],
170    build_by_default : true,
171  )
172
173  devenv.append('VK_ICD_FILENAMES', meson.current_build_dir() / _dev_icdname)
174endif
175