[PATCH xserver] xwayland: check pixmap size on present flip

Olivier Fourdan ofourdan at redhat.com
Fri Jun 8 13:42:24 UTC 2018


If the pixmap size does not match the present box size, flickering
occurs.

This can happen when the client changes its size (e.g. switching to
fullscreen), and since the buffer is kept as long as the pixmap is
valid, once the buffer is created, it remains at the wrong (old) size
and causes continuous flickering.

Check that the pixmap size and present box size match in
xwl_present_flip() and return FALSE otherwise, so that we skip the
pixmap with the wrong size.

Bugzilla: https://bugs.freedesktop.org/106841
Signed-off-by: Olivier Fourdan <ofourdan at redhat.com>
---
 hw/xwayland/xwayland-present.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/hw/xwayland/xwayland-present.c b/hw/xwayland/xwayland-present.c
index 4db0d1efc..4f1d1d1c5 100644
--- a/hw/xwayland/xwayland-present.c
+++ b/hw/xwayland/xwayland-present.c
@@ -451,6 +451,11 @@ xwl_present_flip(WindowPtr present_window,
     present_box = RegionExtents(&present_window->winSize);
     damage_box = RegionExtents(damage);
 
+    /* Size mismatch */
+    if (pixmap->drawable.width != present_box->x2 - present_box->x1 ||
+        pixmap->drawable.height != present_box->y2 - present_box->y1)
+        return FALSE;
+
     event = malloc(sizeof *event);
     if (!event)
         return FALSE;
-- 
2.17.1



More information about the xorg-devel mailing list