From 0080232e6cf19aab177145b6cc2c275433c05a04 Mon Sep 17 00:00:00 2001 From: Pierre-Eric Pelloux-Prayer Date: Fri, 10 Jun 2022 11:57:20 +0200 Subject: [PATCH] radeonsi: prevent recursion in si_decompress_dcc MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Part-of: (cherry picked from commit 3d37291e1c1e2d9d0319bad9888f518a1bcfba04) Conflicts: src/gallium/drivers/radeonsi/si_blit.c --- .pick_status.json | 2 +- src/gallium/drivers/radeonsi/si_blit.c | 5 ++++- src/gallium/drivers/radeonsi/si_pipe.h | 1 + 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/.pick_status.json b/.pick_status.json index 713014d94c1d..3bf9d886cb1b 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -607,7 +607,7 @@ "description": "radeonsi: prevent recursion in si_decompress_dcc", "nominated": true, "nomination_type": 0, - "resolution": 0, + "resolution": 1, "main_sha": null, "because_sha": null }, diff --git a/src/gallium/drivers/radeonsi/si_blit.c b/src/gallium/drivers/radeonsi/si_blit.c index b17ea48abe6a..bf27fbeca76e 100644 --- a/src/gallium/drivers/radeonsi/si_blit.c +++ b/src/gallium/drivers/radeonsi/si_blit.c @@ -1367,9 +1367,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->chip_class == 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); @@ -1411,6 +1413,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 18ab5a7bd2a2..8365f0ca71c1 100644 --- a/src/gallium/drivers/radeonsi/si_pipe.h +++ b/src/gallium/drivers/radeonsi/si_pipe.h @@ -989,6 +989,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;