From 2d7ea1895ed6644613ffa6f68ef458642c28be7d Mon Sep 17 00:00:00 2001 From: Lucas Stach Date: Fri, 25 Nov 2022 20:26:10 +0100 Subject: [PATCH] etnaviv: add cleared surfaces to context flush set when necessary A RS/BLT clear might only clear the TS buffer, so the cleared resources need to be added to the context flush set when they aren't explicitly flushed in order to make the effect of the clear visible in the resource on context flush. Signed-off-by: Lucas Stach Reviewed-by: Philipp Zabel Part-of: --- src/gallium/drivers/etnaviv/etnaviv_blt.c | 5 +++++ src/gallium/drivers/etnaviv/etnaviv_rs.c | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/src/gallium/drivers/etnaviv/etnaviv_blt.c b/src/gallium/drivers/etnaviv/etnaviv_blt.c index 286bc8e0211..23a38c129d9 100644 --- a/src/gallium/drivers/etnaviv/etnaviv_blt.c +++ b/src/gallium/drivers/etnaviv/etnaviv_blt.c @@ -365,8 +365,13 @@ etna_clear_blt(struct pipe_context *pctx, unsigned buffers, const struct pipe_sc if (buffers & PIPE_CLEAR_COLOR) { for (int idx = 0; idx < ctx->framebuffer_s.nr_cbufs; ++idx) { + struct etna_surface *surf = etna_surface(ctx->framebuffer_s.cbufs[idx]); + etna_blit_clear_color_blt(pctx, ctx->framebuffer_s.cbufs[idx], &color[idx]); + + if (!etna_resource(surf->prsc)->explicit_flush) + etna_context_add_flush_resource(ctx, surf->prsc); } } diff --git a/src/gallium/drivers/etnaviv/etnaviv_rs.c b/src/gallium/drivers/etnaviv/etnaviv_rs.c index 0d9b222378b..83dc49fed98 100644 --- a/src/gallium/drivers/etnaviv/etnaviv_rs.c +++ b/src/gallium/drivers/etnaviv/etnaviv_rs.c @@ -461,8 +461,13 @@ etna_clear_rs(struct pipe_context *pctx, unsigned buffers, const struct pipe_sci */ if (buffers & PIPE_CLEAR_COLOR) { for (int idx = 0; idx < ctx->framebuffer_s.nr_cbufs; ++idx) { + struct etna_surface *surf = etna_surface(ctx->framebuffer_s.cbufs[idx]); + etna_blit_clear_color_rs(pctx, ctx->framebuffer_s.cbufs[idx], &color[idx]); + + if (!etna_resource(surf->prsc)->explicit_flush) + etna_context_add_flush_resource(ctx, surf->prsc); } }