summaryrefslogtreecommitdiff
path: root/src/panfrost/vulkan/meson.build
blob: f747648538b8efdb6a9f59856b4b5508b8c3a52a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
# Copyright © 2021 Collabora Ltd.
#
# Derived from the freedreno driver which is:
# Copyright © 2017 Intel Corporation
# SPDX-License-Identifier: MIT

panvk_entrypoints = custom_target(
  'panvk_entrypoints.[ch]',
  input : [vk_entrypoints_gen, vk_api_xml],
  output : ['panvk_entrypoints.h', 'panvk_entrypoints.c'],
  command : [
    prog_python, '@INPUT0@', '--xml', '@INPUT1@', '--proto', '--weak',
    '--out-h', '@OUTPUT0@', '--out-c', '@OUTPUT1@', '--prefix', 'panvk',
    '--device-prefix', 'panvk_v6', '--device-prefix', 'panvk_v7',
    '--device-prefix', 'panvk_v9', '--device-prefix', 'panvk_v10',
    '--beta', with_vulkan_beta.to_string()
  ],
  depend_files : vk_entrypoints_gen_depend_files,
)

libpanvk_files = files(
  'panvk_buffer.c',
  'panvk_cmd_pool.c',
  'panvk_device_memory.c',
  'panvk_event.c',
  'panvk_image.c',
  'panvk_instance.c',
  'panvk_mempool.c',
  'panvk_physical_device.c',
  'panvk_priv_bo.c',
  'panvk_query.c',
  'panvk_wsi.c',
)
libpanvk_files += [sha1_h]

panvk_deps = []
panvk_flags = []
panvk_per_arch_libs = []

bifrost_archs = [6, 7]
bifrost_inc_dir = ['bifrost']
bifrost_files = [
  'bifrost/panvk_vX_cmd_desc_state.c',
  'bifrost/panvk_vX_meta_desc_copy.c',
  'bifrost/panvk_vX_nir_lower_descriptors.c',
]

valhall_archs = [9, 10]
valhall_inc_dir = ['valhall']
valhall_files = []

jm_archs = [6, 7]
jm_inc_dir = ['jm']
jm_files = [
  'jm/panvk_vX_cmd_buffer.c',
  'jm/panvk_vX_cmd_dispatch.c',
  'jm/panvk_vX_cmd_draw.c',
  'jm/panvk_vX_cmd_event.c',
  'jm/panvk_vX_meta.c',
  'jm/panvk_vX_meta_blit.c',
  'jm/panvk_vX_meta_clear.c',
  'jm/panvk_vX_meta_copy.c',
  'jm/panvk_vX_queue.c',
]

common_per_arch_files = [
  panvk_entrypoints[0],
  'panvk_vX_blend.c',
  'panvk_vX_buffer_view.c',
  'panvk_vX_descriptor_set.c',
  'panvk_vX_descriptor_set_layout.c',
  'panvk_vX_device.c',
  'panvk_vX_image_view.c',
  'panvk_vX_sampler.c',
  'panvk_vX_shader.c',
]

foreach arch : [6, 7, 9, 10]
  if arch in valhall_archs
    # We're lacking key components to compile common source files for v9/v10.
    # Just add the v9/v10 entrypoints for now.
    per_arch_files = [
      panvk_entrypoints[0],
      'panvk_vX_descriptor_set.c',
      'panvk_vX_descriptor_set_layout.c',
    ]
  else
    per_arch_files = common_per_arch_files
  endif

  inc_panvk_per_arch = []

  if arch in bifrost_archs
    inc_panvk_per_arch += bifrost_inc_dir
    per_arch_files += bifrost_files
  elif arch in valhall_archs
    inc_panvk_per_arch += valhall_inc_dir
    per_arch_files += valhall_files
  endif

  if arch in jm_archs
    inc_panvk_per_arch += jm_inc_dir
    per_arch_files += jm_files
  endif

  panvk_per_arch_libs += static_library(
    'panvk_v@0@'.format(arch),
    per_arch_files,
    include_directories : [
      inc_include,
      inc_src,
      inc_panfrost,
      inc_panvk_per_arch,
    ],
    dependencies : [
      idep_nir_headers,
      idep_pan_packers,
      idep_vulkan_util_headers,
      idep_vulkan_runtime_headers,
      idep_vulkan_wsi_headers,
      idep_mesautil,
      dep_libdrm,
      dep_valgrind,
    ],
    c_args : [no_override_init_args, panvk_flags, '-DPAN_ARCH=@0@'.format(arch)],
  )
endforeach

if with_platform_wayland
  panvk_deps += dep_wayland_client
  libpanvk_files += [wayland_drm_client_protocol_h, wayland_drm_protocol_c]
endif

if with_platform_android
  panvk_deps += [dep_android]
  panvk_flags += '-DVK_USE_PLATFORM_ANDROID_KHR'
  libpanvk_files += files('panvk_android.c')
endif

libvulkan_panfrost = shared_library(
  'vulkan_panfrost',
  [libpanvk_files, panvk_entrypoints],
  include_directories : [
    inc_include,
    inc_src,
    inc_panfrost,
  ],
  link_whole : [panvk_per_arch_libs],
  link_with : [
    libpanfrost_shared,
    libpanfrost_midgard,
    libpanfrost_bifrost,
    libpanfrost_decode,
    libpanfrost_lib,
    libpanfrost_util,
  ],
  dependencies : [
    dep_dl,
    dep_elf,
    dep_libdrm,
    dep_m,
    dep_thread,
    dep_valgrind,
    idep_nir,
    idep_pan_packers,
    panvk_deps,
    idep_vulkan_util,
    idep_vulkan_runtime,
    idep_vulkan_wsi,
    idep_mesautil,
  ],
  c_args : [no_override_init_args, panvk_flags],
  link_args : [ld_args_bsymbolic, ld_args_gc_sections],
  install : true,
)

panfrost_icd = custom_target(
  'panfrost_icd',
  input : [vk_icd_gen, vk_api_xml],
  output : 'panfrost_icd.@0@.json'.format(host_machine.cpu()),
  command : [
    prog_python, '@INPUT0@',
    '--api-version', '1.0', '--xml', '@INPUT1@',
    '--lib-path', join_paths(get_option('prefix'), get_option('libdir'),
                             'libvulkan_panfrost.so'),
    '--out', '@OUTPUT@',
  ],
  build_by_default : true,
  install_dir : with_vulkan_icd_dir,
  install_tag : 'runtime',
  install : true,
)

_dev_icdname = 'panfrost_devenv_icd.@0@.json'.format(host_machine.cpu())
_dev_icd = custom_target(
  'panfrost_devenv_icd',
  input : [vk_icd_gen, vk_api_xml],
  output : _dev_icdname,
  command : [
    prog_python, '@INPUT0@',
    '--api-version', '1.0', '--xml', '@INPUT1@',
    '--lib-path', meson.current_build_dir() / 'libvulkan_panfrost.so',
    '--out', '@OUTPUT@',
  ],
  build_by_default : true,
)

devenv.append('VK_DRIVER_FILES', _dev_icd.full_path())
# Deprecated: replaced by VK_DRIVER_FILES above
devenv.append('VK_ICD_FILENAMES', _dev_icd.full_path())