Mesa (main): zink: ensure fences are released before reusing them

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Sun Oct 3 15:09:51 UTC 2021


Module: Mesa
Branch: main
Commit: 9e3293bcd4c34b68b83efc0e7308f7d701e43db7
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=9e3293bcd4c34b68b83efc0e7308f7d701e43db7

Author: Mike Blumenkrantz <michael.blumenkrantz at gmail.com>
Date:   Fri Sep 24 12:00:33 2021 -0400

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 <ajax at redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13144>

---

 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);



More information about the mesa-commit mailing list