Mesa (master): freedreno: Move framebuffer state checks under a ctx->dirty flag.

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Mon Jan 25 23:18:24 UTC 2021


Module: Mesa
Branch: master
Commit: 49b83509fe8e4f26ebb9d0e15a0609a68e0c463f
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=49b83509fe8e4f26ebb9d0e15a0609a68e0c463f

Author: Eric Anholt <eric at anholt.net>
Date:   Fri Jan 22 10:38:09 2021 -0800

freedreno: Move framebuffer state checks under a ctx->dirty flag.

Anything changing this should have flagged FD_DIRTY_FRAMEBUFFER.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8602>

---

 src/gallium/drivers/freedreno/freedreno_draw.c | 29 +++++++++++++-------------
 1 file changed, 15 insertions(+), 14 deletions(-)

diff --git a/src/gallium/drivers/freedreno/freedreno_draw.c b/src/gallium/drivers/freedreno/freedreno_draw.c
index 61cbbf98a4a..01e07d899d2 100644
--- a/src/gallium/drivers/freedreno/freedreno_draw.c
+++ b/src/gallium/drivers/freedreno/freedreno_draw.c
@@ -105,25 +105,26 @@ batch_draw_tracking(struct fd_batch *batch, const struct pipe_draw_info *info,
 		}
 	}
 
+	if (ctx->dirty & FD_DIRTY_FRAMEBUFFER)  {
+		for (unsigned i = 0; i < pfb->nr_cbufs; i++) {
+			struct pipe_resource *surf;
 
-	for (unsigned i = 0; i < pfb->nr_cbufs; i++) {
-		struct pipe_resource *surf;
-
-		if (!pfb->cbufs[i])
-			continue;
+			if (!pfb->cbufs[i])
+				continue;
 
-		surf = pfb->cbufs[i]->texture;
+			surf = pfb->cbufs[i]->texture;
 
-		if (fd_resource(surf)->valid) {
-			restore_buffers |= PIPE_CLEAR_COLOR0 << i;
-		} else {
-			batch->invalidated |= PIPE_CLEAR_COLOR0 << i;
-		}
+			if (fd_resource(surf)->valid) {
+				restore_buffers |= PIPE_CLEAR_COLOR0 << i;
+			} else {
+				batch->invalidated |= PIPE_CLEAR_COLOR0 << i;
+			}
 
-		buffers |= PIPE_CLEAR_COLOR0 << i;
+			buffers |= PIPE_CLEAR_COLOR0 << i;
 
-		if (ctx->dirty & FD_DIRTY_FRAMEBUFFER)
-			resource_written(batch, pfb->cbufs[i]->texture);
+			if (ctx->dirty & FD_DIRTY_FRAMEBUFFER)
+				resource_written(batch, pfb->cbufs[i]->texture);
+		}
 	}
 
 	if (ctx->dirty & FD_DIRTY_BLEND) {



More information about the mesa-commit mailing list