Mesa (staging/20.3): Fall back on clock_gettime when timespec_get() is unavailable

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue Jan 19 17:49:23 UTC 2021


Module: Mesa
Branch: staging/20.3
Commit: 8eb3a0b6cb77004ea6ec5efa9c2b2c7928ea332e
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=8eb3a0b6cb77004ea6ec5efa9c2b2c7928ea332e

Author: Jeremy Huddleston Sequoia <jeremyhu at apple.com>
Date:   Tue Jan 12 16:44:34 2021 -0800

Fall back on clock_gettime when timespec_get() is unavailable

Fixes: e3a8013de8ca "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 at apple.com>
Signed-off-by: Yurii Kolesnykov <root at yurikoles.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8482>
(cherry picked from commit 68a785e63fe848c7bcd48bce2095670926f97eea)

---

 .pick_status.json  | 2 +-
 src/util/u_queue.c | 4 ++++
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/.pick_status.json b/.pick_status.json
index 498b563c423..b17ff958b2e 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -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"
     },
diff --git a/src/util/u_queue.c b/src/util/u_queue.c
index b11b297a45c..cf550424d8e 100644
--- a/src/util/u_queue.c
+++ b/src/util/u_queue.c
@@ -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);



More information about the mesa-commit mailing list