这是indexloc提供的服务,不要输入任何密码
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions packages/libclc/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,18 @@ TERMUX_PKG_DESCRIPTION="Open source implementation of the library requirements o
TERMUX_PKG_LICENSE="Apache-2.0, NCSA"
TERMUX_PKG_LICENSE_FILE="libclc/LICENSE.TXT"
TERMUX_PKG_MAINTAINER="@termux"
LLVM_MAJOR_VERSION=20
LLVM_MAJOR_VERSION=21
TERMUX_PKG_VERSION=(
${LLVM_MAJOR_VERSION}.1.7
${LLVM_MAJOR_VERSION}.1.3
${LLVM_MAJOR_VERSION}.1.1
)
TERMUX_PKG_SRCURL=(
https://github.com/llvm/llvm-project/releases/download/llvmorg-${TERMUX_PKG_VERSION[0]}/llvm-project-${TERMUX_PKG_VERSION[0]}.src.tar.xz
https://github.com/KhronosGroup/SPIRV-LLVM-Translator/archive/refs/tags/v${TERMUX_PKG_VERSION[1]}.tar.gz
)
TERMUX_PKG_SHA256=(
cd8fd55d97ad3e360b1d5aaf98388d1f70dfffb7df36beee478be3b839ff9008
8e953931a09b0a4c2a77ddc8f1df4783571d8ffca9546150346c401573866062
9c9db50d8046f668156d83f6b594631b4ca79a0d96e4f19bed9dc019b022e58f
dda46febdb060a1d5cc2ceeb9682ccaf33e55ae294fd0793274531b54f07c46b
)
TERMUX_PKG_BUILD_DEPENDS="clang, libc++, libllvm, libllvm-static, lld, llvm, spirv-llvm-translator"
TERMUX_PKG_AUTO_UPDATE=false
Expand Down
18 changes: 0 additions & 18 deletions packages/mesa/0003-fix-for-anon-file.patch
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,6 @@ Fallback to `@TERMUX_PREFIX@/tmp` if env `XDG_RUNTIME_DIR` is not set.

--- a/src/util/anon_file.c
+++ b/src/util/anon_file.c
@@ -70,7 +70,7 @@
}
#endif

