From 720ff76de4287bd09860a77b4634bad4e89d3ad4 Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Thu, 24 Nov 2022 11:15:44 -0500 Subject: [PATCH] asahi: Implement invalidate_resource From Panfrost. This lets us avoid storing depth/stencil attachments at the end of the frame in GLES. On my 4K monitor, glmark2 -btexture at fullscreen goes from 705fps to 1150fps. I assume gains on real workloads will be smaller. Signed-off-by: Alyssa Rosenzweig Part-of: --- src/gallium/drivers/asahi/agx_pipe.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/gallium/drivers/asahi/agx_pipe.c b/src/gallium/drivers/asahi/agx_pipe.c index 5758f062cad..684464acea7 100644 --- a/src/gallium/drivers/asahi/agx_pipe.c +++ b/src/gallium/drivers/asahi/agx_pipe.c @@ -1117,9 +1117,22 @@ agx_destroy_context(struct pipe_context *pctx) } static void -agx_invalidate_resource(struct pipe_context *ctx, +agx_invalidate_resource(struct pipe_context *pctx, struct pipe_resource *resource) { + struct agx_context *ctx = agx_context(pctx); + struct agx_batch *batch = agx_get_batch(ctx); + + /* Handle the glInvalidateFramebuffer case */ + if (batch->key.zsbuf && batch->key.zsbuf->texture == resource) + batch->resolve &= ~PIPE_CLEAR_DEPTHSTENCIL; + + for (unsigned i = 0; i < batch->key.nr_cbufs; ++i) { + struct pipe_surface *surf = batch->key.cbufs[i]; + + if (surf && surf->texture == resource) + batch->resolve &= ~(PIPE_CLEAR_COLOR0 << i); + } } static struct pipe_context *