Skip to content

Commit

Permalink
radeonsi: prevent recursion in si_decompress_dcc
Browse files Browse the repository at this point in the history
This avoids u_blitter recursion:

 #0  util_blitter_set_running_flag
 android-rpi#1  util_blitter_custom_color
 android-rpi#2  si_blit_decompress_color
 android-rpi#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 <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16962>
(cherry picked from commit 3d37291)

Conflicts:
	src/gallium/drivers/radeonsi/si_blit.c
  • Loading branch information
peppsac authored and dcbaker-intel committed Jun 15, 2022
1 parent 791969d commit 0080232
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .pick_status.json
Original file line number Diff line number Diff line change
Expand Up @@ -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
},
Expand Down
5 changes: 4 additions & 1 deletion src/gallium/drivers/radeonsi/si_blit.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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)
Expand Down
1 change: 1 addition & 0 deletions src/gallium/drivers/radeonsi/si_pipe.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 0080232

Please sign in to comment.