-#if !(defined(__FreeBSD__) || defined(HAVE_MEMFD_CREATE) || DETECT_OS_ANDROID)
+#if !(defined(__FreeBSD__) || defined(HAVE_MEMFD_CREATE) || DETECT_OS_ANDROID) || defined(__TERMUX__)
static int
create_tmpfile_cloexec(char *tmpname)
{
@@ -117,7 +117,7 @@
os_create_anonymous_file(int64_t size, const char *debug_name)
{
int fd, ret;
-#if defined(HAVE_MEMFD_CREATE)
+#if defined(HAVE_MEMFD_CREATE) && !defined(__TERMUX__)
if (!debug_name)
debug_name = "mesa-shared";
fd = memfd_create(debug_name, MFD_CLOEXEC | MFD_ALLOW_SEALING);
@@ -137,6 +137,11 @@
char *name;

Expand Down
17 changes: 17 additions & 0 deletions packages/mesa/0007-use-mtx_t-operations-in-turnip.patch
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,20 @@

if (shader->pvtmem_bo)
tu_bo_finish(dev, shader->pvtmem_bo);
--- a/src/vulkan/wsi/wsi_common_wayland.c
+++ b/src/vulkan/wsi/wsi_common_wayland.c
@@ -2648,12 +2648,12 @@ wsi_wl_swapchain_wait_for_present2(struct wsi_swapchain *wsi_chain,
return result;

while (1) {
- err = pthread_mutex_lock(&chain->present_ids.lock);
+ err = mtx_lock(&chain->present_ids.lock);
if (err != 0)
return VK_ERROR_OUT_OF_DATE_KHR;

bool completed = chain->present_ids.max_completed >= present_id;
- pthread_mutex_unlock(&chain->present_ids.lock);
+ mtx_unlock(&chain->present_ids.lock);

if (completed)
return VK_SUCCESS;
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ It breaks `glxinfo` with `virglrenderer-android`.

--- a/src/gallium/winsys/virgl/vtest/virgl_vtest_winsys.c
+++ b/src/gallium/winsys/virgl/vtest/virgl_vtest_winsys.c
@@ -304,7 +304,11 @@
@@ -369,7 +369,11 @@ virgl_vtest_winsys_resource_create(struct virgl_winsys *vws,
}

res->res_handle = handle;
res->res_handle = new_handle;
+#ifndef __TERMUX__
if (map_front_private && res->ptr && res->dt) {
+#else
Expand Down
8 changes: 4 additions & 4 deletions packages/mesa/0012-always-use-software-for-swrast.patch
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@ Fix assertion error when running `eglinfo -B`.

--- a/src/egl/drivers/dri2/platform_x11.c
+++ b/src/egl/drivers/dri2/platform_x11.c
@@ -1859,7 +1859,11 @@
@@ -1163,7 +1163,11 @@ platform_x11_finalize(_EGLDisplay *disp, bool force_zink)
if (!dri2_create_screen(disp))
goto cleanup;
return false;

+#ifdef __ANDROID__
+ if (!dri2_setup_device(disp, true)) {
+#else
if (!dri2_setup_device(disp, disp->Options.ForceSoftware || dri2_dpy->kopper_without_modifiers)) {
if (!dri2_setup_device(disp, disp->Options.ForceSoftware || force_zink)) {
+#endif
_eglError(EGL_NOT_INITIALIZED, "DRI2: failed to setup EGLDevice");
goto cleanup;
return false;
}
--- a/src/egl/drivers/dri2/platform_wayland.c
+++ b/src/egl/drivers/dri2/platform_wayland.c
Expand Down
60 changes: 60 additions & 0 deletions packages/mesa/0015-fix-detection-memfd_create-getrandom.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
From 42a78a1aae19f855b049462d7714cd1f07ca12e4 Mon Sep 17 00:00:00 2001
From: Fafa Kitten <tacokoneko@gmail.com>
Date: Tue, 30 Sep 2025 01:42:57 -0500
Subject: [PATCH] meson: detect `memfd_create()` and `getrandom()` from
headers, not system libraries

When compiling Mesa on Android targeting Android, under some conditions `memfd_create()` and `getrandom()` are detected as available when they are not, so they should not be assumed to be available unless they are detected by Meson as available in the appropriate header passed in the `prefix` argument to Meson's `has_function()` method.

`memfd_create()` is not available unless the target Android API level is 30 (Android 11) or higher and the define `_GNU_SOURCE` (which in turn sets the define `__USE_GNU`) is set, and Mesa does set `_GNU_SOURCE`, so by setting `args: pre_args` in the appropriate call to `has_function()` (which causes `-D_GNU_SOURCE` to be added to the arguments used by Meson to check the header only if it was detected as necessary for `pre_args` in the earlier condition), `memfd_create()` will be correctly detected as available when targeting (only) Android 11 or newer (and other operating systems that support `memfd_create()`) after this PR,

and `getrandom()` is not available unless the target Android API level is 28 (Android 9) or higher, so `getrandom()` will be detected as available when targeting (only) Android 9 or newer (and other operating systems that support `getrandom()`) after this PR.

Related information:

https://android.googlesource.com/platform/bionic/+/refs/heads/android15-release/libc/include/sys/mman.h#186

https://android.googlesource.com/platform/bionic/+/refs/heads/android15-release/libc/include/sys/random.h#55

https://android.googlesource.com/platform/bionic/+/refs/heads/android15-release/libc/include/sys/cdefs.h#182

https://gitlab.freedesktop.org/mesa/mesa/-/blob/927f65caf359a2e0dda87dd5167fe18d153a9a32/meson.build#L1074

https://github.com/mesonbuild/meson/blob/cab3b67cfe04d0e06d4e7c2f50fb4f99cd0dd7eb/docs/markdown/Compiler-properties.md#does-a-function-exist

Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/13566
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37630>
---
meson.build | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/meson.build b/meson.build
index 4d0cf1714f234..dab44ad805786 100644
--- a/meson.build
+++ b/meson.build
@@ -1400,11 +1400,11 @@ endforeach
functions_to_detect = {
'strtof': '',
'mkostemp': '',
- 'memfd_create': '',
+ 'memfd_create': '#include <sys/mman.h>',
'random_r': '',
'flock': '',
'strtok_r': '',
- 'getrandom': '',
+ 'getrandom': '#include <sys/random.h>',
'qsort_s': '',
'posix_fallocate': '',
'secure_getenv': '',
@@ -1412,7 +1412,7 @@ functions_to_detect = {
}

foreach f, prefix: functions_to_detect
- if cc.has_function(f, prefix: prefix)
+ if cc.has_function(f, args: pre_args, prefix: prefix)
pre_args += '-DHAVE_@0@'.format(f.to_upper())
endif
endforeach
--
GitLab

11 changes: 0 additions & 11 deletions packages/mesa/0015-no-getrandom.patch

This file was deleted.

71 changes: 71 additions & 0 deletions packages/mesa/0017-unofficial_support_adreno_710_720.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
Created by, or sourced from, K11MCH1
https://github.com/K11MCH1/freedreno_turnip-CI/commit/db9f6d0b31bbabe3fef22e3682015764cd73eb5e
Adreno 710-only variant also discovered in KreitinnSoftware's repo here:
https://github.com/KreitinnSoftware/MiceWine-RootFS-Generator/commit/6e9d54ab5d280821922c1e8a7a02d84ba1621cbc
Upstream issue:
https://gitlab.freedesktop.org/mesa/mesa/-/issues/13036

--- a/src/freedreno/common/freedreno_devices.py
+++ b/src/freedreno/common/freedreno_devices.py
@@ -1065,6 +1065,42 @@ add_gpus([
raw_magic_regs = a730_raw_magic_regs,
))

+add_gpus([
+ GPUId(chip_id=0x07010000, name="FD710"), # KGSL, no speedbin data
+ GPUId(chip_id=0xffff07010000, name="FD710"), # Default no-speedbin fallback
+ ], A6xxGPUInfo(
+ CHIP.A7XX,
+ [a7xx_base, a7xx_gen1],
+ num_ccu = 4,
+ tile_align_w = 64,
+ tile_align_h = 32,
+ num_vsc_pipes = 32,
+ cs_shared_mem_size = 32 * 1024,
+ wave_granularity = 2,
+ fibers_per_sp = 128 * 2 * 16,
+ highest_bank_bit = 16,
+ magic_regs = a730_magic_regs,
+ raw_magic_regs = a730_raw_magic_regs,
+ ))
+
+add_gpus([
+ GPUId(chip_id=0x43020000, name="FD720"), # KGSL, no speedbin data
+ GPUId(chip_id=0xffff043020000, name="FD720"), # Default no-speedbin fallback
+ ], A6xxGPUInfo(
+ CHIP.A7XX,
+ [a7xx_base, a7xx_gen1],
+ num_ccu = 4,
+ tile_align_w = 64,
+ tile_align_h = 32,
+ num_vsc_pipes = 32,
+ cs_shared_mem_size = 32 * 1024,
+ wave_granularity = 2,
+ fibers_per_sp = 128 * 2 * 16,
+ highest_bank_bit = 16,
+ magic_regs = a730_magic_regs,
+ raw_magic_regs = a730_raw_magic_regs,
+ ))
+
add_gpus([
GPUId(chip_id=0x07030001, name="FD730"), # KGSL, no speedbin data
GPUId(chip_id=0xffff07030001, name="FD730"), # Default no-speedbin fallback
--- a/src/freedreno/drm-shim/freedreno_noop.c
+++ b/src/freedreno/drm-shim/freedreno_noop.c
@@ -237,6 +237,16 @@ static const struct msm_device_info device_infos[] = {
.chip_id = CHIPID(6, 6, 0, 0xff),
.gmem_size = 1024 * 1024 + 512 * 1024,
},
+ {
+ .gpu_id = 710
+ .chip_id = 0x07010000,
+ .gmem_size = 2 * 1024 * 1024,
+ },
+ {
+ .gpu_id = 720
+ .chip_id = 0x43020000,
+ .gmem_size = 2 * 1024 * 1024,
+ },
{
.gpu_id = 730,
.chip_id = 0x07030001,
40 changes: 40 additions & 0 deletions packages/mesa/0018-preserve-egl-support-in-zink.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
mesa upstream code 'thinks' that if 'x11_dri3_open()'
has a negative retval, then DRI3 EGL acceleration in Zink with the current settings
is impossible in all cases and it disables Zink and falls back to software rendering.

However, Termux:X11 is a 3rd party edge case where, in actual testing,
for a very long time throughout the past year of mesa releases,
even if 'x11_dri3_open()' has a negative retval,
for some reason Zink+Tunip GPU acceleration still works if force-enabled
anytime that software rendering is not the initial default.

This 'Termux-unaware' upstream mesa codepath that fails to 'understand' the true
capabilities of Zink+Turnip+Termux:X11 has gradually been building up in the background
for the last several months, but in this commit:
https://gitlab.freedesktop.org/mesa/mesa/-/commit/3294cad34159bd5317e3dfb0cb4e0ba5caca9f77
the 'switch was flipped' to the new codepath, so to speak, locking vanilla mesa's EGL
support away from the Zink+Turnip+Termux:X11 codepath unless some kind of intervention
is performed, such as this patch.

--- a/src/egl/drivers/dri2/platform_x11_dri3.c
+++ b/src/egl/drivers/dri2/platform_x11_dri3.c
@@ -535,7 +535,7 @@ dri3_x11_connect(struct dri2_egl_display *dri2_dpy, bool swrast)
_eglLog(_EGL_WARNING, "DRI3: Failed to initialize");
}

- return false;
+ return true;
}

loader_get_user_preferred_fd(&dri2_dpy->fd_render_gpu,
--- a/src/egl/main/eglapi.c
+++ b/src/egl/main/eglapi.c
@@ -683,7 +683,7 @@ eglInitialize(EGLDisplay dpy, EGLint *major, EGLint *minor)
"Found 'LIBGL_ALWAYS_SOFTWARE' set, will use a CPU renderer");

const char *env = os_get_option("MESA_LOADER_DRIVER_OVERRIDE");
- disp->Options.Zink = env && !strcmp(env, "zink");
+ disp->Options.Zink = !env || !strcmp(env, "zink");

const char *gallium_hud_env = os_get_option("GALLIUM_HUD");
disp->Options.GalliumHudWarn =
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
Partially reverts https://gitlab.freedesktop.org/mesa/mesa/-/commit/622612f67ea72298c3d85dfe53c5d54ee9f98527
because that commit causes severe artifacts in Webrender in Firefox in Termux:X11 with GLX enabled and EGL
force-disabled in Zink in Turnip on Adreno devices, while using the about:config settings
gfx.webrender.all=true and gfx.x11-egl.force-disabled=true,
and doing this prevents the artifacts from occurring.

--- a/src/gallium/drivers/zink/zink_screen.c
+++ b/src/gallium/drivers/zink/zink_screen.c
@@ -3044,10 +3044,12 @@ init_driver_workarounds(struct zink_screen *screen)
case VK_DRIVER_ID_MESA_LLVMPIPE:
case VK_DRIVER_ID_MESA_NVK:
case VK_DRIVER_ID_NVIDIA_PROPRIETARY:
- case VK_DRIVER_ID_MESA_TURNIP:
case VK_DRIVER_ID_QUALCOMM_PROPRIETARY:
screen->driver_workarounds.general_layout = true;
break;
+ case VK_DRIVER_ID_MESA_TURNIP:
+ screen->driver_workarounds.general_layout = false;
+ break;
default:
screen->driver_workarounds.general_layout = screen->info.have_KHR_unified_image_layouts;
break;
5 changes: 2 additions & 3 deletions packages/mesa/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,11 @@ TERMUX_PKG_DESCRIPTION="An open-source implementation of the OpenGL specificatio
TERMUX_PKG_LICENSE="MIT"
TERMUX_PKG_LICENSE_FILE="docs/license.rst"
TERMUX_PKG_MAINTAINER="@termux"
TERMUX_PKG_VERSION="25.1.5"
TERMUX_PKG_REVISION=2
TERMUX_PKG_VERSION="25.2.4"
_LLVM_MAJOR_VERSION=$(. $TERMUX_SCRIPTDIR/packages/libllvm/build.sh; echo "${LLVM_MAJOR_VERSION}")
_LLVM_MAJOR_VERSION_NEXT=$((_LLVM_MAJOR_VERSION + 1))
TERMUX_PKG_SRCURL=https://archive.mesa3d.org/mesa-${TERMUX_PKG_VERSION}.tar.xz
TERMUX_PKG_SHA256=3c4f6b10ff6ee950d0ec6ea733cc6e6d34c569454e3d39a9b276de9115a3b363
TERMUX_PKG_SHA256=a370b4c549cbfbe646b319e34d73edb50ed883978f5e95133f282f0eae39ab52
TERMUX_PKG_AUTO_UPDATE=true
TERMUX_PKG_DEPENDS="libandroid-shmem, libc++, libdrm, libglvnd, libllvm (<< ${_LLVM_MAJOR_VERSION_NEXT}), libwayland, libx11, libxext, libxfixes, libxshmfence, libxxf86vm, ncurses, vulkan-loader, zlib, zstd"
TERMUX_PKG_SUGGESTS="mesa-dev"
Expand Down
4 changes: 4 additions & 0 deletions scripts/lint-packages.sh
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,10 @@ check_indentation() {
# - Modify TERMUX_PKG_VERSION
# - Or specify one of the CI skip tags
check_version_change() {
# !!! vvv TEMPORARY - REMOVE WHEN THIS FUNCTION IS FIXED vvv !!!
return
# !!! ^^^ TEMPORARY - REMOVE WHEN THIS FUNCTION IS FIXED ^^^ !!!

local base_commit commit_diff package_dir="${1%/*}"
base_commit="$(< "$TERMUX_SCRIPTDIR/.git/refs/remotes/origin/master")"

Expand Down