From e5a3f3e84dbbc1484d56d9a64f14508a4bf8af19 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michel=20D=C3=A4nzer?= Date: Thu, 4 Jan 2024 16:14:17 +0100 Subject: [PATCH] glamor: Fall back for mixed depth 24/32 in glamor_set_alu For ALUs which may leave the alpha channel at values other than 1.0. Closes: https://gitlab.freedesktop.org/xorg/xserver/-/issues/1615 v2: * List safe ALUs instead of unsafe ones --- glamor/glamor_pixmap.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/glamor/glamor_pixmap.c b/glamor/glamor_pixmap.c index ed273ccbb..c573e7982 100644 --- a/glamor/glamor_pixmap.c +++ b/glamor/glamor_pixmap.c @@ -136,6 +136,21 @@ glamor_set_alu(DrawablePtr drawable, unsigned char alu) glDisable(GL_COLOR_LOGIC_OP); return TRUE; } + + switch (alu) { + case GXnoop: + case GXor: + case GXset: + /* These leave the alpha channel at 1.0 */ + break; + default: + if (glamor_drawable_effective_depth(drawable) == 24 && + glamor_get_drawable_pixmap(drawable)->drawable.depth == 32) { + glamor_fallback("ALU %x not supported with mixed depth\n", alu); + return FALSE; + } + } + glEnable(GL_COLOR_LOGIC_OP); switch (alu) { case GXclear: