Mesa (main): radeonsi: prevent recursion in si_decompress_dcc

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Fri Jun 10 18:03:37 UTC 2022


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

Author: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer at amd.com>
Date:   Fri Jun 10 11:57:20 2022 +0200

radeonsi: prevent recursion in si_decompress_dcc

This avoids u_blitter recursion:

 #0  util_blitter_set_running_flag
 #1  util_blitter_custom_color
 #2  si_blit_decompress_color
 #3  si_decompress_dcc
 #4  si_texture_disable_dcc
 #5  si_update_ps_colorbuf0_slot
 #6  si_bind_ps_shader
 #7  util_blitter_restore_fragment_states
 #8  util_blitter_custom_color
 #9  si_blit_decompress_color
 #10 si_decompress_dcc
 #11 si_sdma_copy_image
 #12 si_blit

cc: mesa-stable

Reviewed-by: Marek Olšák <marek.olsak at amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16962>

---

 src/gallium/drivers/radeonsi/si_blit.c | 5 ++++-
 src/gallium/drivers/radeonsi/si_pipe.h | 1 +
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/gallium/drivers/radeonsi/si_blit.c b/src/gallium/drivers/radeonsi/si_blit.c
index f46ffea7080..da5c35b2b0c 100644
--- a/src/gallium/drivers/radeonsi/si_blit.c
+++ b/src/gallium/drivers/radeonsi/si_blit.c
@@ -1355,9 +1355,11 @@ void si_decompress_dcc(struct si_context *sctx, struct si_texture *tex)
    /* If graphics is disabled, we can't decompress DCC, but it shouldn't
     * be compressed either. The caller should simply discard it.
     */
-   if (!tex->surface.meta_offset || !sctx->has_graphics)
+   if (!tex->surface.meta_offset || !sctx->has_graphics || sctx->in_dcc_decompress)
       return;
 
+   sctx->in_dcc_decompress = true;
+
    if (sctx->gfx_level == GFX8 || tex->buffer.b.b.nr_storage_samples >= 2) {
       si_blit_decompress_color(sctx, tex, 0, tex->buffer.b.b.last_level, 0,
                                util_max_layer(&tex->buffer.b.b, 0), true, false);
@@ -1399,6 +1401,7 @@ void si_decompress_dcc(struct si_context *sctx, struct si_texture *tex)
        */
       sctx->flags |= SI_CONTEXT_WB_L2 | SI_CONTEXT_INV_L2_METADATA;
    }
+   sctx->in_dcc_decompress = false;
 }
 
 void si_init_blit_functions(struct si_context *sctx)
diff --git a/src/gallium/drivers/radeonsi/si_pipe.h b/src/gallium/drivers/radeonsi/si_pipe.h
index 0ac1211e22c..ddc5452ceb0 100644
--- a/src/gallium/drivers/radeonsi/si_pipe.h
+++ b/src/gallium/drivers/radeonsi/si_pipe.h
@@ -1003,6 +1003,7 @@ struct si_context {
 
    bool blitter_running;
    bool in_update_ps_colorbuf0_slot;
+   bool in_dcc_decompress;
    bool is_noop:1;
    bool has_graphics:1;
    bool gfx_flush_in_progress : 1;



More information about the mesa-commit mailing list