radeonsi: Add RADEON_FLUSH_FORCE and use it to force flush
Some checks are pending
macOS-CI / macOS-CI (dri) (push) Waiting to run
macOS-CI / macOS-CI (xlib) (push) Waiting to run

Forcing flush by setting initial_gfx_cs_size to zero requires
there are always packets emitted on starting new gfx IB.
But this is not the case with userq, as there is no preamble.
Add a new flag to be used with si_flush_gfx_cs to force flush.

Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Reviewed-by: Marek Olšák <maraeo@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41530>
This commit is contained in:
David Rosca 2025-09-23 14:47:35 +02:00 committed by Marge Bot
parent 294644643e
commit 998e2a70e7
4 changed files with 7 additions and 5 deletions

View file

@ -3841,8 +3841,7 @@ bool si_update_gs_ring_buffers(struct si_context *sctx)
}
/* Flush the context to re-emit both cs_preamble states. */
sctx->initial_gfx_cs_size = 0; /* force flush */
si_flush_gfx_cs(sctx, RADEON_FLUSH_ASYNC_START_NEXT_GFX_IB_NOW, NULL);
si_flush_gfx_cs(sctx, RADEON_FLUSH_ASYNC_START_NEXT_GFX_IB_NOW | RADEON_FLUSH_FORCE, NULL);
return true;
}

View file

@ -439,10 +439,10 @@ static void si_flush_all_queues(struct pipe_context *ctx,
}
if (force_flush) {
sctx->initial_gfx_cs_size = 0;
rflags |= RADEON_FLUSH_FORCE;
}
if (!radeon_emitted(&sctx->gfx_cs, sctx->initial_gfx_cs_size)) {
if (!force_flush && !radeon_emitted(&sctx->gfx_cs, sctx->initial_gfx_cs_size)) {
if (fence)
ws->fence_reference(ws, &gfx_fence, sctx->last_gfx_fence);
if (!(flags & PIPE_FLUSH_DEFERRED))

View file

@ -114,7 +114,7 @@ void si_flush_gfx_cs(struct si_context *ctx, unsigned flags, struct pipe_fence_h
/* Drop this flush if it's a no-op. */
if (!radeon_emitted(cs, ctx->initial_gfx_cs_size) &&
(!wait_flags || !ctx->gfx_last_ib_is_busy) &&
!(flags & RADEON_FLUSH_TOGGLE_SECURE_SUBMISSION)) {
!(flags & (RADEON_FLUSH_TOGGLE_SECURE_SUBMISSION | RADEON_FLUSH_FORCE))) {
tc_driver_internal_flush_notify(ctx->tc);
return;
}

View file

@ -11,6 +11,9 @@
/* The public winsys interface header for the radeon driver. */
/* Force flush. */
#define RADEON_FLUSH_FORCE (1u << 28)
/* Skip command submission. Same as RADEON_NOOP=1. */
#define RADEON_FLUSH_NOOP (1u << 29)