zink: add function for waiting on a specific batch's fence

previously we only had zink_fence_wait(), which just waits on the
current batch to finish, but it may be the case that we don't want to
wait on all batches up to that point, so we can optimize a bit by only
waiting as long as we have to

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8662>
This commit is contained in:
Mike Blumenkrantz 2020-08-11 18:38:11 -04:00 committed by Marge Bot
parent 53d9beb9b8
commit 2bc24c7e46
2 changed files with 17 additions and 0 deletions

View file

@ -1149,6 +1149,20 @@ zink_fence_wait(struct pipe_context *pctx)
}
}
void
zink_wait_on_batch(struct zink_context *ctx, int batch_id)
{
if (batch_id >= 0) {
struct zink_batch *batch = &ctx->batches[batch_id];
if (batch != zink_curr_batch(ctx)) {
ctx->base.screen->fence_finish(ctx->base.screen, NULL, (struct pipe_fence_handle*)batch->fence,
PIPE_TIMEOUT_INFINITE);
return;
}
}
zink_fence_wait(&ctx->base);
}
static void
zink_memory_barrier(struct pipe_context *pctx, unsigned flags)
{

View file

@ -189,6 +189,9 @@ zink_batch_no_rp(struct zink_context *ctx);
void
zink_fence_wait(struct pipe_context *ctx);
void
zink_wait_on_batch(struct zink_context *ctx, int batch_id);
void
zink_resource_barrier(VkCommandBuffer cmdbuf, struct zink_resource *res,
VkImageAspectFlags aspect, VkImageLayout new_layout);