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@collabora.com>
Closes: #2407
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6295>
This commit is contained in:
Alyssa Rosenzweig
2021-05-11 15:39:21 -04:00
committed by Marge Bot
parent c8161bf05d
commit ac5ba2dfad

View File

@@ -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