diff --git a/lib/mesa/Makefile.bsd-wrapper b/lib/mesa/Makefile.bsd-wrapper index ef7032dd6..c64125ec3 100644 --- a/lib/mesa/Makefile.bsd-wrapper +++ b/lib/mesa/Makefile.bsd-wrapper @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile.bsd-wrapper,v 1.29 2020/01/22 02:49:17 jsg Exp $ +# $OpenBSD: Makefile.bsd-wrapper,v 1.30 2020/02/20 02:55:46 jsg Exp $ .include .include @@ -31,11 +31,19 @@ VULKAN_DRIVERS= radeon WITH_LLVM= --enable-llvm .endif +.if ${MACHINE_ARCH} == "hppa" || ${MACHINE_ARCH} == "m88k" || \ + ${MACHINE_ARCH} == "sh" +WITH_FUTEX= --disable-futex +.else +WITH_FUTEX= --enable-futex +.endif + CONFIGURE_ARGS= --with-dri-drivers=${DRI_DRIVERS} \ --with-gallium-drivers=${GALLIUM_DRIVERS} \ --with-vulkan-drivers=${VULKAN_DRIVERS} \ --disable-silent-rules \ ${WITH_LLVM} \ + ${WITH_FUTEX} \ --disable-glx-tls \ --disable-regen-sources \ --enable-gles1 --enable-gles2 \ diff --git a/lib/mesa/configure.ac b/lib/mesa/configure.ac index f3d2d9005..53d8374ca 100644 --- a/lib/mesa/configure.ac +++ b/lib/mesa/configure.ac @@ -1044,6 +1044,16 @@ LIBS="$save_LIBS" dnl Check for futex for fast inline simple_mtx_t. AC_CHECK_HEADER([linux/futex.h], [DEFINES="$DEFINES -DHAVE_LINUX_FUTEX_H"]) +AC_ARG_ENABLE([futex], + [AS_HELP_STRING([--disable-futex], + [disable futex use @<:@default=enabled@:>@])], + [enable_futex="$enableval"], + [enable_futex=yes]) + +if test "x$enable_futex" = xyes; then + DEFINES="$DEFINES -DUSE_FUTEX" +fi + dnl SELinux awareness. AC_ARG_ENABLE([selinux], [AS_HELP_STRING([--enable-selinux], diff --git a/lib/mesa/meson.build b/lib/mesa/meson.build index 7ff6ce6d7..58571ff20 100644 --- a/lib/mesa/meson.build +++ b/lib/mesa/meson.build @@ -1040,6 +1040,8 @@ foreach h : ['xlocale.h', 'sys/sysctl.h', 'linux/futex.h', 'endian.h', 'dlfcn.h' endif endforeach +pre_args += '-DUSE_FUTEX' + foreach f : ['strtof', 'mkostemp', 'posix_memalign', 'timespec_get', 'memfd_create', 'random_r', 'flock', 'arc4random_buf'] if cc.has_function(f) pre_args += '-DHAVE_@0@'.format(f.to_upper()) diff --git a/lib/mesa/src/util/simple_mtx.h b/lib/mesa/src/util/simple_mtx.h index 94ab6fcef..1f55fc516 100644 --- a/lib/mesa/src/util/simple_mtx.h +++ b/lib/mesa/src/util/simple_mtx.h @@ -28,7 +28,7 @@ #include "c11/threads.h" -#if defined(__GNUC__) && defined(HAVE_LINUX_FUTEX_H) +#if defined(__GNUC__) && defined(USE_FUTEX) /* mtx_t - Fast, simple mutex * diff --git a/lib/mesa/src/util/u_queue.h b/lib/mesa/src/util/u_queue.h index 2d269099c..a24647ea9 100644 --- a/lib/mesa/src/util/u_queue.h +++ b/lib/mesa/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 defined(__GNUC__) && defined(USE_FUTEX) #define UTIL_QUEUE_FENCE_FUTEX #else #define UTIL_QUEUE_FENCE_STANDARD