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: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37239>
This commit is contained in:
Mike Blumenkrantz 2025-09-08 10:51:29 -04:00
parent 683e3ea0af
commit 28342d1f11

View file

@ -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 */