use futexes in Mesa on archs with atomics

tested by matthieu@ naddy@ and myself
This commit is contained in:
jsg 2020-02-20 02:55:46 +00:00
parent ea9d0bc072
commit e374dad6a5
5 changed files with 23 additions and 3 deletions

View File

@ -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 <bsd.own.mk> .include <bsd.own.mk>
.include <bsd.xconf.mk> .include <bsd.xconf.mk>
@ -31,11 +31,19 @@ VULKAN_DRIVERS= radeon
WITH_LLVM= --enable-llvm WITH_LLVM= --enable-llvm
.endif .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} \ CONFIGURE_ARGS= --with-dri-drivers=${DRI_DRIVERS} \
--with-gallium-drivers=${GALLIUM_DRIVERS} \ --with-gallium-drivers=${GALLIUM_DRIVERS} \
--with-vulkan-drivers=${VULKAN_DRIVERS} \ --with-vulkan-drivers=${VULKAN_DRIVERS} \
--disable-silent-rules \ --disable-silent-rules \
${WITH_LLVM} \ ${WITH_LLVM} \
${WITH_FUTEX} \
--disable-glx-tls \ --disable-glx-tls \
--disable-regen-sources \ --disable-regen-sources \
--enable-gles1 --enable-gles2 \ --enable-gles1 --enable-gles2 \

View File

@ -1044,6 +1044,16 @@ LIBS="$save_LIBS"
dnl Check for futex for fast inline simple_mtx_t. dnl Check for futex for fast inline simple_mtx_t.
AC_CHECK_HEADER([linux/futex.h], [DEFINES="$DEFINES -DHAVE_LINUX_FUTEX_H"]) 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. dnl SELinux awareness.
AC_ARG_ENABLE([selinux], AC_ARG_ENABLE([selinux],
[AS_HELP_STRING([--enable-selinux], [AS_HELP_STRING([--enable-selinux],

View File

@ -1040,6 +1040,8 @@ foreach h : ['xlocale.h', 'sys/sysctl.h', 'linux/futex.h', 'endian.h', 'dlfcn.h'
endif endif
endforeach endforeach
pre_args += '-DUSE_FUTEX'
foreach f : ['strtof', 'mkostemp', 'posix_memalign', 'timespec_get', 'memfd_create', 'random_r', 'flock', 'arc4random_buf'] foreach f : ['strtof', 'mkostemp', 'posix_memalign', 'timespec_get', 'memfd_create', 'random_r', 'flock', 'arc4random_buf']
if cc.has_function(f) if cc.has_function(f)
pre_args += '-DHAVE_@0@'.format(f.to_upper()) pre_args += '-DHAVE_@0@'.format(f.to_upper())

View File

@ -28,7 +28,7 @@
#include "c11/threads.h" #include "c11/threads.h"
#if defined(__GNUC__) && defined(HAVE_LINUX_FUTEX_H) #if defined(__GNUC__) && defined(USE_FUTEX)
/* mtx_t - Fast, simple mutex /* mtx_t - Fast, simple mutex
* *

View File

@ -50,7 +50,7 @@ extern "C" {
#define UTIL_QUEUE_INIT_RESIZE_IF_FULL (1 << 1) #define UTIL_QUEUE_INIT_RESIZE_IF_FULL (1 << 1)
#define UTIL_QUEUE_INIT_SET_FULL_THREAD_AFFINITY (1 << 2) #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 #define UTIL_QUEUE_FENCE_FUTEX
#else #else
#define UTIL_QUEUE_FENCE_STANDARD #define UTIL_QUEUE_FENCE_STANDARD