1 |
commit: 417c6adf5fd72af2160f0b2c251bacb58f0307a4 |
2 |
Author: Matt Turner <mattst88 <AT> gentoo <DOT> org> |
3 |
AuthorDate: Wed Sep 22 21:15:28 2021 +0000 |
4 |
Commit: Matt Turner <mattst88 <AT> gentoo <DOT> org> |
5 |
CommitDate: Wed Sep 22 21:22:30 2021 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=417c6adf |
7 |
|
8 |
media-libs/mesa: Add patch to prevent fossil_db problems |
9 |
|
10 |
Signed-off-by: Matt Turner <mattst88 <AT> gentoo.org> |
11 |
|
12 |
...ize_db-Don-t-corrupt-keys-during-entry-re.patch | 46 ++ |
13 |
media-libs/mesa/mesa-21.1.8-r1.ebuild | 560 +++++++++++++++++++++ |
14 |
2 files changed, 606 insertions(+) |
15 |
|
16 |
diff --git a/media-libs/mesa/files/21.1.8-util-fossilize_db-Don-t-corrupt-keys-during-entry-re.patch b/media-libs/mesa/files/21.1.8-util-fossilize_db-Don-t-corrupt-keys-during-entry-re.patch |
17 |
new file mode 100644 |
18 |
index 00000000000..ebbb8abb1fe |
19 |
--- /dev/null |
20 |
+++ b/media-libs/mesa/files/21.1.8-util-fossilize_db-Don-t-corrupt-keys-during-entry-re.patch |
21 |
@@ -0,0 +1,46 @@ |
22 |
+From 8de60a1654a875d0b55512a1508f541f706f9b97 Mon Sep 17 00:00:00 2001 |
23 |
+From: Bas Nieuwenhuizen <bas@××××××××××××××××.nl> |
24 |
+Date: Sat, 4 Sep 2021 03:32:21 +0200 |
25 |
+Subject: [PATCH] util/fossilize_db: Don't corrupt keys during entry read. |
26 |
+ |
27 |
+We change the hash that is still used to set entry->key. |
28 |
+ |
29 |
+Fixes: d2d642cc014 "util/fossilize_db: Only allocate entries after full read." |
30 |
+Reviewed-by: Timothy Arceri <tarceri@×××××××××.com> |
31 |
+Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12725> |
32 |
+--- |
33 |
+ src/util/fossilize_db.c | 12 ++++++------ |
34 |
+ 1 file changed, 6 insertions(+), 6 deletions(-) |
35 |
+ |
36 |
+diff --git a/src/util/fossilize_db.c b/src/util/fossilize_db.c |
37 |
+index e1709a1ff64..26024101b83 100644 |
38 |
+--- a/src/util/fossilize_db.c |
39 |
++++ b/src/util/fossilize_db.c |
40 |
+@@ -156,18 +156,18 @@ update_foz_index(struct foz_db *foz_db, FILE *db_idx, unsigned file_idx) |
41 |
+ offset += header->payload_size; |
42 |
+ parsed_offset = offset; |
43 |
+ |
44 |
+- /* Truncate the entry's hash string to a 64bit hash for use with a |
45 |
+- * 64bit hash table for looking up file offsets. |
46 |
+- */ |
47 |
+- hash_str[16] = '\0'; |
48 |
+- uint64_t key = strtoull(hash_str, NULL, 16); |
49 |
+- |
50 |
+ struct foz_db_entry *entry = ralloc(foz_db->mem_ctx, |
51 |
+ struct foz_db_entry); |
52 |
+ entry->header = *header; |
53 |
+ entry->file_idx = file_idx; |
54 |
+ _mesa_sha1_hex_to_sha1(entry->key, hash_str); |
55 |
+ |
56 |
++ /* Truncate the entry's hash string to a 64bit hash for use with a |
57 |
++ * 64bit hash table for looking up file offsets. |
58 |
++ */ |
59 |
++ hash_str[16] = '\0'; |
60 |
++ uint64_t key = strtoull(hash_str, NULL, 16); |
61 |
++ |
62 |
+ entry->offset = cache_offset; |
63 |
+ |
64 |
+ _mesa_hash_table_u64_insert(foz_db->index_db, key, entry); |
65 |
+-- |
66 |
+2.32.0 |
67 |
+ |
68 |
|
69 |
diff --git a/media-libs/mesa/mesa-21.1.8-r1.ebuild b/media-libs/mesa/mesa-21.1.8-r1.ebuild |
70 |
new file mode 100644 |
71 |
index 00000000000..482b96c702a |
72 |
--- /dev/null |
73 |
+++ b/media-libs/mesa/mesa-21.1.8-r1.ebuild |
74 |
@@ -0,0 +1,560 @@ |
75 |
+# Copyright 1999-2021 Gentoo Authors |
76 |
+# Distributed under the terms of the GNU General Public License v2 |
77 |
+ |
78 |
+EAPI=7 |
79 |
+ |
80 |
+PYTHON_COMPAT=( python3_{7,8,9} ) |
81 |
+ |
82 |
+inherit llvm meson-multilib python-any-r1 linux-info |
83 |
+ |
84 |
+OPENGL_DIR="xorg-x11" |
85 |
+ |
86 |
+MY_P="${P/_/-}" |
87 |
+ |
88 |
+DESCRIPTION="OpenGL-like graphic library for Linux" |
89 |
+HOMEPAGE="https://www.mesa3d.org/ https://mesa.freedesktop.org/" |
90 |
+ |
91 |
+if [[ ${PV} == 9999 ]]; then |
92 |
+ EGIT_REPO_URI="https://gitlab.freedesktop.org/mesa/mesa.git" |
93 |
+ inherit git-r3 |
94 |
+else |
95 |
+ SRC_URI="https://archive.mesa3d.org/${MY_P}.tar.xz" |
96 |
+ KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~amd64-linux ~x86-linux ~sparc-solaris ~x64-solaris ~x86-solaris" |
97 |
+fi |
98 |
+ |
99 |
+LICENSE="MIT" |
100 |
+SLOT="0" |
101 |
+RESTRICT=" |
102 |
+ !test? ( test ) |
103 |
+" |
104 |
+ |
105 |
+RADEON_CARDS="r100 r200 r300 r600 radeon radeonsi" |
106 |
+VIDEO_CARDS="${RADEON_CARDS} freedreno i915 i965 intel iris lima nouveau panfrost v3d vc4 virgl vivante vmware" |
107 |
+for card in ${VIDEO_CARDS}; do |
108 |
+ IUSE_VIDEO_CARDS+=" video_cards_${card}" |
109 |
+done |
110 |
+ |
111 |
+IUSE="${IUSE_VIDEO_CARDS} |
112 |
+ +classic d3d9 debug +dri3 +egl +gallium +gbm gles1 +gles2 +llvm |
113 |
+ lm-sensors opencl osmesa selinux test unwind vaapi valgrind vdpau vulkan |
114 |
+ vulkan-overlay wayland +X xa xvmc zink +zstd" |
115 |
+ |
116 |
+REQUIRED_USE=" |
117 |
+ d3d9? ( dri3 || ( video_cards_iris video_cards_r300 video_cards_r600 video_cards_radeonsi video_cards_nouveau video_cards_vmware ) ) |
118 |
+ gles1? ( egl ) |
119 |
+ gles2? ( egl ) |
120 |
+ osmesa? ( gallium ) |
121 |
+ vulkan? ( dri3 |
122 |
+ video_cards_radeonsi? ( llvm ) ) |
123 |
+ vulkan-overlay? ( vulkan ) |
124 |
+ wayland? ( egl gbm ) |
125 |
+ video_cards_freedreno? ( gallium ) |
126 |
+ video_cards_intel? ( classic ) |
127 |
+ video_cards_i915? ( || ( classic gallium ) ) |
128 |
+ video_cards_i965? ( classic ) |
129 |
+ video_cards_iris? ( gallium ) |
130 |
+ video_cards_lima? ( gallium ) |
131 |
+ video_cards_nouveau? ( || ( classic gallium ) ) |
132 |
+ video_cards_panfrost? ( gallium ) |
133 |
+ video_cards_radeon? ( || ( classic gallium ) |
134 |
+ gallium? ( x86? ( llvm ) amd64? ( llvm ) ) ) |
135 |
+ video_cards_r100? ( classic ) |
136 |
+ video_cards_r200? ( classic ) |
137 |
+ video_cards_r300? ( gallium x86? ( llvm ) amd64? ( llvm ) ) |
138 |
+ video_cards_r600? ( gallium ) |
139 |
+ video_cards_radeonsi? ( gallium llvm ) |
140 |
+ video_cards_v3d? ( gallium ) |
141 |
+ video_cards_vc4? ( gallium ) |
142 |
+ video_cards_virgl? ( gallium ) |
143 |
+ video_cards_vivante? ( gallium gbm ) |
144 |
+ video_cards_vmware? ( gallium ) |
145 |
+ xa? ( X ) |
146 |
+ xvmc? ( X ) |
147 |
+ zink? ( gallium vulkan ) |
148 |
+" |
149 |
+ |
150 |
+LIBDRM_DEPSTRING=">=x11-libs/libdrm-2.4.105" |
151 |
+RDEPEND=" |
152 |
+ >=dev-libs/expat-2.1.0-r3:=[${MULTILIB_USEDEP}] |
153 |
+ >=media-libs/libglvnd-1.3.2[X?,${MULTILIB_USEDEP}] |
154 |
+ >=sys-libs/zlib-1.2.8[${MULTILIB_USEDEP}] |
155 |
+ gallium? ( |
156 |
+ unwind? ( sys-libs/libunwind[${MULTILIB_USEDEP}] ) |
157 |
+ llvm? ( |
158 |
+ video_cards_radeonsi? ( |
159 |
+ virtual/libelf:0=[${MULTILIB_USEDEP}] |
160 |
+ ) |
161 |
+ video_cards_r600? ( |
162 |
+ virtual/libelf:0=[${MULTILIB_USEDEP}] |
163 |
+ ) |
164 |
+ video_cards_radeon? ( |
165 |
+ virtual/libelf:0=[${MULTILIB_USEDEP}] |
166 |
+ ) |
167 |
+ ) |
168 |
+ lm-sensors? ( sys-apps/lm-sensors:=[${MULTILIB_USEDEP}] ) |
169 |
+ opencl? ( |
170 |
+ >=virtual/opencl-3[${MULTILIB_USEDEP}] |
171 |
+ dev-libs/libclc |
172 |
+ virtual/libelf:0=[${MULTILIB_USEDEP}] |
173 |
+ ) |
174 |
+ vaapi? ( |
175 |
+ >=x11-libs/libva-1.7.3:=[${MULTILIB_USEDEP}] |
176 |
+ ) |
177 |
+ vdpau? ( >=x11-libs/libvdpau-1.1:=[${MULTILIB_USEDEP}] ) |
178 |
+ xvmc? ( >=x11-libs/libXvMC-1.0.8:=[${MULTILIB_USEDEP}] ) |
179 |
+ ) |
180 |
+ selinux? ( sys-libs/libselinux[${MULTILIB_USEDEP}] ) |
181 |
+ wayland? ( |
182 |
+ >=dev-libs/wayland-1.18.0:=[${MULTILIB_USEDEP}] |
183 |
+ >=dev-libs/wayland-protocols-1.8 |
184 |
+ ) |
185 |
+ ${LIBDRM_DEPSTRING}[video_cards_freedreno?,video_cards_nouveau?,video_cards_vc4?,video_cards_vivante?,video_cards_vmware?,${MULTILIB_USEDEP}] |
186 |
+ video_cards_intel? ( |
187 |
+ !video_cards_i965? ( ${LIBDRM_DEPSTRING}[video_cards_intel] ) |
188 |
+ ) |
189 |
+ video_cards_i915? ( ${LIBDRM_DEPSTRING}[video_cards_intel] ) |
190 |
+ vulkan-overlay? ( dev-util/glslang:0=[${MULTILIB_USEDEP}] ) |
191 |
+ X? ( |
192 |
+ >=x11-libs/libX11-1.6.2:=[${MULTILIB_USEDEP}] |
193 |
+ >=x11-libs/libxshmfence-1.1:=[${MULTILIB_USEDEP}] |
194 |
+ >=x11-libs/libXext-1.3.2:=[${MULTILIB_USEDEP}] |
195 |
+ >=x11-libs/libXxf86vm-1.1.3:=[${MULTILIB_USEDEP}] |
196 |
+ >=x11-libs/libxcb-1.13:=[${MULTILIB_USEDEP}] |
197 |
+ x11-libs/libXfixes:=[${MULTILIB_USEDEP}] |
198 |
+ ) |
199 |
+ zink? ( media-libs/vulkan-loader:=[${MULTILIB_USEDEP}] ) |
200 |
+ zstd? ( app-arch/zstd:=[${MULTILIB_USEDEP}] ) |
201 |
+" |
202 |
+for card in ${RADEON_CARDS}; do |
203 |
+ RDEPEND="${RDEPEND} |
204 |
+ video_cards_${card}? ( ${LIBDRM_DEPSTRING}[video_cards_radeon] ) |
205 |
+ " |
206 |
+done |
207 |
+RDEPEND="${RDEPEND} |
208 |
+ video_cards_radeonsi? ( ${LIBDRM_DEPSTRING}[video_cards_amdgpu] ) |
209 |
+" |
210 |
+ |
211 |
+# Please keep the LLVM dependency block separate. Since LLVM is slotted, |
212 |
+# we need to *really* make sure we're not pulling one than more slot |
213 |
+# simultaneously. |
214 |
+# |
215 |
+# How to use it: |
216 |
+# 1. List all the working slots (with min versions) in ||, newest first. |
217 |
+# 2. Update the := to specify *max* version, e.g. < 10. |
218 |
+# 3. Specify LLVM_MAX_SLOT, e.g. 9. |
219 |
+LLVM_MAX_SLOT="12" |
220 |
+LLVM_DEPSTR=" |
221 |
+ || ( |
222 |
+ sys-devel/llvm:12[${MULTILIB_USEDEP}] |
223 |
+ sys-devel/llvm:11[${MULTILIB_USEDEP}] |
224 |
+ sys-devel/llvm:10[${MULTILIB_USEDEP}] |
225 |
+ ) |
226 |
+ <sys-devel/llvm-$((LLVM_MAX_SLOT + 1)):=[${MULTILIB_USEDEP}] |
227 |
+" |
228 |
+LLVM_DEPSTR_AMDGPU=${LLVM_DEPSTR//]/,llvm_targets_AMDGPU(-)]} |
229 |
+CLANG_DEPSTR=${LLVM_DEPSTR//llvm/clang} |
230 |
+CLANG_DEPSTR_AMDGPU=${CLANG_DEPSTR//]/,llvm_targets_AMDGPU(-)]} |
231 |
+RDEPEND="${RDEPEND} |
232 |
+ gallium? ( |
233 |
+ llvm? ( |
234 |
+ opencl? ( |
235 |
+ video_cards_r600? ( |
236 |
+ ${CLANG_DEPSTR_AMDGPU} |
237 |
+ ) |
238 |
+ !video_cards_r600? ( |
239 |
+ video_cards_radeonsi? ( |
240 |
+ ${CLANG_DEPSTR_AMDGPU} |
241 |
+ ) |
242 |
+ ) |
243 |
+ !video_cards_r600? ( |
244 |
+ !video_cards_radeonsi? ( |
245 |
+ video_cards_radeon? ( |
246 |
+ ${CLANG_DEPSTR_AMDGPU} |
247 |
+ ) |
248 |
+ ) |
249 |
+ ) |
250 |
+ !video_cards_r600? ( |
251 |
+ !video_cards_radeon? ( |
252 |
+ !video_cards_radeonsi? ( |
253 |
+ ${CLANG_DEPSTR} |
254 |
+ ) |
255 |
+ ) |
256 |
+ ) |
257 |
+ ) |
258 |
+ !opencl? ( |
259 |
+ video_cards_r600? ( |
260 |
+ ${LLVM_DEPSTR_AMDGPU} |
261 |
+ ) |
262 |
+ !video_cards_r600? ( |
263 |
+ video_cards_radeonsi? ( |
264 |
+ ${LLVM_DEPSTR_AMDGPU} |
265 |
+ ) |
266 |
+ ) |
267 |
+ !video_cards_r600? ( |
268 |
+ !video_cards_radeonsi? ( |
269 |
+ video_cards_radeon? ( |
270 |
+ ${LLVM_DEPSTR_AMDGPU} |
271 |
+ ) |
272 |
+ ) |
273 |
+ ) |
274 |
+ !video_cards_r600? ( |
275 |
+ !video_cards_radeon? ( |
276 |
+ !video_cards_radeonsi? ( |
277 |
+ ${LLVM_DEPSTR} |
278 |
+ ) |
279 |
+ ) |
280 |
+ ) |
281 |
+ ) |
282 |
+ ) |
283 |
+ ) |
284 |
+" |
285 |
+unset {LLVM,CLANG}_DEPSTR{,_AMDGPU} |
286 |
+ |
287 |
+DEPEND="${RDEPEND} |
288 |
+ valgrind? ( dev-util/valgrind ) |
289 |
+ X? ( |
290 |
+ x11-libs/libXrandr[${MULTILIB_USEDEP}] |
291 |
+ x11-base/xorg-proto |
292 |
+ ) |
293 |
+" |
294 |
+BDEPEND=" |
295 |
+ ${PYTHON_DEPS} |
296 |
+ opencl? ( |
297 |
+ >=sys-devel/gcc-4.6 |
298 |
+ ) |
299 |
+ sys-devel/bison |
300 |
+ sys-devel/flex |
301 |
+ virtual/pkgconfig |
302 |
+ $(python_gen_any_dep ">=dev-python/mako-0.8.0[\${PYTHON_USEDEP}]") |
303 |
+ wayland? ( dev-util/wayland-scanner[${MULTILIB_USEDEP}] ) |
304 |
+" |
305 |
+ |
306 |
+PATCHES=( |
307 |
+ "${FILESDIR}"/${PV}-util-fossilize_db-Don-t-corrupt-keys-during-entry-re.patch |
308 |
+) |
309 |
+ |
310 |
+S="${WORKDIR}/${MY_P}" |
311 |
+EGIT_CHECKOUT_DIR=${S} |
312 |
+ |
313 |
+QA_WX_LOAD=" |
314 |
+x86? ( |
315 |
+ usr/lib*/libglapi.so.0.0.0 |
316 |
+ usr/lib*/libGLESv1_CM.so.1.1.0 |
317 |
+ usr/lib*/libGLESv2.so.2.0.0 |
318 |
+ usr/lib*/libGL.so.1.2.0 |
319 |
+ usr/lib*/libOSMesa.so.8.0.0 |
320 |
+ usr/lib/libGLX_mesa.so.0.0.0 |
321 |
+)" |
322 |
+ |
323 |
+llvm_check_deps() { |
324 |
+ local flags=${MULTILIB_USEDEP} |
325 |
+ if use video_cards_r600 || use video_cards_radeon || use video_cards_radeonsi |
326 |
+ then |
327 |
+ flags+=",llvm_targets_AMDGPU(-)" |
328 |
+ fi |
329 |
+ |
330 |
+ if use opencl; then |
331 |
+ has_version "sys-devel/clang:${LLVM_SLOT}[${flags}]" || return 1 |
332 |
+ fi |
333 |
+ has_version "sys-devel/llvm:${LLVM_SLOT}[${flags}]" |
334 |
+} |
335 |
+ |
336 |
+pkg_pretend() { |
337 |
+ if use vulkan; then |
338 |
+ if ! use video_cards_i965 && |
339 |
+ ! use video_cards_iris && |
340 |
+ ! use video_cards_radeonsi && |
341 |
+ ! use video_cards_v3d; then |
342 |
+ ewarn "Ignoring USE=vulkan since VIDEO_CARDS does not contain i965, iris, radeonsi, or v3d" |
343 |
+ fi |
344 |
+ fi |
345 |
+ |
346 |
+ if use opencl; then |
347 |
+ if ! use video_cards_r600 && |
348 |
+ ! use video_cards_radeonsi; then |
349 |
+ ewarn "Ignoring USE=opencl since VIDEO_CARDS does not contain r600 or radeonsi" |
350 |
+ fi |
351 |
+ fi |
352 |
+ |
353 |
+ if use vaapi; then |
354 |
+ if ! use video_cards_r600 && |
355 |
+ ! use video_cards_radeonsi && |
356 |
+ ! use video_cards_nouveau; then |
357 |
+ ewarn "Ignoring USE=vaapi since VIDEO_CARDS does not contain r600, radeonsi, or nouveau" |
358 |
+ fi |
359 |
+ fi |
360 |
+ |
361 |
+ if use vdpau; then |
362 |
+ if ! use video_cards_r300 && |
363 |
+ ! use video_cards_r600 && |
364 |
+ ! use video_cards_radeonsi && |
365 |
+ ! use video_cards_nouveau; then |
366 |
+ ewarn "Ignoring USE=vdpau since VIDEO_CARDS does not contain r300, r600, radeonsi, or nouveau" |
367 |
+ fi |
368 |
+ fi |
369 |
+ |
370 |
+ if use xa; then |
371 |
+ if ! use video_cards_freedreno && |
372 |
+ ! use video_cards_nouveau && |
373 |
+ ! use video_cards_vmware; then |
374 |
+ ewarn "Ignoring USE=xa since VIDEO_CARDS does not contain freedreno, nouveau, or vmware" |
375 |
+ fi |
376 |
+ fi |
377 |
+ |
378 |
+ if use xvmc; then |
379 |
+ if ! use video_cards_r600 && |
380 |
+ ! use video_cards_nouveau; then |
381 |
+ ewarn "Ignoring USE=xvmc since VIDEO_CARDS does not contain r600 or nouveau" |
382 |
+ fi |
383 |
+ fi |
384 |
+ |
385 |
+ if ! use gallium; then |
386 |
+ use lm-sensors && ewarn "Ignoring USE=lm-sensors since USE does not contain gallium" |
387 |
+ use llvm && ewarn "Ignoring USE=llvm since USE does not contain gallium" |
388 |
+ use opencl && ewarn "Ignoring USE=opencl since USE does not contain gallium" |
389 |
+ use vaapi && ewarn "Ignoring USE=vaapi since USE does not contain gallium" |
390 |
+ use vdpau && ewarn "Ignoring USE=vdpau since USE does not contain gallium" |
391 |
+ use unwind && ewarn "Ignoring USE=unwind since USE does not contain gallium" |
392 |
+ use xa && ewarn "Ignoring USE=xa since USE does not contain gallium" |
393 |
+ use xvmc && ewarn "Ignoring USE=xvmc since USE does not contain gallium" |
394 |
+ fi |
395 |
+ |
396 |
+ if ! use llvm; then |
397 |
+ use opencl && ewarn "Ignoring USE=opencl since USE does not contain llvm" |
398 |
+ fi |
399 |
+ |
400 |
+ if use osmesa && ! use llvm; then |
401 |
+ ewarn "OSMesa will be slow without enabling USE=llvm" |
402 |
+ fi |
403 |
+} |
404 |
+ |
405 |
+python_check_deps() { |
406 |
+ has_version -b ">=dev-python/mako-0.8.0[${PYTHON_USEDEP}]" |
407 |
+} |
408 |
+ |
409 |
+pkg_setup() { |
410 |
+ # warning message for bug 459306 |
411 |
+ if use llvm && has_version sys-devel/llvm[!debug=]; then |
412 |
+ ewarn "Mismatch between debug USE flags in media-libs/mesa and sys-devel/llvm" |
413 |
+ ewarn "detected! This can cause problems. For details, see bug 459306." |
414 |
+ fi |
415 |
+ |
416 |
+ if use video_cards_i965 || |
417 |
+ use video_cards_iris || |
418 |
+ use video_cards_radeonsi; then |
419 |
+ if kernel_is -ge 5 11 3; then |
420 |
+ CONFIG_CHECK="~KCMP" |
421 |
+ elif kernel_is -ge 5 11; then |
422 |
+ CONFIG_CHECK="~CHECKPOINT_RESTORE" |
423 |
+ elif kernel_is -ge 5 10 20; then |
424 |
+ CONFIG_CHECK="~KCMP" |
425 |
+ else |
426 |
+ CONFIG_CHECK="~CHECKPOINT_RESTORE" |
427 |
+ fi |
428 |
+ linux-info_pkg_setup |
429 |
+ fi |
430 |
+ |
431 |
+ if use gallium && use llvm; then |
432 |
+ llvm_pkg_setup |
433 |
+ fi |
434 |
+ python-any-r1_pkg_setup |
435 |
+} |
436 |
+ |
437 |
+multilib_src_configure() { |
438 |
+ local emesonargs=() |
439 |
+ |
440 |
+ if use classic; then |
441 |
+ # Intel code |
442 |
+ dri_driver_enable video_cards_i915 i915 |
443 |
+ dri_driver_enable video_cards_i965 i965 |
444 |
+ if ! use video_cards_i915 && \ |
445 |
+ ! use video_cards_i965; then |
446 |
+ dri_driver_enable video_cards_intel i915 i965 |
447 |
+ fi |
448 |
+ |
449 |
+ # Nouveau code |
450 |
+ dri_driver_enable video_cards_nouveau nouveau |
451 |
+ |
452 |
+ # ATI code |
453 |
+ dri_driver_enable video_cards_r100 r100 |
454 |
+ dri_driver_enable video_cards_r200 r200 |
455 |
+ if ! use video_cards_r100 && \ |
456 |
+ ! use video_cards_r200; then |
457 |
+ dri_driver_enable video_cards_radeon r100 r200 |
458 |
+ fi |
459 |
+ fi |
460 |
+ |
461 |
+ local platforms |
462 |
+ use X && platforms+="x11" |
463 |
+ use wayland && platforms+=",wayland" |
464 |
+ emesonargs+=(-Dplatforms=${platforms#,}) |
465 |
+ |
466 |
+ if use X || use egl; then |
467 |
+ emesonargs+=(-Dglvnd=true) |
468 |
+ else |
469 |
+ emesonargs+=(-Dglvnd=false) |
470 |
+ fi |
471 |
+ |
472 |
+ if use gallium; then |
473 |
+ emesonargs+=( |
474 |
+ $(meson_feature llvm) |
475 |
+ $(meson_feature lm-sensors lmsensors) |
476 |
+ $(meson_feature unwind libunwind) |
477 |
+ ) |
478 |
+ |
479 |
+ if use video_cards_iris || |
480 |
+ use video_cards_r300 || |
481 |
+ use video_cards_r600 || |
482 |
+ use video_cards_radeonsi || |
483 |
+ use video_cards_nouveau || |
484 |
+ use video_cards_vmware; then |
485 |
+ emesonargs+=($(meson_use d3d9 gallium-nine)) |
486 |
+ else |
487 |
+ emesonargs+=(-Dgallium-nine=false) |
488 |
+ fi |
489 |
+ |
490 |
+ if use video_cards_r600 || |
491 |
+ use video_cards_radeonsi || |
492 |
+ use video_cards_nouveau; then |
493 |
+ emesonargs+=($(meson_feature vaapi gallium-va)) |
494 |
+ use vaapi && emesonargs+=( -Dva-libs-path="${EPREFIX}"/usr/$(get_libdir)/va/drivers ) |
495 |
+ else |
496 |
+ emesonargs+=(-Dgallium-va=disabled) |
497 |
+ fi |
498 |
+ |
499 |
+ if use video_cards_r300 || |
500 |
+ use video_cards_r600 || |
501 |
+ use video_cards_radeonsi || |
502 |
+ use video_cards_nouveau; then |
503 |
+ emesonargs+=($(meson_feature vdpau gallium-vdpau)) |
504 |
+ else |
505 |
+ emesonargs+=(-Dgallium-vdpau=disabled) |
506 |
+ fi |
507 |
+ |
508 |
+ if use video_cards_freedreno || |
509 |
+ use video_cards_nouveau || |
510 |
+ use video_cards_vmware; then |
511 |
+ emesonargs+=($(meson_feature xa gallium-xa)) |
512 |
+ else |
513 |
+ emesonargs+=(-Dgallium-xa=disabled) |
514 |
+ fi |
515 |
+ |
516 |
+ if use video_cards_r600 || |
517 |
+ use video_cards_nouveau; then |
518 |
+ emesonargs+=($(meson_feature xvmc gallium-xvmc)) |
519 |
+ else |
520 |
+ emesonargs+=(-Dgallium-xvmc=disabled) |
521 |
+ fi |
522 |
+ |
523 |
+ if use video_cards_freedreno || |
524 |
+ use video_cards_lima || |
525 |
+ use video_cards_panfrost || |
526 |
+ use video_cards_v3d || |
527 |
+ use video_cards_vc4 || |
528 |
+ use video_cards_vivante; then |
529 |
+ gallium_enable -- kmsro |
530 |
+ fi |
531 |
+ |
532 |
+ gallium_enable -- swrast |
533 |
+ gallium_enable video_cards_lima lima |
534 |
+ gallium_enable video_cards_panfrost panfrost |
535 |
+ gallium_enable video_cards_v3d v3d |
536 |
+ gallium_enable video_cards_vc4 vc4 |
537 |
+ gallium_enable video_cards_vivante etnaviv |
538 |
+ gallium_enable video_cards_vmware svga |
539 |
+ gallium_enable video_cards_nouveau nouveau |
540 |
+ gallium_enable zink zink |
541 |
+ |
542 |
+ # Only one i915 driver (classic vs gallium). Default to classic. |
543 |
+ if ! use classic; then |
544 |
+ gallium_enable video_cards_i915 i915 |
545 |
+ if ! use video_cards_i915 && \ |
546 |
+ ! use video_cards_i965; then |
547 |
+ gallium_enable video_cards_intel i915 |
548 |
+ fi |
549 |
+ fi |
550 |
+ |
551 |
+ gallium_enable video_cards_iris iris |
552 |
+ |
553 |
+ gallium_enable video_cards_r300 r300 |
554 |
+ gallium_enable video_cards_r600 r600 |
555 |
+ gallium_enable video_cards_radeonsi radeonsi |
556 |
+ if ! use video_cards_r300 && \ |
557 |
+ ! use video_cards_r600; then |
558 |
+ gallium_enable video_cards_radeon r300 r600 |
559 |
+ fi |
560 |
+ |
561 |
+ gallium_enable video_cards_freedreno freedreno |
562 |
+ gallium_enable video_cards_virgl virgl |
563 |
+ |
564 |
+ # opencl stuff |
565 |
+ emesonargs+=( |
566 |
+ -Dgallium-opencl="$(usex opencl icd disabled)" |
567 |
+ ) |
568 |
+ fi |
569 |
+ |
570 |
+ if use vulkan; then |
571 |
+ vulkan_enable video_cards_i965 intel |
572 |
+ vulkan_enable video_cards_iris intel |
573 |
+ vulkan_enable video_cards_radeonsi amd |
574 |
+ vulkan_enable video_cards_v3d broadcom |
575 |
+ fi |
576 |
+ |
577 |
+ driver_list() { |
578 |
+ local drivers="$(sort -u <<< "${1// /$'\n'}")" |
579 |
+ echo "${drivers//$'\n'/,}" |
580 |
+ } |
581 |
+ |
582 |
+ local vulkan_layers |
583 |
+ use vulkan && vulkan_layers+="device-select" |
584 |
+ use vulkan-overlay && vulkan_layers+=",overlay" |
585 |
+ emesonargs+=(-Dvulkan-layers=${vulkan_layers#,}) |
586 |
+ |
587 |
+ emesonargs+=( |
588 |
+ $(meson_use test build-tests) |
589 |
+ -Dglx=$(usex X dri disabled) |
590 |
+ -Dshared-glapi=enabled |
591 |
+ $(meson_feature dri3) |
592 |
+ $(meson_feature egl) |
593 |
+ $(meson_feature gbm) |
594 |
+ $(meson_feature gles1) |
595 |
+ $(meson_feature gles2) |
596 |
+ $(meson_use osmesa) |
597 |
+ $(meson_use selinux) |
598 |
+ $(meson_feature zstd) |
599 |
+ -Dvalgrind=$(usex valgrind auto false) |
600 |
+ -Ddri-drivers=$(driver_list "${DRI_DRIVERS[*]}") |
601 |
+ -Dgallium-drivers=$(driver_list "${GALLIUM_DRIVERS[*]}") |
602 |
+ -Dvulkan-drivers=$(driver_list "${VULKAN_DRIVERS[*]}") |
603 |
+ --buildtype $(usex debug debug plain) |
604 |
+ -Db_ndebug=$(usex debug false true) |
605 |
+ ) |
606 |
+ meson_src_configure |
607 |
+} |
608 |
+ |
609 |
+multilib_src_test() { |
610 |
+ meson_src_test -t 100 |
611 |
+} |
612 |
+ |
613 |
+# $1 - VIDEO_CARDS flag (check skipped for "--") |
614 |
+# other args - names of DRI drivers to enable |
615 |
+dri_driver_enable() { |
616 |
+ if [[ $1 == -- ]] || use $1; then |
617 |
+ shift |
618 |
+ DRI_DRIVERS+=("$@") |
619 |
+ fi |
620 |
+} |
621 |
+ |
622 |
+gallium_enable() { |
623 |
+ if [[ $1 == -- ]] || use $1; then |
624 |
+ shift |
625 |
+ GALLIUM_DRIVERS+=("$@") |
626 |
+ fi |
627 |
+} |
628 |
+ |
629 |
+vulkan_enable() { |
630 |
+ if [[ $1 == -- ]] || use $1; then |
631 |
+ shift |
632 |
+ VULKAN_DRIVERS+=("$@") |
633 |
+ fi |
634 |
+} |