Skip to content

Commit

Permalink
user/mesa-amber: new package
Browse files Browse the repository at this point in the history
This is the older branch of mesa intended for stuff like old and
big endian harwdare. It's feature-limited (no opencl, no llvm)
and fully replaces the regular mesa.
  • Loading branch information
q66 committed Jan 5, 2025
1 parent 6a059d0 commit 2e01734
Show file tree
Hide file tree
Showing 23 changed files with 585 additions and 0 deletions.
1 change: 1 addition & 0 deletions user/libegl-amber
1 change: 1 addition & 0 deletions user/libgbm-amber
1 change: 1 addition & 0 deletions user/libgbm-amber-devel
1 change: 1 addition & 0 deletions user/libgl-amber
1 change: 1 addition & 0 deletions user/libglapi-amber
1 change: 1 addition & 0 deletions user/libgles1-amber
1 change: 1 addition & 0 deletions user/libgles2-amber
1 change: 1 addition & 0 deletions user/libosmesa-amber
1 change: 1 addition & 0 deletions user/libxatracker-amber
1 change: 1 addition & 0 deletions user/mesa-amber-devel
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
From d72aa8ae74ffb7329003f9f23ffa05833af951ab Mon Sep 17 00:00:00 2001
From: Jon Nettleton <[email protected]>
Date: Fri, 14 Aug 2020 13:36:08 +0200
Subject: [PATCH] radeonsi: On Aarch64 force persistent buffers to GTT

This fixes a glamore corruption issue on the HoneyComb and by
internet reports should also fix problems seen on Huaweii
Kunpeng hardware.

The root cause of the corruption needs to be worked out, but
this patch also adds a noticable performance improvement. The
aquarium webgl demo under chromium increases from 39-49 FPS
when 5000 fish being rendered is selected. Glmark scores also
improve by ~200 with no specific tests showing any regression.

Signed-off-by: Jon Nettleton <[email protected]>
---
src/gallium/drivers/radeonsi/si_buffer.c | 4 ++++
1 file changed, 4 insertions(+)

diff --git a/src/gallium/drivers/radeonsi/si_buffer.c b/src/gallium/drivers/radeonsi/si_buffer.c
index 6b58aebee2d..c9e983367a0 100644
--- a/src/gallium/drivers/radeonsi/si_buffer.c
+++ b/src/gallium/drivers/radeonsi/si_buffer.c
@@ -151,6 +151,11 @@ void si_init_resource_fields(struct si_screen *sscreen, struct si_resource *res,
*/
if (!sscreen->info.kernel_flushes_hdp_before_ib || !sscreen->info.is_amdgpu)
res->domains = RADEON_DOMAIN_GTT;
+
+#if defined(PIPE_ARCH_AARCH64)
+ if (size <= 1024 * 1024)
+ res->domains = RADEON_DOMAIN_GTT;
+#endif
}

/* Tiled textures are unmappable. Always put them in VRAM. */
--
2.26.2
34 changes: 34 additions & 0 deletions user/mesa-amber/patches/add-use-elf-tls.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
Upstream: https://gitlab.freedesktop.org/mesa/mesa/issues/966
Status: Not fixed upstream

