summaryrefslogtreecommitdiff
path: root/user
diff options
context:
space:
mode:
authorA. Wilcox <AWilcox@Wilcox-Tech.com>2019-02-22 20:22:44 +0000
committerA. Wilcox <AWilcox@Wilcox-Tech.com>2019-02-22 20:22:44 +0000
commit88924496c2ce4d6b1eb3bbd42dfa5a5a259ef4cd (patch)
tree6ec8a715b6706f1eb5ef2bb9c684bbea12d5a058 /user
parent421a08dc13bbe4097119da4bf62c09831e58b954 (diff)
downloadpackages-88924496c2ce4d6b1eb3bbd42dfa5a5a259ef4cd.tar.gz
packages-88924496c2ce4d6b1eb3bbd42dfa5a5a259ef4cd.tar.bz2
packages-88924496c2ce4d6b1eb3bbd42dfa5a5a259ef4cd.tar.xz
packages-88924496c2ce4d6b1eb3bbd42dfa5a5a259ef4cd.zip
user/mesa: Fix swrast AltiVec detection on 32-bit PPC
Diffstat (limited to 'user')
-rw-r--r--user/mesa/APKBUILD8
-rw-r--r--user/mesa/fix-non-altivec-ppc32.patch66
2 files changed, 71 insertions, 3 deletions
diff --git a/user/mesa/APKBUILD b/user/mesa/APKBUILD
index ea95c3e04..b5287b1d0 100644
--- a/user/mesa/APKBUILD
+++ b/user/mesa/APKBUILD
@@ -1,11 +1,11 @@
# Maintainer: A. Wilcox <awilfox@adelielinux.org>
pkgname=mesa
pkgver=18.3.2
-pkgrel=1
+pkgrel=2
pkgdesc="Mesa DRI OpenGL library"
url="https://www.mesa3d.org"
arch="all"
-license="MIT AND X11 AND SGI-B-2.0 AND BSL-1.0"
+license="MIT AND X11 AND SGI-B-2.0 AND BSL-1.0 AND LGPL-2.1+"
depends=
subpackages="$pkgname-dev
$pkgname-dri-ati:_dri
@@ -29,6 +29,7 @@ source="https://mesa.freedesktop.org/archive/mesa-$pkgver.tar.xz
amdgpu-pthread-header.patch
disk_cache-stack-overflow.patch
drmdeps.patch
+ fix-non-altivec-ppc32.patch
"
_dri_driverdir=/usr/lib/xorg/modules/dri
@@ -239,4 +240,5 @@ sha512sums="34b66520728d720b1f3d3d63f8ba5c255d57b9e8fe427264419e4163b474df662ff6
c7d91a660a033df91fac9c557039efc8669f0c26b2d35997d50753938b70d1af0bd110dcab3f8236eafab7d4be5dd7cd128a3e057e67e7e6a38a73fd6a7ef62e musl-fix-includes.patch
245d0d64d858dfadeeb544f31f7d0bb6ecb746a7fd5ec99755d679ae1a1eef4198d66473fb24d333eb6786bb8657012771e8285d67f165dc61a031df801947aa amdgpu-pthread-header.patch
f40ff04ac73c090c74d1955de6013c5aa41fb77f28b2b82d89cfc1880306a9ca1dde4581592db19f0a0ec6d85032f1ed5d953103ab0d075f9f0b7e459a028c45 disk_cache-stack-overflow.patch
-6800bc62aebfba22a2562c858c27391b47c5675020bd67f040da93ffe4d5d8ac828907a44c7cee6a4ebe63821b58c2515b4012f1f23473670b1de8670426a430 drmdeps.patch"
+6800bc62aebfba22a2562c858c27391b47c5675020bd67f040da93ffe4d5d8ac828907a44c7cee6a4ebe63821b58c2515b4012f1f23473670b1de8670426a430 drmdeps.patch
+71a397cf9937e623d21abacb2726602f1b5165b18543e11fdfdaac748c221aeafbbda790492a2180b590dace9a17c931c1eac199de32e90c3fa3305706a4011f fix-non-altivec-ppc32.patch"
diff --git a/user/mesa/fix-non-altivec-ppc32.patch b/user/mesa/fix-non-altivec-ppc32.patch
new file mode 100644
index 000000000..846cf5031
--- /dev/null
+++ b/user/mesa/fix-non-altivec-ppc32.patch
@@ -0,0 +1,66 @@
+--- mesa-18.3.2/src/util/u_cpu_detect.c.old 2019-01-17 11:26:23.000000000 +0000
++++ mesa-18.3.2/src/util/u_cpu_detect.c 2019-02-22 19:23:26.620000000 +0000
+@@ -41,6 +41,9 @@
+ #if defined(PIPE_ARCH_PPC)
+ #if defined(PIPE_OS_APPLE)
+ #include <sys/sysctl.h>
++#elif defined(PIPE_OS_LINUX)
++#include <asm/cputable.h>
++#include <linux/auxvec.h>
+ #else
+ #include <signal.h>
+ #include <setjmp.h>
+@@ -92,7 +95,7 @@
+ #endif
+
+
+-#if defined(PIPE_ARCH_PPC) && !defined(PIPE_OS_APPLE)
++#if defined(PIPE_ARCH_PPC) && !defined(PIPE_OS_APPLE) && !defined(PIPE_OS_LINUX)
+ static jmp_buf __lv_powerpc_jmpbuf;
+ static volatile sig_atomic_t __lv_powerpc_canjump = 0;
+
+@@ -126,7 +129,43 @@
+ util_cpu_caps.has_altivec = 1;
+ }
+ }
+-#else /* !PIPE_OS_APPLE */
++#elif defined(PIPE_OS_LINUX)
++ /* Taken from FFmpeg 4.1.1 (LGPL-2.1+) */
++ // The linux kernel could have the altivec support disabled
++ // even if the cpu has it.
++ int i, ret = 0;
++ int fd = open("/proc/self/auxv", O_RDONLY);
++ unsigned long buf[64] = { 0 };
++ ssize_t count;
++ boolean enable_vsx = TRUE;
++ /* VSX instructions can be explicitly enabled/disabled via GALLIVM_VSX=1 or 0 */
++ char *env_vsx = getenv("GALLIVM_VSX");
++ if (env_vsx && env_vsx[0] == '0') {
++ enable_vsx = FALSE;
++ }
++
++ if (fd < 0)
++ return 0;
++
++ while ((count = read(fd, buf, sizeof(buf))) > 0) {
++ for (i = 0; i < count / sizeof(*buf); i += 2) {
++ if (buf[i] == AT_NULL)
++ goto out;
++ if (buf[i] == AT_HWCAP) {
++ if (buf[i + 1] & PPC_FEATURE_HAS_ALTIVEC)
++ util_cpu_caps.has_altivec = 1;
++#ifdef PPC_FEATURE_HAS_VSX
++ if (enable_vsx && buf[i + 1] & PPC_FEATURE_HAS_VSX)
++ util_cpu_caps.has_vsx = 1;
++#endif
++ goto out;
++ }
++ }
++ }
++
++out:
++ close(fd);
++#else /* !PIPE_OS_APPLE, !PIPE_OS_LINUX */
+ /* not on Apple/Darwin, do it the brute-force way */
+ /* this is borrowed from the libmpeg2 library */
+ signal(SIGILL, sigill_handler);