From 9e3293bcd4c34b68b83efc0e7308f7d701e43db7 Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Fri, 24 Sep 2021 12:00:33 -0400 Subject: [PATCH] zink: ensure fences are released before reusing them at this point it's guaranteed that the cmdbuf has completed since the timeline id has passed, but vulkan hasn't technically "released" the fence until it's been waited upon, so cut down on some validation spam by waiting here like in get_batch_state() Acked-by: Adam Jackson Part-of: --- src/gallium/drivers/zink/zink_batch.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/gallium/drivers/zink/zink_batch.c b/src/gallium/drivers/zink/zink_batch.c index a20888927ec..335ad304a7e 100644 --- a/src/gallium/drivers/zink/zink_batch.c +++ b/src/gallium/drivers/zink/zink_batch.c @@ -579,6 +579,9 @@ zink_end_batch(struct zink_context *ctx, struct zink_batch *batch) struct zink_fence *fence = he->data; struct zink_batch_state *bs = he->data; if (zink_check_batch_completion(ctx, fence->batch_id, true)) { + if (bs->fence.submitted && !bs->fence.completed) + /* this fence is already done, so we need vulkan to release the cmdbuf */ + zink_vkfence_wait(screen, &bs->fence, PIPE_TIMEOUT_INFINITE); zink_reset_batch_state(ctx, he->data); _mesa_hash_table_remove(&ctx->batch_states, he); util_dynarray_append(&ctx->free_batch_states, struct zink_batch_state *, bs);