diff --git meson.build meson.build
index e1e94e71049..96ab3fb3e45 100644
--- a/meson.build
+++ b/meson.build
@@ -447,7 +447,8 @@ 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
+with_use_elf_tls = get_option('use-elf-tls')
+if (not ['freebsd', 'openbsd', 'haiku'].contains(host_machine.system()) and with_use_elf_tls 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'
diff --git meson_options.txt meson_options.txt
index a7030aba31e..966cfeca298 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -446,6 +446,12 @@ option(
value : 25,
description : 'Android Platform SDK version. Default: Nougat version.'
)
+option(
+ 'use-elf-tls',
+ type : 'boolean',
+ value : true,
+ description : 'Build support for initial-exec TLS model'
+)
option(
'zstd',
type : 'combo',
25 changes: 25 additions & 0 deletions user/mesa-amber/patches/disable-ppc64-asm.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
commit 40a554d5ca9c08a4dd3181bb47339aded5252628
Author: Daniel Kolesa <[email protected]>
Date: Thu Jan 20 03:32:35 2022 +0100

disable ppc64le asm

This is problematic in threaded applications with musl, so
just fall back to plain-C version.

diff --git a/meson.build b/meson.build
index bd54e78..eafdfad 100644
--- a/meson.build
+++ b/meson.build
@@ -1339,11 +1339,6 @@ elif host_machine.cpu_family() == 'sparc64'
with_asm_arch = 'sparc'
pre_args += ['-DUSE_SPARC_ASM']
endif
-elif host_machine.cpu_family().startswith('ppc64') and host_machine.endian() == 'little'
- if system_has_kms_drm
- with_asm_arch = 'ppc64le'
- pre_args += ['-DUSE_PPC64LE_ASM']
- endif
elif host_machine.cpu_family() == 'mips64' and host_machine.endian() == 'little'
if system_has_kms_drm
with_asm_arch = 'mips64el'
19 changes: 19 additions & 0 deletions user/mesa-amber/patches/musl-endian.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
--- a/src/util/u_endian.h
+++ b/src/util/u_endian.h
@@ -87,6 +87,16 @@
#define UTIL_ARCH_LITTLE_ENDIAN 1
#define UTIL_ARCH_BIG_ENDIAN 0

+#else
+/* Musl libc */
+#include <endian.h>
+
+#if __BYTE_ORDER == __LITTLE_ENDIAN
+# define PIPE_ARCH_LITTLE_ENDIAN
+#elif __BYTE_ORDER == __BIG_ENDIAN
+# define PIPE_ARCH_BIG_ENDIAN
+#endif
+
#endif

#if !defined(UTIL_ARCH_LITTLE_ENDIAN) || !defined(UTIL_ARCH_BIG_ENDIAN)
35 changes: 35 additions & 0 deletions user/mesa-amber/patches/musl-stacksize.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
diff --git ./include/c11/threads_posix.h ./include/c11/threads_posix.h
index 45cb6075e6..1a2ea1a450 100644
--- a/include/c11/threads_posix.h
+++ b/include/c11/threads_posix.h
@@ -281,15 +281,29 @@ static inline int
thrd_create(thrd_t *thr, thrd_start_t func, void *arg)
{
struct impl_thrd_param *pack;
+#ifdef __GLIBC__
+ pthread_attr_t *attrp = NULL;
+#else
+ pthread_attr_t attr = { 0 };
+ pthread_attr_init(&attr);
+ pthread_attr_setstacksize(&attr, 8388608);
+ pthread_attr_t *attrp = &attr;
+#endif
assert(thr != NULL);
pack = (struct impl_thrd_param *)malloc(sizeof(struct impl_thrd_param));
if (!pack) return thrd_nomem;
pack->func = func;
pack->arg = arg;
- if (pthread_create(thr, NULL, impl_thrd_routine, pack) != 0) {
+ if (pthread_create(thr, attrp, impl_thrd_routine, pack) != 0) {
+#ifndef __GLIBC__
+ pthread_attr_destroy(&attr);
+#endif
free(pack);
return thrd_error;
}
+#ifndef __GLIBC__
+ pthread_attr_destroy(&attr);
+#endif
return thrd_success;
}

60 changes: 60 additions & 0 deletions user/mesa-amber/patches/musl.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
diff --git a/src/amd/vulkan/winsys/amdgpu/radv_amdgpu_winsys.h b/src/amd/vulkan/winsys/amdgpu/radv_amdgpu_winsys.h
index 06ca905..bb244f8 100644
--- a/src/amd/vulkan/winsys/amdgpu/radv_amdgpu_winsys.h
+++ b/src/amd/vulkan/winsys/amdgpu/radv_amdgpu_winsys.h
@@ -30,6 +30,7 @@

#include <amdgpu.h>
#include <pthread.h>
+#include <sys/types.h>
#include "util/list.h"
#include "util/rwlock.h"
#include "ac_gpu_info.h"
diff --git a/src/gallium/drivers/freedreno/freedreno_util.h b/src/gallium/drivers/freedreno/freedreno_util.h
index 22f99c4..c405810 100644
--- a/src/gallium/drivers/freedreno/freedreno_util.h
+++ b/src/gallium/drivers/freedreno/freedreno_util.h
@@ -107,6 +107,9 @@ extern bool fd_binning_enabled;
#include <unistd.h>
#include <sys/types.h>
#include <sys/syscall.h>
+#include <sys/syscall.h>
+
+#define gettid() ((pid_t)syscall(SYS_gettid))

#define DBG(fmt, ...) \
do { \
diff --git a/src/gallium/frontends/nine/nine_debug.c b/src/gallium/frontends/nine/nine_debug.c
index f3a6a94..f4a6c41 100644
--- a/src/gallium/frontends/nine/nine_debug.c
+++ b/src/gallium/frontends/nine/nine_debug.c
@@ -65,7 +65,7 @@ _nine_debug_printf( unsigned long flag,
{
static boolean first = TRUE;
static unsigned long dbg_flags = DBG_ERROR | DBG_WARN;
- unsigned long tid = 0;
+ pthread_t tid = 0;

if (first) {
first = FALSE;
@@ -74,7 +74,7 @@ _nine_debug_printf( unsigned long flag,

#if defined(HAVE_PTHREAD)
if (dbg_flags & DBG_TID)
- tid = (unsigned long)pthread_self();
+ tid = pthread_self();
#endif

if (dbg_flags & flag) {
diff --git a/src/util/rand_xor.c b/src/util/rand_xor.c
index 81b64f1..01c6bba 100644
--- a/src/util/rand_xor.c
+++ b/src/util/rand_xor.c
@@ -28,6 +28,7 @@
#if defined(HAVE_GETRANDOM)
#include <sys/random.h>
#endif
+#include <sys/types.h> /* size_t, ssize_t */
#include <unistd.h>
#include <fcntl.h>
#endif
25 changes: 25 additions & 0 deletions user/mesa-amber/patches/no-unlink-megadrivers.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
This converts megadriver installation to use symlinks so that we do
not have to deal with skipping the strip stage for some files, as
a result simplifying our template greatly.

--- a/bin/install_megadrivers.py
+++ b/bin/install_megadrivers.py
@@ -56,7 +56,7 @@ def main():
if os.path.lexists(abs_driver):
os.unlink(abs_driver)
print('installing {} to {}'.format(args.megadriver, abs_driver))
- os.link(master, abs_driver)
+ os.symlink(os.path.basename(master), abs_driver)

try:
ret = os.getcwd()
@@ -71,8 +71,7 @@ def main():
finally:
os.chdir(ret)

- # Remove meson-created master .so and symlinks
- os.unlink(master)
+ # Remove meson-created symlinks
name, ext = os.path.splitext(master)
while ext != '.so':
if os.path.lexists(name):
23 changes: 23 additions & 0 deletions user/mesa-amber/patches/va-no-amdgpu-llvm.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
--- a/src/gallium/targets/dri/dri.sym
+++ b/src/gallium/targets/dri/dri.sym
@@ -4,9 +4,6 @@
__driDriverGetExtensions*;
nouveau_drm_screen_create;
radeon_drm_winsys_create;
- amdgpu_winsys_create;
- fd_drm_screen_create;
- ac_init_shared_llvm_once;
local:
*;
};
--- a/src/gallium/targets/va/va.sym
+++ b/src/gallium/targets/va/va.sym
@@ -5,8 +5,6 @@
# Workaround for an LLVM warning with -simplifycfg-sink-common
# due to LLVM being initialized multiple times.
radeon_drm_winsys_create;
- amdgpu_winsys_create;
- ac_init_shared_llvm_once;
local:
*;
};
Loading

0 comments on commit 2e01734

Please sign in to comment.