From 0ff37e7591dbe239edf1ccf9470e5d8a6201edcc Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Tue, 30 Jul 2024 09:37:36 -0400 Subject: [PATCH] egl: use a non-kms_swrast check for swapbuffers DRI2_FLUSH MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit only swrast (non-kms) doesn't support this Reviewed-by: Marek Olšák Part-of: --- src/egl/drivers/dri2/egl_dri2.c | 42 ++++++++++++++++----------------- 1 file changed, 20 insertions(+), 22 deletions(-) diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c index ca0ef83ec36..4414ab4a372 100644 --- a/src/egl/drivers/dri2/egl_dri2.c +++ b/src/egl/drivers/dri2/egl_dri2.c @@ -1706,29 +1706,27 @@ dri2_flush_drawable_for_swapbuffers_flags( struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp); __DRIdrawable *dri_drawable = dri2_dpy->vtbl->get_dri_drawable(draw); - if (dri2_dpy->flush) { - if (dri2_dpy->flush->base.version >= 4) { - /* We know there's a current context because: - * - * "If surface is not bound to the calling thread’s current - * context, an EGL_BAD_SURFACE error is generated." - */ - _EGLContext *ctx = _eglGetCurrentContext(); - struct dri2_egl_context *dri2_ctx = dri2_egl_context(ctx); + /* flush not available for swrast */ + if (dri2_dpy->swrast_not_kms) + return; - /* From the EGL 1.4 spec (page 52): - * - * "The contents of ancillary buffers are always undefined - * after calling eglSwapBuffers." - */ - dri2_dpy->flush->flush_with_flags( - dri2_ctx->dri_context, dri_drawable, - __DRI2_FLUSH_DRAWABLE | __DRI2_FLUSH_INVALIDATE_ANCILLARY, - throttle_reason); - } else { - dri2_dpy->flush->flush(dri_drawable); - } - } + /* We know there's a current context because: + * + * "If surface is not bound to the calling thread’s current + * context, an EGL_BAD_SURFACE error is generated." + */ + _EGLContext *ctx = _eglGetCurrentContext(); + struct dri2_egl_context *dri2_ctx = dri2_egl_context(ctx); + + /* From the EGL 1.4 spec (page 52): + * + * "The contents of ancillary buffers are always undefined + * after calling eglSwapBuffers." + */ + dri2_dpy->flush->flush_with_flags( + dri2_ctx->dri_context, dri_drawable, + __DRI2_FLUSH_DRAWABLE | __DRI2_FLUSH_INVALIDATE_ANCILLARY, + throttle_reason); } void