From 13ea671b684234505dfa31a7d37a3c188de4bf44 Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Thu, 11 Sep 2025 12:37:50 -0400 Subject: [PATCH] zink: simplify state iterating in find_completed_batch_state() this is a bit easier to read Part-of: --- src/gallium/drivers/zink/zink_batch.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/gallium/drivers/zink/zink_batch.c b/src/gallium/drivers/zink/zink_batch.c index 3f04db6a204..798dff9b835 100644 --- a/src/gallium/drivers/zink/zink_batch.c +++ b/src/gallium/drivers/zink/zink_batch.c @@ -431,7 +431,9 @@ find_completed_batch_state(struct zink_context *ctx) struct zink_batch_state *bs = NULL; /* states are stored sequentially, so if the first one doesn't work, none of them will */ - for (struct zink_batch_state *i = ctx->batch_states, *j = i ? i->next : NULL; i; i = j, j = j ? j->next : NULL) { + struct zink_batch_state *i = ctx->batch_states; + while (i) { + struct zink_batch_state *j = i->next; /* only a submitted state can be reused */ if (i->fence.submitted && /* a submitted state must have completed before it can be reused */ @@ -441,6 +443,7 @@ find_completed_batch_state(struct zink_context *ctx) simple_mtx_lock(&screen->active_batch_states_lock); zink_batch_state_append(&screen->active_batch_states, &screen->last_active_batch_state, i); simple_mtx_unlock(&screen->active_batch_states_lock); + i = j; } else { return bs; }