From 113db9ac208502b07d2ff99116b53d5752aac3a7 Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Mon, 8 Sep 2025 10:51:29 -0400 Subject: [PATCH] zink: correctly handle batch_id==0 in check_last_finished() in some places this assert is used to hang check, but here we can assume that the batch_id is always valid (i.e., not a hang) and check it accordingly to avoid spurious crashes cc: mesa-stable Part-of: (cherry picked from commit 28342d1f11317168f7c0017b0a3c3420c86d8344) --- .pick_status.json | 2 +- src/gallium/drivers/zink/zink_screen.h | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/.pick_status.json b/.pick_status.json index ff878d6c0de..f4d55a0ec1b 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -7394,7 +7394,7 @@ "description": "zink: correctly handle batch_id==0 in check_last_finished()", "nominated": true, "nomination_type": 1, - "resolution": 0, + "resolution": 1, "main_sha": null, "because_sha": null, "notes": null diff --git a/src/gallium/drivers/zink/zink_screen.h b/src/gallium/drivers/zink/zink_screen.h index 45be34c94fc..a8e03ebc972 100644 --- a/src/gallium/drivers/zink/zink_screen.h +++ b/src/gallium/drivers/zink/zink_screen.h @@ -61,7 +61,9 @@ static inline bool zink_screen_check_last_finished(struct zink_screen *screen, uint32_t batch_id) { const uint32_t check_id = (uint32_t)batch_id; - assert(check_id); + /* 0 means an in-flight batch */ + if (check_id == 0) + return false; /* last_finished may have wrapped */ if (screen->last_finished < UINT_MAX / 2) { /* last_finished has wrapped, batch_id has not */