Module: Mesa Branch: master Commit: 2bc24c7e46587ba8c3931644b9f1ee7594ba7ca8 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=2bc24c7e46587ba8c3931644b9f1ee7594ba7ca8
Author: Mike Blumenkrantz <michael.blumenkra...@gmail.com> Date: Tue Aug 11 18:38:11 2020 -0400 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 <airl...@redhat.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8662> --- src/gallium/drivers/zink/zink_context.c | 14 ++++++++++++++ src/gallium/drivers/zink/zink_context.h | 3 +++ 2 files changed, 17 insertions(+) diff --git a/src/gallium/drivers/zink/zink_context.c b/src/gallium/drivers/zink/zink_context.c index 95b33321aa5..38c5e47bacd 100644 --- a/src/gallium/drivers/zink/zink_context.c +++ b/src/gallium/drivers/zink/zink_context.c @@ -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) { diff --git a/src/gallium/drivers/zink/zink_context.h b/src/gallium/drivers/zink/zink_context.h index 7f6d85858f5..1c319144066 100644 --- a/src/gallium/drivers/zink/zink_context.h +++ b/src/gallium/drivers/zink/zink_context.h @@ -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); _______________________________________________ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit