radeonsi: add si_fb_barrier_before_rendering

Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31193>
This commit is contained in:
Marek Olšák 2024-08-23 17:37:26 -04:00 committed by Marge Bot
parent 0be3900b8d
commit 6f25ace87e
3 changed files with 12 additions and 6 deletions

View file

@ -726,6 +726,13 @@ static void si_set_sampler_depth_decompress_mask(struct si_context *sctx, struct
}
}
void si_fb_barrier_before_rendering(struct si_context *sctx)
{
/* Wait for all shaders because all image loads must finish before CB/DB can write there. */
sctx->barrier_flags |= SI_CONTEXT_CS_PARTIAL_FLUSH | SI_CONTEXT_PS_PARTIAL_FLUSH;
si_mark_atom_dirty(sctx, &sctx->atoms.s.barrier);
}
void si_fb_barrier_after_rendering(struct si_context *sctx, unsigned flags)
{
if (sctx->gfx_level < GFX12 && !sctx->decompression_enabled) {

View file

@ -1384,6 +1384,7 @@ void si_barrier_before_simple_buffer_op(struct si_context *sctx, unsigned flags,
struct pipe_resource *dst, struct pipe_resource *src);
void si_barrier_after_simple_buffer_op(struct si_context *sctx, unsigned flags,
struct pipe_resource *dst, struct pipe_resource *src);
void si_fb_barrier_before_rendering(struct si_context *sctx);
void si_fb_barrier_after_rendering(struct si_context *sctx, unsigned flags);
void si_init_barrier_functions(struct si_context *sctx);

View file

@ -2569,12 +2569,6 @@ static void si_set_framebuffer_state(struct pipe_context *ctx,
}
}
/* Wait for CS because: shader write -> FB read
* Wait for PS because: texture -> render (eg: glBlitFramebuffer(with src=dst) then glDraw*)
*/
sctx->barrier_flags |= SI_CONTEXT_CS_PARTIAL_FLUSH | SI_CONTEXT_PS_PARTIAL_FLUSH;
si_mark_atom_dirty(sctx, &sctx->atoms.s.barrier);
/* Take the maximum of the old and new count. If the new count is lower,
* dirtying is needed to disable the unbound colorbuffers.
*/
@ -2584,6 +2578,10 @@ static void si_set_framebuffer_state(struct pipe_context *ctx,
si_dec_framebuffer_counters(&sctx->framebuffer.state);
util_copy_framebuffer_state(&sctx->framebuffer.state, state);
/* The framebuffer state must be set before the barrier. */
si_fb_barrier_before_rendering(sctx);
/* Recompute layers because frontends and utils might not set it. */
sctx->framebuffer.state.layers = util_framebuffer_get_num_layers(state);