xserver: Branch 'master' - 2 commits

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed Apr 26 07:56:24 UTC 2023


 hw/xwayland/xwayland-window.c |   82 ++++++++++++++++++++++++------------------
 1 file changed, 47 insertions(+), 35 deletions(-)

New commits:
commit 9a55c402aa803fb10e39ab4fd18a709d0cd06fd4
Author: Jonas Ådahl <jadahl at gmail.com>
Date:   Fri Mar 31 16:01:20 2023 +0200

    xwayland/window: Queue damage after commits are allowed
    
    Compositors may use XWAYLAND_ALLOW_COMMITS to communicate when Xwayland
    may or may not commit new buffers to a wl_surface. If commits are
    denied, then later allowed, we'll only get a buffer attached if there is
    actual damage posted, which might be long after.
    
    This fixes an issue where the window manager would reparent a window
    while denying commits, then after reparenting, allow commits. The window
    in question belonged to a game and took several seconds produce the next
    frame, resulting in an empty window appearing as if it had just
    disappeared.
    
    Signed-off-by: Jonas Ådahl <jadahl at gmail.com>

diff --git a/hw/xwayland/xwayland-window.c b/hw/xwayland/xwayland-window.c
index b7574eeb5..67485d1d3 100644
--- a/hw/xwayland/xwayland-window.c
+++ b/hw/xwayland/xwayland-window.c
@@ -106,9 +106,21 @@ static void
 xwl_window_set_allow_commits(struct xwl_window *xwl_window, Bool allow,
                              const char *debug_msg)
 {
+    struct xwl_screen *xwl_screen = xwl_window->xwl_screen;
+    DamagePtr damage;
+
     xwl_window->allow_commits = allow;
     DebugF("XWAYLAND: win %d allow_commits = %d (%s)\n",
            xwl_window->window->drawable.id, allow, debug_msg);
+
+    damage = window_get_damage(xwl_window->window);
+    if (allow &&
+        xorg_list_is_empty(&xwl_window->link_damage) &&
+        damage &&
+        RegionNotEmpty(DamageRegion(damage))) {
+        xorg_list_add(&xwl_window->link_damage,
+                      &xwl_screen->damage_window_list);
+    }
 }
 
 static void
commit 5ce96a2a733b0a6556e1512fd9a703ede6a7c959
Author: Jonas Ådahl <jadahl at gmail.com>
Date:   Wed Apr 26 09:37:23 2023 +0200

    xwayland/window: Move set-allow functions lower down
    
    This will make some helper functions in the same file usable without
    extra declarations.
    
    Signed-off-by: Jonas Ådahl <jadahl at gmail.com>

diff --git a/hw/xwayland/xwayland-window.c b/hw/xwayland/xwayland-window.c
index 6b7f38605..b7574eeb5 100644
--- a/hw/xwayland/xwayland-window.c
+++ b/hw/xwayland/xwayland-window.c
@@ -56,41 +56,6 @@ static DevPrivateKeyRec xwl_window_private_key;
 static DevPrivateKeyRec xwl_damage_private_key;
 static const char *xwl_surface_tag = "xwl-surface";
 
-static void
-xwl_window_set_allow_commits(struct xwl_window *xwl_window, Bool allow,
-                             const char *debug_msg)
-{
-    xwl_window->allow_commits = allow;
-    DebugF("XWAYLAND: win %d allow_commits = %d (%s)\n",
-           xwl_window->window->drawable.id, allow, debug_msg);
-}
-
-static void
-xwl_window_set_allow_commits_from_property(struct xwl_window *xwl_window,
-                                           PropertyPtr prop)
-{
-    static Bool warned = FALSE;
-    CARD32 *propdata;
-
-    if (prop->propertyName != xwl_window->xwl_screen->allow_commits_prop)
-        FatalError("Xwayland internal error: prop mismatch in %s.\n", __func__);
-
-    if (prop->type != XA_CARDINAL || prop->format != 32 || prop->size != 1) {
-        /* Not properly set, so fall back to safe and glitchy */
-        xwl_window_set_allow_commits(xwl_window, TRUE, "WM fault");
-
-        if (!warned) {
-            LogMessageVerb(X_WARNING, 0, "Window manager is misusing property %s.\n",
-                           NameForAtom(prop->propertyName));
-            warned = TRUE;
-        }
-        return;
-    }
-
-    propdata = prop->data;
-    xwl_window_set_allow_commits(xwl_window, !!propdata[0], "from property");
-}
-
 struct xwl_window *
 xwl_window_get(WindowPtr window)
 {
@@ -137,6 +102,41 @@ is_surface_from_xwl_window(struct wl_surface *surface)
     return wl_proxy_get_tag((struct wl_proxy *) surface) == &xwl_surface_tag;
 }
 
+static void
+xwl_window_set_allow_commits(struct xwl_window *xwl_window, Bool allow,
+                             const char *debug_msg)
+{
+    xwl_window->allow_commits = allow;
+    DebugF("XWAYLAND: win %d allow_commits = %d (%s)\n",
+           xwl_window->window->drawable.id, allow, debug_msg);
+}
+
+static void
+xwl_window_set_allow_commits_from_property(struct xwl_window *xwl_window,
+                                           PropertyPtr prop)
+{
+    static Bool warned = FALSE;
+    CARD32 *propdata;
+
+    if (prop->propertyName != xwl_window->xwl_screen->allow_commits_prop)
+        FatalError("Xwayland internal error: prop mismatch in %s.\n", __func__);
+
+    if (prop->type != XA_CARDINAL || prop->format != 32 || prop->size != 1) {
+        /* Not properly set, so fall back to safe and glitchy */
+        xwl_window_set_allow_commits(xwl_window, TRUE, "WM fault");
+
+        if (!warned) {
+            LogMessageVerb(X_WARNING, 0, "Window manager is misusing property %s.\n",
+                           NameForAtom(prop->propertyName));
+            warned = TRUE;
+        }
+        return;
+    }
+
+    propdata = prop->data;
+    xwl_window_set_allow_commits(xwl_window, !!propdata[0], "from property");
+}
+
 void
 xwl_window_update_property(struct xwl_window *xwl_window,
                            PropertyStateRec *propstate)


More information about the xorg-commit mailing list