From dad0e0131b5482ce0df876d44898208f07364220 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Ol=C5=A1=C3=A1k?= Date: Fri, 23 Aug 2024 17:02:24 -0400 Subject: [PATCH] radeonsi: restructure fb_barrier code in si_launch_grid Reviewed-by: Pierre-Eric Pelloux-Prayer Part-of: --- src/gallium/drivers/radeonsi/si_compute.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/gallium/drivers/radeonsi/si_compute.c b/src/gallium/drivers/radeonsi/si_compute.c index 07ec0b099b1..33c1cb4e20c 100644 --- a/src/gallium/drivers/radeonsi/si_compute.c +++ b/src/gallium/drivers/radeonsi/si_compute.c @@ -1187,19 +1187,22 @@ static void si_launch_grid(struct pipe_context *ctx, const struct pipe_grid_info if (sctx->has_graphics) { if (sctx->num_draw_calls_sh_coherent.with_cb != sctx->num_draw_calls || sctx->num_draw_calls_sh_coherent.with_db != sctx->num_draw_calls) { + bool sync_cb = sctx->force_shader_coherency.with_cb || + si_check_needs_implicit_sync(sctx, RADEON_USAGE_CB_NEEDS_IMPLICIT_SYNC); + bool sync_db = sctx->gfx_level == GFX12 && + (sctx->force_shader_coherency.with_db || + si_check_needs_implicit_sync(sctx, RADEON_USAGE_DB_NEEDS_IMPLICIT_SYNC)); + si_fb_barrier_after_rendering(sctx); - if (sctx->force_shader_coherency.with_cb || - si_check_needs_implicit_sync(sctx, RADEON_USAGE_CB_NEEDS_IMPLICIT_SYNC)) { + if (sync_cb) { sctx->num_draw_calls_sh_coherent.with_cb = sctx->num_draw_calls; si_make_CB_shader_coherent(sctx, 0, sctx->framebuffer.CB_has_shader_readable_metadata, sctx->framebuffer.all_DCC_pipe_aligned); } - if (sctx->gfx_level == GFX12 && - (sctx->force_shader_coherency.with_db || - si_check_needs_implicit_sync(sctx, RADEON_USAGE_DB_NEEDS_IMPLICIT_SYNC))) { + if (sync_db) { sctx->num_draw_calls_sh_coherent.with_db = sctx->num_draw_calls; si_make_DB_shader_coherent(sctx, 0, false, false); }