0
0
mirror of https://github.com/termux/termux-packages.git synced 2025-10-23 01:14:10 +00:00
Files
termux-packages/packages/mesa/0018-preserve-egl-support-in-zink.patch
Robert Kirkman 411745ec37 bump(main/mesa): 25.2.4
- Fixes https://github.com/termux/termux-packages/issues/26526

- Fixes https://github.com/termux/termux-packages/issues/25371

- All patches seemed to only need minor rebasing and no other errors

- Tested working on Samsung Galaxy S9 SM-G960U with Adreno 630

- Add unofficial Adreno 710+720 support found here https://gitlab.freedesktop.org/mesa/mesa/-/issues/13036 and here db9f6d0b31

- After 3294cad341, a new change is required in order to preserve GPU acceleration in the edge case of **EGL+Zink+Turnip+Termux:X11+Adreno 630**. I have named this change `0018-preserve-egl-support-in-zink.patch` and it is an original creation based on my ~2 years of experience developing EGL software for running inside Termux:X11 on Samsung Galaxy S9 SM-G96U with Adreno 630. **Unfortunately, I do not know what the effects of this patch will be on other devices that I do not have, so please tell me ASAP if it appears to break Zink on your device**.

- After 622612f67e, the default behavior of Zink is to enable the "general layout" mode whenever Turnip is detected. In testing in Termux:X11 on Samsung Galaxy A70 SM-A705FN, that change is incorrect and results in severe artifacts in Firefox when Firefox has `gfx.webrender.all=true` and `gfx.x11-egl.force-disabled=true` set in `about:config`, so `0019-disable-general-layout-in-zink-for-turnip.patch` must be created to forcibly stop Zink from enabling "general layout" mode when Turnip is detected.
2025-10-14 11:06:16 -05:00

41 lines
1.9 KiB
Diff

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 =