summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEmma Anholt <emma@anholt.net>2023-02-14 10:32:57 -0800
committerMarge Bot <emma+marge@anholt.net>2023-02-15 19:17:07 +0000
commit6de8b9a65b9b3b06836ddba05ddd3b4a58c674ab (patch)
tree8631d6081b1a10ca79ee20412dee21bfba6c1871
parent53780b7a3acd5b080cafa11ff3e974de99d6198c (diff)
egl/kopper: Pass ancillary invalidate flush flags down to gallium.
We can just add the flags to the kopper interface, since it's private to Mesa. This gets us depth/stencil invalidation on swapbuffers, which is critical for tiler performance. glmark2-es2 -b texture (windowed) goes from 1650 to 1930 fps on zink+turnip with ZINK_DEBUG=rp. Part of #7321 (we're still a little behind freedreno's 2180 fps) Reviewed-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com> Reviewed-by: Adam Jackson <ajax@redhat.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21317>
-rw-r--r--include/kopper_interface.h3
-rw-r--r--src/egl/drivers/dri2/platform_x11.c7
-rw-r--r--src/gallium/frontends/dri/kopper.c6
-rw-r--r--src/glx/drisw_glx.c2
4 files changed, 12 insertions, 6 deletions
diff --git a/include/kopper_interface.h b/include/kopper_interface.h
index 3db53e8d52c..261d1222ec8 100644
--- a/include/kopper_interface.h
+++ b/include/kopper_interface.h
@@ -61,7 +61,8 @@ struct __DRIkopperExtensionRec {
const __DRIconfig *config,
void *loaderPrivate,
int pixmap);
- int64_t (*swapBuffers)(__DRIdrawable *draw);
+ /* flags is a set of __DRI2_FLUSH_* flags */
+ int64_t (*swapBuffers)(__DRIdrawable *draw, uint32_t flush_flags);
void (*setSwapInterval)(__DRIdrawable *drawable, int interval);
int (*queryBufferAge)(__DRIdrawable *drawable);
};
diff --git a/src/egl/drivers/dri2/platform_x11.c b/src/egl/drivers/dri2/platform_x11.c
index 1dc2c1fef7a..a362ccef52b 100644
--- a/src/egl/drivers/dri2/platform_x11.c
+++ b/src/egl/drivers/dri2/platform_x11.c
@@ -953,7 +953,12 @@ dri2_x11_swap_buffers(_EGLDisplay *disp, _EGLSurface *draw)
struct dri2_egl_surface *dri2_surf = dri2_egl_surface(draw);
if (dri2_dpy->kopper) {
- dri2_dpy->kopper->swapBuffers(dri2_surf->dri_drawable);
+ /* From the EGL 1.4 spec (page 52):
+ *
+ * "The contents of ancillary buffers are always undefined
+ * after calling eglSwapBuffers."
+ */
+ dri2_dpy->kopper->swapBuffers(dri2_surf->dri_drawable, __DRI2_FLUSH_INVALIDATE_ANCILLARY);
return EGL_TRUE;
} else if (!dri2_dpy->flush) {
/* aka the swrast path, which does the swap in the gallium driver. */
diff --git a/src/gallium/frontends/dri/kopper.c b/src/gallium/frontends/dri/kopper.c
index 9e805697515..12141d42a4e 100644
--- a/src/gallium/frontends/dri/kopper.c
+++ b/src/gallium/frontends/dri/kopper.c
@@ -840,7 +840,7 @@ kopper_create_drawable(struct dri_screen *screen, const struct gl_config *visual
}
static int64_t
-kopperSwapBuffers(__DRIdrawable *dPriv)
+kopperSwapBuffers(__DRIdrawable *dPriv, uint32_t flush_flags)
{
struct dri_drawable *drawable = dri_drawable(dPriv);
struct dri_context *ctx = dri_get_current();
@@ -861,7 +861,7 @@ kopperSwapBuffers(__DRIdrawable *dPriv)
drawable->texture_stamp = drawable->lastStamp - 1;
dri_flush(opaque_dri_context(ctx), opaque_dri_drawable(drawable),
- __DRI2_FLUSH_DRAWABLE | __DRI2_FLUSH_CONTEXT,
+ __DRI2_FLUSH_DRAWABLE | __DRI2_FLUSH_CONTEXT | flush_flags,
__DRI2_THROTTLE_SWAPBUFFER);
kopper_copy_to_front(ctx->st->pipe, drawable, ptex);
@@ -881,7 +881,7 @@ kopperSwapBuffers(__DRIdrawable *dPriv)
static void
kopper_swap_buffers(struct dri_drawable *drawable)
{
- kopperSwapBuffers(opaque_dri_drawable(drawable));
+ kopperSwapBuffers(opaque_dri_drawable(drawable), 0);
}
static __DRIdrawable *
diff --git a/src/glx/drisw_glx.c b/src/glx/drisw_glx.c
index 0e41f8560a9..b69eb7c84a1 100644
--- a/src/glx/drisw_glx.c
+++ b/src/glx/drisw_glx.c
@@ -752,7 +752,7 @@ driswSwapBuffers(__GLXDRIdrawable * pdraw,
}
if (psc->kopper)
- return psc->kopper->swapBuffers (pdp->driDrawable);
+ return psc->kopper->swapBuffers (pdp->driDrawable, 0);
psc->core->swapBuffers(pdp->driDrawable);