[Mesa-dev] [RFC PATCH 58/65] radeonsi: isolate real framebuffer changes from the decompression passes

Samuel Pitoiset samuel.pitoiset at gmail.com
Fri May 19 16:53:03 UTC 2017


When a stencil buffer is part of the framebuffer state, it is
decompressed but because it's bindles, all draw calls set
stencil_dirty_level_mask to 1.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>
---
 src/gallium/drivers/radeonsi/si_blit.c  |  8 ++++++++
 src/gallium/drivers/radeonsi/si_pipe.h  |  1 +
 src/gallium/drivers/radeonsi/si_state.c | 10 ++++++++--
 3 files changed, 17 insertions(+), 2 deletions(-)

diff --git a/src/gallium/drivers/radeonsi/si_blit.c b/src/gallium/drivers/radeonsi/si_blit.c
index 32041695e2..0cf3ea79b9 100644
--- a/src/gallium/drivers/radeonsi/si_blit.c
+++ b/src/gallium/drivers/radeonsi/si_blit.c
@@ -235,12 +235,16 @@ si_blit_decompress_zs_planes_in_place(struct si_context *sctx,
 
 			zsurf = sctx->b.b.create_surface(&sctx->b.b, &texture->resource.b.b, &surf_tmpl);
 
+			sctx->decompression_enabled = true;
+
 			si_blitter_begin(&sctx->b.b, SI_DECOMPRESS);
 			util_blitter_custom_depth_stencil(sctx->blitter, zsurf, NULL, ~0,
 							  sctx->custom_dsa_flush,
 							  1.0f);
 			si_blitter_end(&sctx->b.b);
 
+			sctx->decompression_enabled = false;
+
 			pipe_surface_reference(&zsurf, NULL);
 		}
 
@@ -454,10 +458,14 @@ static void si_blit_decompress_color(struct pipe_context *ctx,
 			surf_tmpl.u.tex.last_layer = layer;
 			cbsurf = ctx->create_surface(ctx, &rtex->resource.b.b, &surf_tmpl);
 
+			sctx->decompression_enabled = true;
+
 			si_blitter_begin(ctx, SI_DECOMPRESS);
 			util_blitter_custom_color(sctx->blitter, cbsurf, custom_blend);
 			si_blitter_end(ctx);
 
+			sctx->decompression_enabled = false;
+
 			pipe_surface_reference(&cbsurf, NULL);
 		}
 
diff --git a/src/gallium/drivers/radeonsi/si_pipe.h b/src/gallium/drivers/radeonsi/si_pipe.h
index 7dafa77c37..8d8efbda1f 100644
--- a/src/gallium/drivers/radeonsi/si_pipe.h
+++ b/src/gallium/drivers/radeonsi/si_pipe.h
@@ -402,6 +402,7 @@ struct si_context {
 
 	/* Other state */
 	bool need_check_render_feedback;
+	bool			decompression_enabled;
 
 	/* Precomputed IA_MULTI_VGT_PARAM */
 	union si_vgt_param_key  ia_multi_vgt_param_key;
diff --git a/src/gallium/drivers/radeonsi/si_state.c b/src/gallium/drivers/radeonsi/si_state.c
index 363f32170a..7256ec0c62 100644
--- a/src/gallium/drivers/radeonsi/si_state.c
+++ b/src/gallium/drivers/radeonsi/si_state.c
@@ -2611,9 +2611,15 @@ static void si_set_framebuffer_state(struct pipe_context *ctx,
 		si_mark_atom_dirty(sctx, &sctx->msaa_sample_locs.atom);
 	}
 
-	sctx->need_check_render_feedback = true;
 	sctx->do_update_shaders = true;
-	sctx->framebuffer.do_update_surf_dirtiness = true;
+
+	if (!sctx->decompression_enabled) {
+		/* Prevent textures decompression when the framebuffer state
+		 * changes come from the decompression passes themselves.
+		 */
+		sctx->need_check_render_feedback = true;
+		sctx->framebuffer.do_update_surf_dirtiness = true;
+	}
 }
 
 static void si_emit_framebuffer_state(struct si_context *sctx, struct r600_atom *atom)
-- 
2.13.0



More information about the mesa-dev mailing list