Fall back on clock_gettime when timespec_get() is unavailable

Fixes: e3a8013de8 "util/u_queue: add util_queue_fence_wait_timeout"
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/1020
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/4088

Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
Signed-off-by: Yurii Kolesnykov <root@yurikoles.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8482>
(cherry picked from commit 68a785e63f)
This commit is contained in:
Jeremy Huddleston Sequoia 2021-01-12 16:44:34 -08:00 committed by Dylan Baker
parent affb8eebe4
commit 8eb3a0b6cb
2 changed files with 5 additions and 1 deletions

View file

@ -805,7 +805,7 @@
"description": "Fall back on clock_gettime when timespec_get() is unavailable",
"nominated": true,
"nomination_type": 1,
"resolution": 0,
"resolution": 1,
"master_sha": null,
"because_sha": "e3a8013de8ca854d21225be00f123ccf63f9060f"
},

View file

@ -183,7 +183,11 @@ _util_queue_fence_wait_timeout(struct util_queue_fence *fence,
if (rel > 0) {
struct timespec ts;
#ifdef HAVE_TIMESPEC_GET
timespec_get(&ts, TIME_UTC);
#else
clock_gettime(CLOCK_REALTIME, &ts);
#endif
ts.tv_sec += abs_timeout / (1000*1000*1000);
ts.tv_nsec += abs_timeout % (1000*1000*1000);