mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-08 04:48:08 +02:00
util: Fix the integer addition in os_time_get_absolute_timeout()
This should fix glClientWaitSync() timing out too early with a INT64_MAX timeout on radeonsi Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/11615 Fixes:7316cc92f3("gallium/os: add conversion and wait functions for absolute timeouts") Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30476> (cherry picked from commite14d1f5bc0)
This commit is contained in:
parent
bfc23382ed
commit
1023efa1bf
2 changed files with 4 additions and 2 deletions
|
|
@ -94,7 +94,7 @@
|
|||
"description": "util: Fix the integer addition in os_time_get_absolute_timeout()",
|
||||
"nominated": true,
|
||||
"nomination_type": 1,
|
||||
"resolution": 0,
|
||||
"resolution": 1,
|
||||
"main_sha": null,
|
||||
"because_sha": "7316cc92f3810c9e53a22c35343190d8fb7980be",
|
||||
"notes": null
|
||||
|
|
|
|||
|
|
@ -97,7 +97,9 @@ os_time_get_absolute_timeout(uint64_t timeout)
|
|||
return OS_TIMEOUT_INFINITE;
|
||||
|
||||
time = os_time_get_nano();
|
||||
abs_timeout = time + (int64_t)timeout;
|
||||
|
||||
/* Do the addition in unsigned, because signed overflow is UB, then convert to signed again. */
|
||||
abs_timeout = (uint64_t)time + (uint64_t)timeout;
|
||||
|
||||
/* Check for overflow. */
|
||||
if (abs_timeout < time)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue