summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorA. Wilcox <AWilcox@Wilcox-Tech.com>2024-11-21 13:54:59 -0600
committerA. Wilcox <AWilcox@Wilcox-Tech.com>2024-11-21 13:54:59 -0600
commitc4ede4c852aeb9c2bfc5ba86dc0925b8598cac6d (patch)
treeb78409d524edf6f412b8b0c204630253c41ad428
parentd3255f8cac99867b48e3bd7b2371285ebdbcaf04 (diff)
downloadpackages-c4ede4c852aeb9c2bfc5ba86dc0925b8598cac6d.tar.gz
packages-c4ede4c852aeb9c2bfc5ba86dc0925b8598cac6d.tar.bz2
packages-c4ede4c852aeb9c2bfc5ba86dc0925b8598cac6d.tar.xz
packages-c4ede4c852aeb9c2bfc5ba86dc0925b8598cac6d.zip
user/mesa: move to user/mesa-amber
This provides graphics drivers for r100/r200 Radeons, and also early GeForces via nouveau dri. nv30+ are handled by Gallium. Uses libglvnd so it can coexist with newer Mesa versions.
-rw-r--r--user/mesa-amber/APKBUILD71
-rw-r--r--user/mesa-amber/big-endian-flipping.patch37
-rw-r--r--user/mesa-amber/no-tls.patch25
-rw-r--r--user/mesa-amber/nouveau-flush-fix.patch11
4 files changed, 144 insertions, 0 deletions
diff --git a/user/mesa-amber/APKBUILD b/user/mesa-amber/APKBUILD
new file mode 100644
index 000000000..c8556d868
--- /dev/null
+++ b/user/mesa-amber/APKBUILD
@@ -0,0 +1,71 @@
+# Maintainer: A. Wilcox <awilfox@adelielinux.org>
+pkgname=mesa-amber
+pkgver=21.3.9
+pkgrel=0
+pkgdesc="Mesa DRI OpenGL library"
+url="https://www.mesa3d.org"
+arch="all"
+options="!check" # No test suite.
+license="MIT AND X11 AND SGI-B-2.0 AND BSL-1.0 AND LGPL-2.1+"
+depends=""
+makedepends="bison expat-dev flex libdrm-dev libglvnd-dev libx11-dev libxcb-dev
+ libxdamage-dev libxext-dev libxfixes-dev libxrandr-dev libxshmfence-dev
+ libxxf86vm-dev meson python3 py3-libxml2 py3-mako py3-pygments
+ py3-markupsafe wayland-dev wayland-protocols xorgproto-dev zlib-dev
+ zstd-dev"
+subpackages=""
+source="https://mesa.freedesktop.org/archive/mesa-$pkgver.tar.xz
+ big-endian-flipping.patch
+ no-tls.patch
+ nouveau-flush-fix.patch
+ "
+builddir="$srcdir"/mesa-$pkgver
+
+_dri_driverdir=/usr/lib/xorg/modules/dri
+_dri_drivers="r100,r200,nouveau"
+
+case "$CARCH" in
+x86* | pmmx)
+ _dri_drivers="${_dri_drivers},i915,i965"
+ _arch_conf="-Dsse2=false"
+ ;;
+armhf)
+ CFLAGS="$CFLAGS -mfpu=neon"
+ ;;
+ppc64)
+ _arch_conf="-Dpower8=disabled"
+ ;;
+esac
+
+build() {
+ meson \
+ -Dprefix=/usr \
+ -Damber=true \
+ -Ddri-drivers=$_dri_drivers \
+ -Ddri-drivers-path=$_dri_driverdir \
+ -Ddri3=enabled \
+ -Dglvnd=true \
+ -Dllvm=disabled \
+ -Dosmesa=false \
+ -Dplatforms=x11,wayland \
+ -Dgallium-drivers='' \
+ -Dvulkan-drivers='' \
+ $_arch_conf \
+ build
+
+ meson compile -C build
+}
+
+package() {
+ DESTDIR="$pkgdir" meson install -C build
+ rm -rf "$pkgdir"/usr/include
+ rm -rf "$pkgdir"/usr/lib/libgbm.so*
+ rm -rf "$pkgdir"/usr/lib/libglapi.so*
+ rm -rf "$pkgdir"/usr/lib/pkgconfig
+ rm -rf "$pkgdir"/usr/share/drirc.d
+}
+
+sha512sums="4cec6f4f50f444fcd327f7c40f8899c2f265e348e121455262b540b1f890a1468bbea59965af0876c548fa97aa0a05a1b23fa6ca7d308bd60328cfdeab757684 mesa-21.3.9.tar.xz
+3417e5c6d7ec564178e1d72431042b0a6ba659321f13a3dda81eda5fa0f2c8bc7c6972cb8266aea84ab05976ffb161659e9988c50ecc418e8bc1e1ce8f93a65f big-endian-flipping.patch
+076bb17d85235f3c833af8f1641f3556e406ad187b7ae1ebacced5f57b8832243a878678de4e50880c9a50b2aae3c42ad2342ed8c3e18d881edb7dd5018a710e no-tls.patch
+7283dc0e86e1ddaf4590008db57dd591921f47928945782afaa283f3b87770c731bab19d3d8879b4bf8b785f8886b9b46c576ca735296123f8afff29655abaeb nouveau-flush-fix.patch"
diff --git a/user/mesa-amber/big-endian-flipping.patch b/user/mesa-amber/big-endian-flipping.patch
new file mode 100644
index 000000000..154a83108
--- /dev/null
+++ b/user/mesa-amber/big-endian-flipping.patch
@@ -0,0 +1,37 @@
+From f1e0d76264491a8d8f99a0041b1a36cf9752fd28 Mon Sep 17 00:00:00 2001
+From: "A. Wilcox" <AWilcox@Wilcox-Tech.com>
+Date: Thu, 27 Feb 2020 04:24:52 -0600
+Subject: [PATCH] mesa: Support flipping three-channel formats
+
+Test system: POWER9 ppc64 (BE) system with a Radeon R5 230.
+
+Before this commit, starting Xorg caused this message:
+Assertion failed: !"Invalid array format" (../src/mesa/main/formats.c: _mesa_array_format_flip_channels: 421)
+
+After this commit, Xorg starts successfully.
+---
+ src/mesa/main/formats.c | 8 ++++++++
+ 1 file changed, 8 insertions(+)
+
+diff --git a/src/mesa/main/formats.c b/src/mesa/main/formats.c
+index 370859d37ca..2e7d5d7f05e 100644
+--- a/src/mesa/main/formats.c
++++ b/src/mesa/main/formats.c
+@@ -419,6 +419,14 @@ _mesa_array_format_flip_channels(mesa_array_format format)
+ return format;
+ }
+
++ if (num_channels == 3) {
++ static const uint8_t flip[6] = { 2, 1, 0, 3, 4, 5 };
++ _mesa_array_format_set_swizzle(&format,
++ flip[swizzle[0]], flip[swizzle[1]],
++ flip[swizzle[2]], flip[swizzle[3]]);
++ return format;
++ }
++
+ if (num_channels == 4) {
+ static const uint8_t flip[6] = { 3, 2, 1, 0, 4, 5 };
+ _mesa_array_format_set_swizzle(&format,
+--
+2.25.1
+
diff --git a/user/mesa-amber/no-tls.patch b/user/mesa-amber/no-tls.patch
new file mode 100644
index 000000000..803fa3707
--- /dev/null
+++ b/user/mesa-amber/no-tls.patch
@@ -0,0 +1,25 @@
+--- mesa-21.3.8/meson.build.old 2022-03-18 14:26:47.000000000 -0500
++++ mesa-21.3.8/meson.build 2022-05-30 00:00:21.689085198 -0500
+@@ -508,22 +508,7 @@
+ error('-Degl-native-platform does not specify an enabled platform')
+ endif
+
+-# Android uses emutls for versions <= P/28. For USE_ELF_TLS we need ELF TLS.
+ use_elf_tls = false
+-if (not ['freebsd', 'openbsd', 'haiku'].contains(host_machine.system()) and
+- (not with_platform_android or get_option('platform-sdk-version') >= 29) and
+- (not with_platform_windows or not with_shared_glapi))
+- pre_args += '-DUSE_ELF_TLS'
+- use_elf_tls = true
+-
+- if with_platform_android
+- # By default the NDK compiler, at least, emits emutls references instead of
+- # ELF TLS, even when building targeting newer API levels. Make it actually do
+- # ELF TLS instead.
+- c_args += '-fno-emulated-tls'
+- cpp_args += '-fno-emulated-tls'
+- endif
+-endif
+
+ if with_glx != 'disabled'
+ if not (with_platform_x11 and with_any_opengl)
diff --git a/user/mesa-amber/nouveau-flush-fix.patch b/user/mesa-amber/nouveau-flush-fix.patch
new file mode 100644
index 000000000..97512d01a
--- /dev/null
+++ b/user/mesa-amber/nouveau-flush-fix.patch
@@ -0,0 +1,11 @@
+--- mesa-21.3.8/src/mesa/drivers/dri/nouveau/nouveau_driver.c.old 2022-03-18 19:26:47.000000000 +0000
++++ mesa-21.3.8/src/mesa/drivers/dri/nouveau/nouveau_driver.c 2023-10-23 06:05:10.177357372 +0000
+@@ -69,7 +69,7 @@
+ struct nouveau_context *nctx = to_nouveau_context(ctx);
+ struct nouveau_pushbuf *push = context_push(ctx);
+
+- PUSH_KICK(push);
++ if (push) PUSH_KICK(push);
+
+ if (ctx->DrawBuffer && _mesa_is_winsys_fbo(ctx->DrawBuffer) &&
+ ctx->DrawBuffer->_ColorDrawBufferIndexes[0] == BUFFER_FRONT_LEFT) {