From 3e1b40be54f1c2e0313a1b3f0193a84a52198417 Mon Sep 17 00:00:00 2001 From: Emma Anholt Date: Tue, 14 Feb 2023 14:48:32 -0800 Subject: [PATCH] egl: Add a note explaining the swapBuffers badness in dri2_x11_copy_buffers(). I tried to drop the swapBuffers path, but it turns out it's being taken by softpipe/llvmpipe, and the tests are passing. The piglit egl-copy-buffers test even passes on zink, but you end up with a bad display because of an un-preserved back buffer. Reviewed-by: Mike Blumenkrantz Part-of: --- src/egl/drivers/dri2/platform_x11.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/egl/drivers/dri2/platform_x11.c b/src/egl/drivers/dri2/platform_x11.c index 5c08a54..815464d 100644 --- a/src/egl/drivers/dri2/platform_x11.c +++ b/src/egl/drivers/dri2/platform_x11.c @@ -1034,8 +1034,15 @@ dri2_x11_copy_buffers(_EGLDisplay *disp, _EGLSurface *surf, void *native_pixmap_ if (dri2_dpy->flush) dri2_dpy->flush->flush(dri2_surf->dri_drawable); - else + else { + /* This should not be a swapBuffers, because it could present an + * incomplete frame, and it could invalidate the back buffer if it's not + * preserved. We really do want to flush. But it ends up working out + * okay-ish on swrast because those aren't invalidating the back buffer on + * swap. + */ dri2_dpy->core->swapBuffers(dri2_surf->dri_drawable); + } gc = xcb_generate_id(dri2_dpy->conn); xcb_create_gc(dri2_dpy->conn, gc, target, 0, NULL); -- 2.7.4