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.pitoi...@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 a47f43958c..3aee0f4fc8 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 04470e65cf..434bc0aa67 100644
--- a/src/gallium/drivers/radeonsi/si_pipe.h
+++ b/src/gallium/drivers/radeonsi/si_pipe.h
@@ -404,6 +404,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 ae7c91f475..6cf3559148 100644
--- a/src/gallium/drivers/radeonsi/si_state.c
+++ b/src/gallium/drivers/radeonsi/si_state.c
@@ -2608,9 +2608,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

_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to