From 708f57e681f264b5f8982d95575942362cbc53a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Ol=C5=A1=C3=A1k?= Date: Fri, 12 Apr 2024 17:50:39 -0400 Subject: [PATCH] radeonsi: don't use si_get_flush_flags() for flushing images si_make_{CB/DB}_shader_coherent are more correct. Reviewed-by: Pierre-Eric Pelloux-Prayer Part-of: --- src/gallium/drivers/radeonsi/si_clear.c | 13 +++++++++---- src/gallium/drivers/radeonsi/si_pipe.h | 1 + src/gallium/drivers/radeonsi/si_state.c | 4 ++++ 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/src/gallium/drivers/radeonsi/si_clear.c b/src/gallium/drivers/radeonsi/si_clear.c index 3d163ddc1ea..77c33359e42 100644 --- a/src/gallium/drivers/radeonsi/si_clear.c +++ b/src/gallium/drivers/radeonsi/si_clear.c @@ -54,11 +54,16 @@ void si_execute_clears(struct si_context *sctx, struct si_clear_info *info, return; /* Flush caches and wait for idle. */ - if (types & (SI_CLEAR_TYPE_CMASK | SI_CLEAR_TYPE_DCC)) - sctx->flags |= si_get_flush_flags(sctx, SI_COHERENCY_CB_META, L2_LRU); + if (types & (SI_CLEAR_TYPE_CMASK | SI_CLEAR_TYPE_DCC)) { + si_make_CB_shader_coherent(sctx, sctx->framebuffer.nr_samples, + sctx->framebuffer.CB_has_shader_readable_metadata, + sctx->framebuffer.all_DCC_pipe_aligned); + } - if (types & SI_CLEAR_TYPE_HTILE) - sctx->flags |= si_get_flush_flags(sctx, SI_COHERENCY_DB_META, L2_LRU); + if (types & SI_CLEAR_TYPE_HTILE) { + si_make_DB_shader_coherent(sctx, sctx->framebuffer.nr_samples, sctx->framebuffer.has_stencil, + sctx->framebuffer.DB_has_shader_readable_metadata); + } /* Flush caches in case we use compute. */ sctx->flags |= SI_CONTEXT_INV_VCACHE; diff --git a/src/gallium/drivers/radeonsi/si_pipe.h b/src/gallium/drivers/radeonsi/si_pipe.h index 3745f134f26..d8c8caca8b3 100644 --- a/src/gallium/drivers/radeonsi/si_pipe.h +++ b/src/gallium/drivers/radeonsi/si_pipe.h @@ -804,6 +804,7 @@ struct si_framebuffer { bool all_DCC_pipe_aligned; bool has_dcc_msaa; bool disable_vrs_flat_shading; + bool has_stencil; }; enum si_quant_mode diff --git a/src/gallium/drivers/radeonsi/si_state.c b/src/gallium/drivers/radeonsi/si_state.c index 94660d19883..41566e2df58 100644 --- a/src/gallium/drivers/radeonsi/si_state.c +++ b/src/gallium/drivers/radeonsi/si_state.c @@ -3133,6 +3133,7 @@ static void si_set_framebuffer_state(struct pipe_context *ctx, sctx->framebuffer.has_dcc_msaa = false; sctx->framebuffer.min_bytes_per_pixel = 0; sctx->framebuffer.disable_vrs_flat_shading = false; + sctx->framebuffer.has_stencil = false; for (i = 0; i < state->nr_cbufs; i++) { if (!state->cbufs[i]) @@ -3223,6 +3224,9 @@ static void si_set_framebuffer_state(struct pipe_context *ctx, if (sctx->queued.named.rasterizer->uses_poly_offset && surf->db_format_index != old_db_format_index) (sctx)->dirty_atoms |= SI_STATE_BIT(rasterizer); + + if (util_format_has_stencil(util_format_description(zstex->buffer.b.b.format))) + sctx->framebuffer.has_stencil = true; } si_update_ps_colorbuf0_slot(sctx);