xwayland/eglstream: Check eglSwapBuffers()

EGLstream's post_damage() would unconditionally return success
regardless of the actual status of the eglSwapBuffers().

Yet, if eglSwapBuffers() fails, we should not post the corresponding
damage as they wouldn't match the actual content of the buffer.

Use the eglSwapBuffers() return value as the return value for
post_damage() and do not take a refrence on the pixmap if it fails.

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Reviewed-by: Michel Dänzer <mdaenzer@redhat.com>
This commit is contained in:
Olivier Fourdan 2021-04-30 09:02:29 +02:00
parent a457999710
commit b583395cd3

View File

@ -750,14 +750,20 @@ xwl_glamor_eglstream_post_damage(struct xwl_window *xwl_window,
glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
if (xwl_eglstream->have_egl_damage)
eglSwapBuffersWithDamageKHR(xwl_screen->egl_display,
xwl_pixmap->surface, egl_damage, 1);
status = eglSwapBuffersWithDamageKHR(xwl_screen->egl_display,
xwl_pixmap->surface,
egl_damage, 1);
else
eglSwapBuffers(xwl_screen->egl_display, xwl_pixmap->surface);
status = eglSwapBuffers(xwl_screen->egl_display,
xwl_pixmap->surface);
if (!status) {
ErrorF("eglstream: buffer swap failed, not posting damage\n");
goto out;
}
/* hang onto the pixmap until the compositor has released it */
pixmap->refcnt++;
status = TRUE;
out:
/* Restore previous state */