From fb2ae7736f90be7bc3cce3611cff461a5d14693d Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Wed, 14 Feb 2024 16:44:11 -0500 Subject: [PATCH] zink: add a second fence disambiguation case this is the case where: * a batch A is submitted * a no-op flush occurs * the frontend gets the fence from already-flushed batch A * zink recycles batch A * the frontend waits on fence A fixes #10598 cc: mesa-stable Part-of: --- src/gallium/drivers/zink/zink_fence.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/gallium/drivers/zink/zink_fence.c b/src/gallium/drivers/zink/zink_fence.c index 33ea9d7d90e..86bc56cf119 100644 --- a/src/gallium/drivers/zink/zink_fence.c +++ b/src/gallium/drivers/zink/zink_fence.c @@ -185,7 +185,12 @@ zink_fence_finish(struct zink_screen *screen, struct pipe_context *pctx, struct if (submit_diff > 1) return true; - if (fence->submitted && zink_screen_check_last_finished(screen, fence->batch_id)) + /* - if fence is submitted, batch_id is nonzero and can be checked + * - if fence is not submitted here, it must be reset; batch_id will be 0 and submitted is false + * in either case, the fence has finished + */ + if ((fence->submitted && zink_screen_check_last_finished(screen, fence->batch_id)) || + (!fence->submitted && submit_diff)) return true; return fence_wait(screen, fence, timeout_ns);