xwayland: use pixmap size on present flip

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
Fixes: 0fb2cca193 "xwayland: Preliminary support for Present's new
                     window flip mode"
Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Roman Gilg <subdiff@gmail.com>
This commit is contained in:
Olivier Fourdan 2018-06-08 16:23:44 +02:00 committed by Michel Dänzer
parent 10eec2ccb1
commit 1993f147d0

View File

@ -440,7 +440,7 @@ xwl_present_flip(WindowPtr present_window,
{ {
struct xwl_window *xwl_window = xwl_window_from_window(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); struct xwl_present_window *xwl_present_window = xwl_present_window_priv(present_window);
BoxPtr present_box, damage_box; BoxPtr damage_box;
Bool buffer_created; Bool buffer_created;
struct wl_buffer *buffer; struct wl_buffer *buffer;
struct xwl_present_event *event; struct xwl_present_event *event;
@ -448,7 +448,6 @@ xwl_present_flip(WindowPtr present_window,
if (!xwl_window) if (!xwl_window)
return FALSE; return FALSE;
present_box = RegionExtents(&present_window->winSize);
damage_box = RegionExtents(damage); damage_box = RegionExtents(damage);
event = malloc(sizeof *event); event = malloc(sizeof *event);
@ -458,8 +457,8 @@ xwl_present_flip(WindowPtr present_window,
xwl_window->present_window = present_window; xwl_window->present_window = present_window;
buffer = xwl_glamor_pixmap_get_wl_buffer(pixmap, buffer = xwl_glamor_pixmap_get_wl_buffer(pixmap,
present_box->x2 - present_box->x1, pixmap->drawable.width,
present_box->y2 - present_box->y1, pixmap->drawable.height,
&buffer_created); &buffer_created);
event->event_id = event_id; event->event_id = event_id;