Mesa (master): freedreno: Fix spurious flush

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue Nov 10 18:27:28 UTC 2020


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

Author: Rob Clark <robdclark at chromium.org>
Date:   Thu Oct 22 14:43:35 2020 -0700

freedreno: Fix spurious flush

Signed-off-by: Rob Clark <robdclark at chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7342>

---

 src/gallium/drivers/freedreno/freedreno_state.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/src/gallium/drivers/freedreno/freedreno_state.c b/src/gallium/drivers/freedreno/freedreno_state.c
index 9e1c1a1776c..5a3df1f3fd1 100644
--- a/src/gallium/drivers/freedreno/freedreno_state.c
+++ b/src/gallium/drivers/freedreno/freedreno_state.c
@@ -220,13 +220,20 @@ fd_set_framebuffer_state(struct pipe_context *pctx,
 		framebuffer->width, framebuffer->height,
 		framebuffer->layers, framebuffer->samples);
 
-	fd_context_switch_from(ctx);
-
 	cso = &ctx->framebuffer;
 
 	if (util_framebuffer_state_equal(cso, framebuffer))
 		return;
 
+	/* Do this *after* checking that the framebuffer state is actually
+	 * changing.  In the fd_blitter_clear() path, we get a pfb update
+	 * to restore the current pfb state, which should not trigger us
+	 * to flush (as that can cause the batch to be freed at a point
+	 * before fd_clear() returns, but after the point where it expects
+	 * flushes to potentially happen.
+	 */
+	fd_context_switch_from(ctx);
+
 	util_copy_framebuffer_state(cso, framebuffer);
 
 	cso->samples = util_framebuffer_get_num_samples(cso);



More information about the mesa-commit mailing list