Mesa (main): zink: move semaphore reset handling to submit

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Fri Oct 8 03:04:36 UTC 2021


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

Author: Mike Blumenkrantz <michael.blumenkrantz at gmail.com>
Date:   Wed Oct  6 09:18:56 2021 -0400

zink: move semaphore reset handling to submit

this is the earliest place the batch_id is available now, so check it
here since ctx->curr_batch isn't actually a thing anymore

Reviewed-by: Adam Jackson <ajax at redhat.com>
Reviewed-by: Dave Airlie <airlied at redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13247>

---

 src/gallium/drivers/zink/zink_batch.c | 16 +++++++---------
 1 file changed, 7 insertions(+), 9 deletions(-)

diff --git a/src/gallium/drivers/zink/zink_batch.c b/src/gallium/drivers/zink/zink_batch.c
index 34ce63fb3f1..6e259cd3c2a 100644
--- a/src/gallium/drivers/zink/zink_batch.c
+++ b/src/gallium/drivers/zink/zink_batch.c
@@ -288,15 +288,6 @@ get_batch_state(struct zink_context *ctx, struct zink_batch *batch)
 void
 zink_reset_batch(struct zink_context *ctx, struct zink_batch *batch)
 {
-   struct zink_screen *screen = zink_screen(ctx->base.screen);
-
-   if (ctx->have_timelines && screen->last_finished > ctx->curr_batch && ctx->curr_batch == 1) {
-      if (!zink_screen_init_semaphore(screen)) {
-         debug_printf("timeline init failed, things are about to go dramatically wrong.");
-         ctx->have_timelines = false;
-      }
-   }
-
    batch->state = get_batch_state(ctx, batch);
    assert(batch->state);
 
@@ -360,6 +351,13 @@ submit_queue(void *data, void *gdata, int thread_index)
    bs->usage.unflushed = false;
    simple_mtx_unlock(&ctx->batch_mtx);
 
+   if (ctx->have_timelines && screen->last_finished > bs->fence.batch_id && bs->fence.batch_id == 1) {
+      if (!zink_screen_init_semaphore(screen)) {
+         debug_printf("timeline init failed, things are about to go dramatically wrong.");
+         ctx->have_timelines = false;
+      }
+   }
+
    VKSCR(ResetFences)(screen->dev, 1, &bs->fence.fence);
 
    uint64_t batch_id = bs->fence.batch_id;



More information about the mesa-commit mailing list