Mesa (main): panfrost: Implement framebuffer invalidation
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Wed May 12 13:00:39 UTC 2021
Module: Mesa
Branch: main
Commit: ac5ba2dfadb46edb260be631f128e264c1711237
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=ac5ba2dfadb46edb260be631f128e264c1711237
Author: Alyssa Rosenzweig <alyssa at collabora.com>
Date: Tue May 11 15:39:21 2021 -0400
panfrost: Implement framebuffer invalidation
The strategy is lifted from Freedreno. The trick is to remove buffers
from the resolve set, rather than add buffers to a discard set (as you
would naively try). The latter is wrong -- draws after the
glInvalidateFramebuffer() still need to be respected.
glmark2 -btexture on-screen with sway on Mali T860 from 1393fps to
1998fps
Signed-off-by: Alyssa Rosenzweig <alyssa at collabora.com>
Closes: #2407
Reviewed-by: Boris Brezillon <boris.brezillon at collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6295>
---
src/gallium/drivers/panfrost/pan_resource.c | 16 ++++++++++++++--
1 file changed, 14 insertions(+), 2 deletions(-)
diff --git a/src/gallium/drivers/panfrost/pan_resource.c b/src/gallium/drivers/panfrost/pan_resource.c
index 8f0155adf73..f43b5f864d3 100644
--- a/src/gallium/drivers/panfrost/pan_resource.c
+++ b/src/gallium/drivers/panfrost/pan_resource.c
@@ -1193,9 +1193,21 @@ panfrost_ptr_flush_region(struct pipe_context *pctx,
}
static void
-panfrost_invalidate_resource(struct pipe_context *pctx, struct pipe_resource *prsc)
+panfrost_invalidate_resource(struct pipe_context *pctx, struct pipe_resource *prsrc)
{
- /* TODO */
+ struct panfrost_context *ctx = pan_context(pctx);
+ struct panfrost_batch *batch = panfrost_get_batch_for_fbo(ctx);
+
+ /* Handle the glInvalidateFramebuffer case */
+ if (batch->key.zsbuf && batch->key.zsbuf->texture == prsrc)
+ 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 == prsrc)
+ batch->resolve &= ~(PIPE_CLEAR_COLOR0 << i);
+ }
}
static enum pipe_format
More information about the mesa-commit
mailing list