Commit 7eb1aab1 authored by Marius Vlad's avatar Marius Vlad

egl/wayland: Verify that the currrent buffer to exchange is

still valid in case the window has been resized

Doing a window resize before having a chance to flip current with back
buffer will result in a protocol error due to (re)-using the older buffer
while the server has already acknowledged for the newer window size.
Signed-off-by: Marius Vlad's avatarMarius Vlad <marius.vlad@collabora.com>
parent 9466e4cf
......@@ -1740,6 +1740,7 @@ static void
dri2_wl_swrast_commit_backbuffer(struct dri2_egl_surface *dri2_surf)
{
struct dri2_egl_display *dri2_dpy = dri2_egl_display(dri2_surf->base.Resource.Display);
void *tmp_cur;
while (dri2_surf->throttle_callback != NULL)
if (wl_display_dispatch_queue(dri2_dpy->wl_dpy,
......@@ -1753,8 +1754,19 @@ dri2_wl_swrast_commit_backbuffer(struct dri2_egl_surface *dri2_surf)
&throttle_listener, dri2_surf);
}
dri2_surf->current = dri2_surf->back;
tmp_cur = dri2_surf->back;
dri2_surf->back = NULL;
/* buffer size modifications could happen before swrast_update_buffers() has
* a chance to detect it so call it before exchanging current with the older
* buffer. Avoids wayland protocol error when resizing before calling swapbuffer.
* Note that swrast doesn't have the resize_callback() being set-up */
if (dri2_surf->base.Width != dri2_surf->wl_win->width ||
dri2_surf->base.Height != dri2_surf->wl_win->height) {
swrast_update_buffers(dri2_surf);
dri2_surf->current = dri2_surf->back;
} else {
dri2_surf->current = tmp_cur;
}
wl_surface_attach(dri2_surf->wl_surface_wrapper,
dri2_surf->current->wl_buffer,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment