[Mesa-dev] [PATCH 3/4] radeonsi: don't flush when si_eliminate_fast_color_clear is no-op

Marek Olšák maraeo at gmail.com
Tue Jan 30 15:48:41 UTC 2018


From: Marek Olšák <marek.olsak at amd.com>

---
 src/gallium/drivers/radeon/r600_texture.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/gallium/drivers/radeon/r600_texture.c b/src/gallium/drivers/radeon/r600_texture.c
index a0e9129..125e7ef 100644
--- a/src/gallium/drivers/radeon/r600_texture.c
+++ b/src/gallium/drivers/radeon/r600_texture.c
@@ -382,22 +382,26 @@ static void r600_surface_import_metadata(struct si_screen *sscreen,
 
 void si_eliminate_fast_color_clear(struct r600_common_context *rctx,
 				   struct r600_texture *rtex)
 {
 	struct si_screen *sscreen = rctx->screen;
 	struct pipe_context *ctx = &rctx->b;
 
 	if (ctx == sscreen->aux_context)
 		mtx_lock(&sscreen->aux_context_lock);
 
+	unsigned n = rctx->num_decompress_calls;
 	ctx->flush_resource(ctx, &rtex->resource.b.b);
-	ctx->flush(ctx, NULL, 0);
+
+	/* Flush only if any fast clear elimination took place. */
+	if (n != rctx->num_decompress_calls)
+		ctx->flush(ctx, NULL, 0);
 
 	if (ctx == sscreen->aux_context)
 		mtx_unlock(&sscreen->aux_context_lock);
 }
 
 void si_texture_discard_cmask(struct si_screen *sscreen,
 			      struct r600_texture *rtex)
 {
 	if (!rtex->cmask.size)
 		return;
-- 
2.7.4



More information about the mesa-dev mailing list