xwayland/eglstream: Do not commit without surface

The EGL surface for the xwl_pixmap is created once the stream is ready
and valid.

If the pixmap's EGL surface fails, for whatever reason, the xwl_pixmap
will be unusable and will end up as an invalid wl_buffer.

Make sure we do not allow commits in that case and recreate the
xwl_pixmap/stream.

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Reviewed-by: Michel Dänzer <mdaenzer@redhat.com>
https://gitlab.freedesktop.org/xorg/xserver/-/issues/1156
This commit is contained in:
Olivier Fourdan 2021-04-19 18:11:19 +02:00
parent bee2ebb29f
commit 098e0f52c0
1 changed files with 8 additions and 1 deletions

View File

@ -670,7 +670,14 @@ xwl_glamor_eglstream_allow_commits(struct xwl_window *xwl_window)
return FALSE;
} else {
return TRUE;
if (xwl_pixmap->surface != EGL_NO_SURFACE)
return TRUE;
/* The pending stream got removed, we have a xwl_pixmap and
* yet we do not have a surface.
* So something went wrong with the surface creation, retry.
*/
xwl_eglstream_destroy_pixmap_stream(xwl_pixmap);
}
}