Mesa (staging/20.1): util: enable futex usage on BSDs after 7dc2f4788288

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed Jun 17 00:03:43 UTC 2020


Module: Mesa
Branch: staging/20.1
Commit: ff3ed31a7c79b6cfbf2eefdc66f251a4f48ff92f
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=ff3ed31a7c79b6cfbf2eefdc66f251a4f48ff92f

Author: Jan Beich <jbeich at FreeBSD.org>
Date:   Tue Jun  2 00:28:09 2020 +0000

util: enable futex usage on BSDs after 7dc2f4788288

Reviewed-by: Eric Engestrom <eric at engestrom.ch>
Cc: mesa-stable
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5460>
(cherry picked from commit 46c368907fcf333a19881d28c46e997845d00faf)

---

 .pick_status.json     | 2 +-
 src/util/futex.h      | 5 +++++
 src/util/simple_mtx.h | 2 +-
 src/util/u_queue.h    | 2 +-
 4 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/.pick_status.json b/.pick_status.json
index 739ee80e4d2..48374a85a25 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -22,7 +22,7 @@
         "description": "util: enable futex usage on BSDs after 7dc2f4788288",
         "nominated": true,
         "nomination_type": 0,
-        "resolution": 0,
+        "resolution": 1,
         "master_sha": null,
         "because_sha": null
     },
diff --git a/src/util/futex.h b/src/util/futex.h
index cf8dd0206c9..4d712e2ef2d 100644
--- a/src/util/futex.h
+++ b/src/util/futex.h
@@ -25,6 +25,7 @@
 #define UTIL_FUTEX_H
 
 #if defined(HAVE_LINUX_FUTEX_H)
+#define UTIL_FUTEX_SUPPORTED 1
 
 #include <limits.h>
 #include <stdint.h>
@@ -52,6 +53,7 @@ static inline int futex_wait(uint32_t *addr, int32_t value, const struct timespe
 }
 
 #elif defined(__FreeBSD__)
+#define UTIL_FUTEX_SUPPORTED 1
 
 #include <assert.h>
 #include <errno.h>
@@ -86,6 +88,7 @@ static inline int futex_wait(uint32_t *addr, int32_t value, struct timespec *tim
 }
 
 #elif defined(__OpenBSD__)
+#define UTIL_FUTEX_SUPPORTED 1
 
 #include <sys/time.h>
 #include <sys/futex.h>
@@ -103,6 +106,8 @@ static inline int futex_wait(uint32_t *addr, int32_t value, const struct timespe
    return futex(addr, FUTEX_WAIT, value, &tsrel, NULL);
 }
 
+#else
+#define UTIL_FUTEX_SUPPORTED 0
 #endif
 
 #endif /* UTIL_FUTEX_H */
diff --git a/src/util/simple_mtx.h b/src/util/simple_mtx.h
index 4fc8a0d4df4..e332816b989 100644
--- a/src/util/simple_mtx.h
+++ b/src/util/simple_mtx.h
@@ -29,7 +29,7 @@
 
 #include "c11/threads.h"
 
-#if defined(__GNUC__) && defined(HAVE_LINUX_FUTEX_H)
+#if UTIL_FUTEX_SUPPORTED
 
 /* mtx_t - Fast, simple mutex
  *
diff --git a/src/util/u_queue.h b/src/util/u_queue.h
index 9666fd9c4b5..5943df4fcbb 100644
--- a/src/util/u_queue.h
+++ b/src/util/u_queue.h
@@ -50,7 +50,7 @@ extern "C" {
 #define UTIL_QUEUE_INIT_RESIZE_IF_FULL            (1 << 1)
 #define UTIL_QUEUE_INIT_SET_FULL_THREAD_AFFINITY  (1 << 2)
 
-#if defined(__GNUC__) && defined(HAVE_LINUX_FUTEX_H)
+#if UTIL_FUTEX_SUPPORTED
 #define UTIL_QUEUE_FENCE_FUTEX
 #else
 #define UTIL_QUEUE_FENCE_STANDARD



More information about the mesa-commit mailing list