zink: split out stalling from fence-waiting function

stall and flush+stall are not the same; in some cases, the driver must only
stall and never flush, so ensure that this is possible to avoid infinite
recursion

fixes Metro Last Light: Redux benchmark mode

Fixes: d8905446d6 ("zink: rework oom flushing")

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12652>
This commit is contained in:
Mike Blumenkrantz 2021-08-31 16:01:49 -04:00 committed by Marge Bot
parent 2aaca02bbf
commit 39df394ffe

View file

@ -1899,6 +1899,14 @@ zink_update_descriptor_refs(struct zink_context *ctx, bool compute)
}
}
static void
stall(struct zink_context *ctx)
{
sync_flush(ctx, zink_batch_state(ctx->last_fence));
zink_vkfence_wait(zink_screen(ctx->base.screen), ctx->last_fence, PIPE_TIMEOUT_INFINITE);
zink_batch_reset_all(ctx);
}
static void
flush_batch(struct zink_context *ctx, bool sync)
{
@ -1924,7 +1932,7 @@ flush_batch(struct zink_context *ctx, bool sync)
zink_select_launch_grid(ctx);
if (ctx->oom_stall)
zink_fence_wait(&ctx->base);
stall(ctx);
ctx->oom_flush = false;
ctx->oom_stall = false;
}
@ -2592,11 +2600,8 @@ zink_fence_wait(struct pipe_context *pctx)
if (ctx->batch.has_work)
pctx->flush(pctx, NULL, PIPE_FLUSH_HINT_FINISH);
if (ctx->last_fence) {
sync_flush(ctx, zink_batch_state(ctx->last_fence));
zink_vkfence_wait(zink_screen(ctx->base.screen), ctx->last_fence, PIPE_TIMEOUT_INFINITE);
zink_batch_reset_all(ctx);
}
if (ctx->last_fence)
stall(ctx);
}
void