* [PATCH] weston: backport gl-shaders fix to avoid shader compiler crashes
@ 2026-04-07 9:47 Mahesh Angadi
2026-04-09 8:38 ` [OE-core] " Mathieu Dubois-Briand
0 siblings, 1 reply; 2+ messages in thread
From: Mahesh Angadi @ 2026-04-07 9:47 UTC (permalink / raw)
To: openembedded-core; +Cc: Mahesh Angadi
Some GPU shader compilers do not optimize away unused YUV shader
uniforms, even when the associated code paths are unreachable. This can cause
Weston to hit assertion failures at runtime on non-Mesa platforms, despite
working correctly on Mesa-based drivers.
Backport the upstream gl-shaders fix to restore stable behavior across
GPU drivers.
Signed-off-by: Mahesh Angadi <mangadi@qti.qualcomm.com>
---
...e-asserts-relying-on-shader-compiler.patch | 47 +++++++++++++++++++
.../recipes-graphics/wayland/weston_15.0.0.bb | 1 +
2 files changed, 48 insertions(+)
create mode 100644 meta/recipes-graphics/wayland/weston/0001-gl-shaders-Remove-asserts-relying-on-shader-compiler.patch
diff --git a/meta/recipes-graphics/wayland/weston/0001-gl-shaders-Remove-asserts-relying-on-shader-compiler.patch b/meta/recipes-graphics/wayland/weston/0001-gl-shaders-Remove-asserts-relying-on-shader-compiler.patch
new file mode 100644
index 0000000000..4c9b740bd2
--- /dev/null
+++ b/meta/recipes-graphics/wayland/weston/0001-gl-shaders-Remove-asserts-relying-on-shader-compiler.patch
@@ -0,0 +1,47 @@
+From 5c49563ef49a502a6b8fae44f8778e109d32c2d9 Mon Sep 17 00:00:00 2001
+From: Robert Mader <robert.mader@collabora.com>
+Date: Mon, 2 Mar 2026 13:11:05 +0100
+Subject: [PATCH] gl-shaders: Remove asserts relying on shader compiler
+ behavior
+
+yuv_coefficients and yuv_offsets should get optimized away by shader
+compilers as the related code paths can never be reached. This seems to
+work well on Mesa but not necessarily with other drivers.
+
+While on it, assert that the uniforms *are* present, unless the
+yuv-to-rgb conversion is handled by the driver.
+
+Upstream-Status: Backport [https://gitlab.freedesktop.org/wayland/weston/-/commit/5c49563ef49a502a6b8fae44f8778e109d32c2d9]
+Signed-off-by: Robert Mader <robert.mader@collabora.com>
+---
+ libweston/renderer-gl/gl-shaders.c | 14 ++++++++++++--
+ 1 file changed, 12 insertions(+), 2 deletions(-)
+
+diff --git a/libweston/renderer-gl/gl-shaders.c b/libweston/renderer-gl/gl-shaders.c
+index 98041882..18eeedf6 100644
+--- a/libweston/renderer-gl/gl-shaders.c
++++ b/libweston/renderer-gl/gl-shaders.c
+@@ -762,8 +762,18 @@ gl_shader_load_config_representation(struct weston_compositor *compositor,
+
+ if (sconf->yuv_coefficients == WESTON_COLOR_MATRIX_COEF_UNSET ||
+ sconf->yuv_coefficients == WESTON_COLOR_MATRIX_COEF_IDENTITY) {
+- assert(shader->yuv_coefficients_uniform == -1);
+- assert(shader->yuv_offsets_uniform == -1);
++ /*
++ * In this case the yuv_coefficients and yuv_offsets uniforms
++ * should never be used and thus get optimized away by the
++ * shader compiler. Unfortunately on some drivers this is not
++ * the case, so we can't assert on it.
++ */
++ return;
++ }
++
++ if (shader->yuv_coefficients_uniform == -1 ||
++ shader->yuv_offsets_uniform == -1) {
++ assert(shader->key.variant == SHADER_VARIANT_EXTERNAL);
+ return;
+ }
+
+--
+2.34.1
+
diff --git a/meta/recipes-graphics/wayland/weston_15.0.0.bb b/meta/recipes-graphics/wayland/weston_15.0.0.bb
index b67f5f52dd..da347659f1 100644
--- a/meta/recipes-graphics/wayland/weston_15.0.0.bb
+++ b/meta/recipes-graphics/wayland/weston_15.0.0.bb
@@ -8,6 +8,7 @@ LIC_FILES_CHKSUM = "file://COPYING;md5=d79ee9e66bb0f95d3386a7acae780b70 \
SRC_URI = "https://gitlab.freedesktop.org/wayland/weston/-/releases/${PV}/downloads/${BPN}-${PV}.tar.xz \
file://0001-vulkan-renderer-guard-surface-output-creation-with-b.patch \
+ file://0001-gl-shaders-Remove-asserts-relying-on-shader-compiler.patch \
file://weston.png \
file://weston.desktop \
file://xwayland.weston-start \
--
2.34.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [OE-core] [PATCH] weston: backport gl-shaders fix to avoid shader compiler crashes
2026-04-07 9:47 [PATCH] weston: backport gl-shaders fix to avoid shader compiler crashes Mahesh Angadi
@ 2026-04-09 8:38 ` Mathieu Dubois-Briand
0 siblings, 0 replies; 2+ messages in thread
From: Mathieu Dubois-Briand @ 2026-04-09 8:38 UTC (permalink / raw)
To: mangadi, openembedded-core
On Tue Apr 7, 2026 at 11:47 AM CEST, Mahesh Angadi via lists.openembedded.org wrote:
> Some GPU shader compilers do not optimize away unused YUV shader
> uniforms, even when the associated code paths are unreachable. This can cause
> Weston to hit assertion failures at runtime on non-Mesa platforms, despite
> working correctly on Mesa-based drivers.
>
> Backport the upstream gl-shaders fix to restore stable behavior across
> GPU drivers.
>
> Signed-off-by: Mahesh Angadi <mangadi@qti.qualcomm.com>
> ---
Hi Mahesh,
I note this is breaking builds with meta-qcom, as the patch is also
present in there. But as you are the author of changes in both side, I
bet you already knew this. :)
https://autobuilder.yoctoproject.org/valkyrie/#/builders/113/builds/565
Thanks,
Mathieu
--
Mathieu Dubois-Briand, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-04-09 8:39 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-07 9:47 [PATCH] weston: backport gl-shaders fix to avoid shader compiler crashes Mahesh Angadi
2026-04-09 8:38 ` [OE-core] " Mathieu Dubois-Briand
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox