From 3c520892b10ca249723f11d3e4858cc41e072e0c Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Thu, 6 Jul 2023 08:57:29 -0400 Subject: [PATCH] zink: fix batch disambiguation on first submit submit_count is used to disambiguate a batch_id based on the generation id of a given batch: this value is incremented once on submit and once on reset such that the diff of the values is > 1 any time the batch does not represent the fence it was last submitted with in the case of a batch's first use, however, this value was being incorrectly incremented such that the first submit would cause disambiguation checks to erroneously determine that the batch had already completed, breaking synchronization fixes #9313 cc: mesa-stable Part-of: --- src/gallium/drivers/zink/zink_batch.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/gallium/drivers/zink/zink_batch.c b/src/gallium/drivers/zink/zink_batch.c index fcfe301..9e1585e 100644 --- a/src/gallium/drivers/zink/zink_batch.c +++ b/src/gallium/drivers/zink/zink_batch.c @@ -167,6 +167,9 @@ zink_reset_batch_state(struct zink_context *ctx, struct zink_batch_state *bs) bs->unordered_write_access = 0; bs->unordered_write_stages = 0; + /* only increment batch generation if previously in-use to avoid false detection of batch completion */ + if (bs->fence.submitted) + bs->usage.submit_count++; /* only reset submitted here so that tc fence desync can pick up the 'completed' flag * before the state is reused */ @@ -174,7 +177,6 @@ zink_reset_batch_state(struct zink_context *ctx, struct zink_batch_state *bs) bs->has_barriers = false; if (bs->fence.batch_id) zink_screen_update_last_finished(screen, bs->fence.batch_id); - bs->usage.submit_count++; bs->fence.batch_id = 0; bs->usage.usage = 0; bs->next = NULL; -- 2.7.4