xserver: Branch 'xwayland-23.2' - 2 commits

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue Sep 19 09:54:41 UTC 2023


 Xext/xtest.c           |    3 ++-
 glamor/glamor_priv.h   |    1 +
 glamor/glamor_render.c |   14 +++++++++++++-
 3 files changed, 16 insertions(+), 2 deletions(-)

New commits:
commit ad46baaa564166569577aa78488ac50544a59072
Author: Michel Dänzer <mdaenzer at redhat.com>
Date:   Tue Sep 12 16:57:16 2023 +0200

    glamor: Ignore destination alpha as necessary for composite operation
    
    If the destination drawable is a window with effective depth 24 backed
    by a depth 32 pixmap.
    
    Closes: https://gitlab.freedesktop.org/xorg/xserver/-/issues/1575
    (cherry picked from commit d1f142891ef346e90c36a7393009ffaac2aa8b38)

diff --git a/glamor/glamor_priv.h b/glamor/glamor_priv.h
index 898380d82..71aaeb8c2 100644
--- a/glamor/glamor_priv.h
+++ b/glamor/glamor_priv.h
@@ -111,6 +111,7 @@ enum shader_mask {
 enum shader_dest_swizzle {
     SHADER_DEST_SWIZZLE_DEFAULT,
     SHADER_DEST_SWIZZLE_ALPHA_TO_RED,
+    SHADER_DEST_SWIZZLE_IGNORE_ALPHA,
     SHADER_DEST_SWIZZLE_COUNT,
 };
 
diff --git a/glamor/glamor_render.c b/glamor/glamor_render.c
index ed1222621..0d233f27b 100644
--- a/glamor/glamor_render.c
+++ b/glamor/glamor_render.c
@@ -197,6 +197,11 @@ glamor_create_composite_fs(glamor_screen_private *glamor_priv, struct shader_key
         "	float undef;\n"
         "	return vec4(color.a, undef, undef, undef);"
         "}";
+    const char *dest_swizzle_ignore_alpha =
+        "vec4 dest_swizzle(vec4 color)\n"
+        "{"
+        "	return vec4(color.xyz, 1.0);"
+        "}";
 
     const char *in_normal =
         "void main()\n"
@@ -286,6 +291,9 @@ glamor_create_composite_fs(glamor_screen_private *glamor_priv, struct shader_key
     case SHADER_DEST_SWIZZLE_ALPHA_TO_RED:
         dest_swizzle = dest_swizzle_alpha_to_red;
         break;
+    case SHADER_DEST_SWIZZLE_IGNORE_ALPHA:
+        dest_swizzle = dest_swizzle_ignore_alpha;
+        break;
     default:
         FatalError("Bad composite shader dest swizzle");
     }
@@ -938,7 +946,11 @@ glamor_composite_choose_shader(CARD8 op,
         glamor_priv->formats[8].format == GL_RED) {
         key.dest_swizzle = SHADER_DEST_SWIZZLE_ALPHA_TO_RED;
     } else {
-        key.dest_swizzle = SHADER_DEST_SWIZZLE_DEFAULT;
+        if (dest_pixmap->drawable.depth == 32 &&
+            glamor_drawable_effective_depth(dest->pDrawable) == 24)
+            key.dest_swizzle = SHADER_DEST_SWIZZLE_IGNORE_ALPHA;
+        else
+            key.dest_swizzle = SHADER_DEST_SWIZZLE_DEFAULT;
     }
 
     if (source && source->alphaMap) {
commit 2ab53d5c9ac481339e0d3c821a85ca97e3d05781
Author: Olivier Fourdan <ofourdan at redhat.com>
Date:   Mon Sep 4 09:26:55 2023 +0200

    xtest: Check whether there is a sendEventsProc to call
    
    If a client tries to send XTEST events while there is no sendEventsProc
    defined for the given device, Xwayland would call into 0x0 and crash.
    
    Make sure the handler is defined before trying to use it, to avoid the
    crash.
    
    Signed-off-by: Olivier Fourdan <ofourdan at redhat.com>
    Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>
    Closes: https://gitlab.freedesktop.org/xorg/xserver/-/issues/1574
    (cherry picked from commit e820030de2da3d0064f36504ccad53302e0f718d)

diff --git a/Xext/xtest.c b/Xext/xtest.c
index 5cb9e1e73..4d2910a60 100644
--- a/Xext/xtest.c
+++ b/Xext/xtest.c
@@ -437,7 +437,8 @@ ProcXTestFakeInput(ClientPtr client)
 
     valuator_mask_set_range(&mask, firstValuator, numValuators, valuators);
 
-    (*dev->sendEventsProc) (dev, type, ev->u.u.detail, flags, &mask);
+    if (dev->sendEventsProc)
+        (*dev->sendEventsProc) (dev, type, ev->u.u.detail, flags, &mask);
 
     if (need_ptr_update)
         miPointerUpdateSprite(dev);


More information about the xorg-commit mailing list