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.

Use the actual pixmap's drawable size instead of the present box to
create the buffer so that it's sized appropriately.

Bugzilla: https://bugs.freedesktop.org/106841
Signed-off-by: Olivier Fourdan <[email protected]>
Reviewed-by: Michel Dänzer <[email protected]>
---
 v2: Remove present_box, unused (thanks Michel)

 hw/xwayland/xwayland-present.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/hw/xwayland/xwayland-present.c b/hw/xwayland/xwayland-present.c
index 4db0d1efc..29014a300 100644
--- a/hw/xwayland/xwayland-present.c
+++ b/hw/xwayland/xwayland-present.c
@@ -440,7 +440,7 @@ xwl_present_flip(WindowPtr present_window,
 {
     struct xwl_window           *xwl_window = 
xwl_window_from_window(present_window);
     struct xwl_present_window   *xwl_present_window = 
xwl_present_window_priv(present_window);
-    BoxPtr                      present_box, damage_box;
+    BoxPtr                      damage_box;
     Bool                        buffer_created;
     struct wl_buffer            *buffer;
     struct xwl_present_event    *event;
@@ -448,7 +448,6 @@ xwl_present_flip(WindowPtr present_window,
     if (!xwl_window)
         return FALSE;
 
-    present_box = RegionExtents(&present_window->winSize);
     damage_box = RegionExtents(damage);
 
     event = malloc(sizeof *event);
@@ -458,8 +457,8 @@ xwl_present_flip(WindowPtr present_window,
     xwl_window->present_window = present_window;
 
     buffer = xwl_glamor_pixmap_get_wl_buffer(pixmap,
-                                             present_box->x2 - present_box->x1,
-                                             present_box->y2 - present_box->y1,
+                                             pixmap->drawable.width,
+                                             pixmap->drawable.height,
                                              &buffer_created);
 
     event->event_id = event_id;
-- 
2.17.1

_______________________________________________
[email protected]: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: https://lists.x.org/mailman/listinfo/xorg-devel

Reply via email to