From 40b3479635f6cf476e8073744315c4334aa67107 Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Wed, 20 Aug 2025 11:13:06 -0400 Subject: [PATCH] glx/egl/kopper: explicitly pass __DRI2_FLUSH_CONTEXT when appropriate this avoids unnecessary st flushing Reviewed-by: Adam Jackson Part-of: --- src/egl/drivers/dri2/platform_wayland.c | 4 ++-- src/egl/drivers/dri2/platform_x11.c | 4 ++-- src/gallium/frontends/dri/kopper.c | 2 +- src/glx/drisw_glx.c | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/egl/drivers/dri2/platform_wayland.c b/src/egl/drivers/dri2/platform_wayland.c index f478a89a6d3..70e2f11b844 100644 --- a/src/egl/drivers/dri2/platform_wayland.c +++ b/src/egl/drivers/dri2/platform_wayland.c @@ -2310,9 +2310,9 @@ dri2_wl_kopper_swap_buffers_with_damage(_EGLDisplay *disp, _EGLSurface *draw, return EGL_FALSE; if (n_rects) { - kopperSwapBuffersWithDamage(dri2_surf->dri_drawable, __DRI2_FLUSH_INVALIDATE_ANCILLARY, n_rects, rects); + kopperSwapBuffersWithDamage(dri2_surf->dri_drawable, __DRI2_FLUSH_CONTEXT | __DRI2_FLUSH_INVALIDATE_ANCILLARY, n_rects, rects); } else { - kopperSwapBuffers(dri2_surf->dri_drawable, __DRI2_FLUSH_INVALIDATE_ANCILLARY); + kopperSwapBuffers(dri2_surf->dri_drawable, __DRI2_FLUSH_CONTEXT | __DRI2_FLUSH_INVALIDATE_ANCILLARY); } dri2_surf->current = dri2_surf->back; diff --git a/src/egl/drivers/dri2/platform_x11.c b/src/egl/drivers/dri2/platform_x11.c index 3854e573f29..28acf735fa9 100644 --- a/src/egl/drivers/dri2/platform_x11.c +++ b/src/egl/drivers/dri2/platform_x11.c @@ -705,9 +705,9 @@ dri2_x11_kopper_swap_buffers_with_damage(_EGLDisplay *disp, _EGLSurface *draw, /* swrast path unsupported for now */ if (numRects) - kopperSwapBuffersWithDamage(dri2_surf->dri_drawable, __DRI2_FLUSH_INVALIDATE_ANCILLARY, numRects, rects); + kopperSwapBuffersWithDamage(dri2_surf->dri_drawable, __DRI2_FLUSH_CONTEXT | __DRI2_FLUSH_INVALIDATE_ANCILLARY, numRects, rects); else - kopperSwapBuffers(dri2_surf->dri_drawable, __DRI2_FLUSH_INVALIDATE_ANCILLARY); + kopperSwapBuffers(dri2_surf->dri_drawable, __DRI2_FLUSH_CONTEXT | __DRI2_FLUSH_INVALIDATE_ANCILLARY); /* If the X11 window has been resized, vkQueuePresentKHR() or * vkAcquireNextImageKHR() may return VK_ERROR_SURFACE_LOST or diff --git a/src/gallium/frontends/dri/kopper.c b/src/gallium/frontends/dri/kopper.c index 81ace338ca5..b2cbaa4aac1 100644 --- a/src/gallium/frontends/dri/kopper.c +++ b/src/gallium/frontends/dri/kopper.c @@ -536,7 +536,7 @@ kopperSwapBuffersWithDamage(struct dri_drawable *drawable, uint32_t flush_flags, drawable->texture_stamp = drawable->lastStamp - 1; dri_flush(ctx, drawable, - __DRI2_FLUSH_DRAWABLE | __DRI2_FLUSH_CONTEXT | flush_flags, + __DRI2_FLUSH_DRAWABLE | flush_flags, __DRI2_THROTTLE_SWAPBUFFER); struct pipe_box stack_boxes[64]; diff --git a/src/glx/drisw_glx.c b/src/glx/drisw_glx.c index a5b35e73753..6f79d8f46e1 100644 --- a/src/glx/drisw_glx.c +++ b/src/glx/drisw_glx.c @@ -563,7 +563,7 @@ driswSwapBuffers(__GLXDRIdrawable * pdraw, } if (psc->kopper) - return kopperSwapBuffers(pdraw->dri_drawable, 0); + return kopperSwapBuffers(pdraw->dri_drawable, flush ? __DRI2_FLUSH_CONTEXT : 0); driSwapBuffers(pdraw->dri_drawable);