fix(mesa): glXQueryDrawable no longer calls a NULL getSwapInterval on drisw

On a drisw screen without kopper or DRI3 the hook is NULL, and querying
GLX_SWAP_INTERVAL_EXT crashed the client (pc=0 in libGLX_mesa), e.g. SDL3 in
steamwebhelper. Add the patch to the guest Mesa rebuild; it is also sent to
Mesa upstream.
This commit is contained in:
pgm1207 committed 2026-11-18 12:09:49 +01:00
1 parent d89c2c1c2d
commit 6ace78c90d
2 files changed
+49 -1

No files matched your search

+1 -1
View File
@@ -10,7 +10,7 @@ Steam on the desktop). The app installs it into `files/linuxfs` and runs it unde
scroll source/discrete forwarding). Both get a `+droiddeck` version. `patches/mesa` adds KGSL
UBWC 5/6 (backported from upstream Mesa) and the KGSL device numbers for WSI (from
[Droid-Deck/Drivers](https://github.com/Droid-Deck/Drivers)). It also carries Icenowy Zheng's upstream
Zink fix that keeps the Imagination depth/stencil swizzle off colour views (Mesa d55418dae7).
Zink fix that keeps the Imagination depth/stencil swizzle off colour views (Mesa d55418dae7). A GLX fix stops `glXQueryDrawable` calling a NULL swap-interval hook on plain drisw screens (no kopper or DRI3), which crashed SDL3 clients such as steamwebhelper.
- The runtime's built-in Vulkan driver is DroidDeck's DD-Turnip Linux build (`DD_TURNIP_URL` and
`DD_TURNIP_SHA256` in `base.env`): Ubuntu's Turnip is diverted to `libvulkan_freedreno.so.distrib`
because it lacks the Adreno 8xx fixes. Zink, EGL and llvmpipe stay Ubuntu's.
@@ -0,0 +1,48 @@
From f48c22e082cd0ae2271f33581e7b43484ff9df3b Mon Sep 17 00:00:00 2001
From: pgm1207 <104554896+pgm1207@users.noreply.github.com>
Date: Wed, 18 Nov 2026 12:08:27 +0100
Subject: [PATCH] glx: don't call a NULL getSwapInterval in glXQueryDrawable
__glXGetDrawableAttribute() calls driScreen.getSwapInterval() for
GLX_SWAP_INTERVAL_EXT and GLX_LATE_SWAPS_TEAR_EXT without checking it.
The hook is only set by dri3_glx.c and by drisw_glx.c when kopper is in
use. On a plain drisw screen (LIBGL_KOPPER_DISABLE=true, or an X server
without DRI3) it is NULL, so a client that queries the swap interval,
such as SDL3, crashes with a jump to address 0.
glXGetSwapIntervalEXT() already checks the hook and returns 0 when it is
missing. Do the same here: report an interval of 0 and no late swap
tearing. GLX_MAX_SWAP_INTERVAL_EXT already reads as 0 on such screens.
Cc: mesa-stable
Signed-off-by: pgm1207 <104554896+pgm1207@users.noreply.github.com>
---
src/glx/glx_pbuffer.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/src/glx/glx_pbuffer.c b/src/glx/glx_pbuffer.c
index 8c09d4b..9ecee6a 100644
--- a/src/glx/glx_pbuffer.c
+++ b/src/glx/glx_pbuffer.c
@@ -313,13 +313,16 @@ __glXQueryDrawable(Display * dpy, GLXDrawable drawable,
if (pdraw) {
if (attribute == GLX_SWAP_INTERVAL_EXT) {
- *value = abs(pdraw->psc->driScreen.getSwapInterval(pdraw));
+ /* Only DRI3 and kopper set the hook; a plain drisw screen has none. */
+ *value = pdraw->psc->driScreen.getSwapInterval ?
+ abs(pdraw->psc->driScreen.getSwapInterval(pdraw)) : 0;
return 1;
} else if (attribute == GLX_MAX_SWAP_INTERVAL_EXT) {
*value = pdraw->psc->driScreen.maxSwapInterval;
return 1;
} else if (attribute == GLX_LATE_SWAPS_TEAR_EXT) {
- *value = pdraw->psc->driScreen.getSwapInterval(pdraw) < 0;
+ *value = pdraw->psc->driScreen.getSwapInterval ?
+ pdraw->psc->driScreen.getSwapInterval(pdraw) < 0 : 0;
return 1;
}
}
--
2.56.1