View | Details | Raw Unified | Return to bug 225415 | Differences between
and this patch

Collapse All | Expand All

(-)b/graphics/mesa-dri/Makefile (-1 / +1 lines)
Lines 66-72 EXTRA_PATCHES+= ${PATCHDIR}/extra-src_gallium_drivers_vc4_Makefile.in Link Here
66
BUILD_DEPENDS+=		${PYTHON_PKGNAMEPREFIX}mako>0:textproc/py-mako@${PY_FLAVOR}
66
BUILD_DEPENDS+=		${PYTHON_PKGNAMEPREFIX}mako>0:textproc/py-mako@${PY_FLAVOR}
67
.endif
67
.endif
68
68
69
.if ${VULKAN_DRIVERS:MINTEL}
69
.if ${DRI_DRIVERS} || ${VULKAN_DRIVERS:MINTEL}
70
. if ${/usr/bin/ld:L:tA} != /usr/bin/ld.lld
70
. if ${/usr/bin/ld:L:tA} != /usr/bin/ld.lld
71
# --build-id isn't supported by old GNU ld.bfd in base
71
# --build-id isn't supported by old GNU ld.bfd in base
72
USE_BINUTILS=		yes
72
USE_BINUTILS=		yes
(-)b/graphics/mesa-dri/Makefile.common (-2 / +2 lines)
Lines 14-22 Link Here
14
MESAVERSION=	${MESABASEVERSION}${MESASUBVERSION:C/^(.)/.\1/}
14
MESAVERSION=	${MESABASEVERSION}${MESASUBVERSION:C/^(.)/.\1/}
15
MESADISTVERSION=${MESABASEVERSION}${MESASUBVERSION:C/^(.)/-\1/}
15
MESADISTVERSION=${MESABASEVERSION}${MESASUBVERSION:C/^(.)/-\1/}
16
16
17
MESABASEVERSION=	17.3.6
17
MESABASEVERSION=	18.0.0
18
# if there is a subversion, don't include the '-' between 7.11-rc2.
18
# if there is a subversion, don't include the '-' between 7.11-rc2.
19
MESASUBVERSION=
19
MESASUBVERSION=		rc4
20
20
21
MASTER_SITES=	https://mesa.freedesktop.org/archive/ \
21
MASTER_SITES=	https://mesa.freedesktop.org/archive/ \
22
		https://mesa.freedesktop.org/archive/${MESABASEVERSION}/ \
22
		https://mesa.freedesktop.org/archive/${MESABASEVERSION}/ \
(-)b/graphics/mesa-dri/distinfo (-3 / +3 lines)
Lines 1-3 Link Here
1
TIMESTAMP = 1519690868
1
TIMESTAMP = 1518142677
2
SHA256 (mesa-17.3.6.tar.xz) = e5915680d44ac9d05defdec529db7459ac9edd441c9845266eff2e2d3e57fbf8
2
SHA256 (mesa-18.0.0-rc4.tar.xz) = ad575becea192f04403b6783492955f395dd8faad7e51cbcbad203be70eb9075
3
SIZE (mesa-17.3.6.tar.xz) = 10679396
3
SIZE (mesa-18.0.0-rc4.tar.xz) = 11027596
(-)b/graphics/mesa-dri/files/configure.ac (-19 / +21 lines)
Lines 1-5 Link Here
1
--- configure.ac.orig	2017-04-01 15:33:36 UTC
1
--- configure.ac.orig	2017-04-01 15:33:36 UTC
2
+++ configure.ac
2
+++ configure.ac
3
@@ -894,7 +894,7 @@ case "$host_os" in
4
 darwin*)
5
     ;;
6
 *)
7
-    AC_CHECK_FUNCS([clock_gettime], [CLOCK_LIB=],
8
+    AC_CHECK_FUNCS([clock_gettime clock_nanosleep], [CLOCK_LIB=],
9
                    [AC_CHECK_LIB([rt], [clock_gettime], [CLOCK_LIB=-lrt],
10
                                  [AC_MSG_ERROR([Could not find clock_gettime])])])
11
     AC_SUBST([CLOCK_LIB])
12
@@ -942,7 +942,10 @@ if test "x$pthread_stubs_possible" = xyes; then
13
 fi
14
 
15
 dnl Check for futex for fast inline simple_mtx_t.
16
-AC_CHECK_HEADER([linux/futex.h], [DEFINES="$DEFINES -DHAVE_LINUX_FUTEX_H"])
17
+AC_CHECK_HEADERS([linux/futex.h sys/umtx.h],
18
+    [DEFINES="$DEFINES -DHAVE_LINUX_FUTEX_H"],,
19
+    [#include <errno.h>
20
+     #include <sys/types.h>])
21
 
22
 dnl SELinux awareness.
23
 AC_ARG_ENABLE([selinux],
3
@@ -1121,7 +1121,7 @@ fi
24
@@ -1121,7 +1121,7 @@ fi
4
 AC_SUBST(LIBSENSORS_LIBS)
25
 AC_SUBST(LIBSENSORS_LIBS)
5
 
26
 
Lines 9-33 Link Here
9
     dri3_default=yes
30
     dri3_default=yes
10
     ;;
31
     ;;
11
 *)
32
 *)
12
@@ -2002,9 +2002,18 @@ if test "x$enable_opencl" = xyes; then
13
         AC_MSG_ERROR([cannot enable OpenCL without Gallium])
14
     fi
15
 
16
+    if test "x$acv_mesa_CLANG" = xno; then
17
+
18
+    GCC_VERSION=`$CC -dumpversion`
19
+    if test $? -eq 0; then
20
+        GCC_VERSION_MAJOR=`echo $GCC_VERSION | cut -d. -f1`
21
+        GCC_VERSION_MINOR=`echo $GCC_VERSION | cut -d. -f2`
22
+    fi
23
+
24
     if test $GCC_VERSION_MAJOR -lt 4 -o $GCC_VERSION_MAJOR -eq 4 -a $GCC_VERSION_MINOR -lt 7; then
25
         AC_MSG_ERROR([gcc >= 4.7 is required to build clover])
26
     fi
27
+    fi # end of clang test
28
 
29
     if test "x$have_libclc" = xno; then
30
         AC_MSG_ERROR([pkg-config cannot find libclc.pc which is required to build clover.
31
@@ -2061,8 +2070,6 @@ if test "x$enable_opencl" = xyes; then
33
@@ -2061,8 +2070,6 @@ if test "x$enable_opencl" = xyes; then
32
         CLANG_LIBDIR=${LLVM_LIBDIR}
34
         CLANG_LIBDIR=${LLVM_LIBDIR}
33
     fi
35
     fi
(-)b/graphics/mesa-dri/files/patch-configure (-21 / +43 lines)
Lines 1-5 Link Here
1
--- configure.orig	2017-12-21 17:31:27 UTC
1
--- configure.orig	2018-01-23 18:08:55 UTC
2
+++ configure
2
+++ configure
3
@@ -21895,12 +21895,13 @@ case "$host_os" in
4
 darwin*)
5
     ;;
6
 *)
7
-    for ac_func in clock_gettime
8
+    for ac_func in clock_gettime clock_nanosleep
9
 do :
10
-  ac_fn_c_check_func "$LINENO" "clock_gettime" "ac_cv_func_clock_gettime"
11
-if test "x$ac_cv_func_clock_gettime" = xyes; then :
12
+  as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
13
+ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
14
+if eval test \"x\$"$as_ac_var"\" = x"yes"; then :
15
   cat >>confdefs.h <<_ACEOF
16
-#define HAVE_CLOCK_GETTIME 1
17
+#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
18
 _ACEOF
19
  CLOCK_LIB=
20
 else
21
@@ -22559,11 +22559,20 @@ $as_echo "yes" >&6; }
22
 fi
23
 fi
24
 
25
-ac_fn_c_check_header_mongrel "$LINENO" "linux/futex.h" "ac_cv_header_linux_futex_h" "$ac_includes_default"
26
-if test "x$ac_cv_header_linux_futex_h" = xyes; then :
27
-  DEFINES="$DEFINES -DHAVE_LINUX_FUTEX_H"
28
+for ac_header in linux/futex.h sys/umtx.h
29
+do :
30
+  as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
31
+ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "#include <errno.h>
32
+     #include <sys/types.h>
33
+"
34
+if eval test \"x\$"$as_ac_Header"\" = x"yes"; then :
35
+  cat >>confdefs.h <<_ACEOF
36
+#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
37
+_ACEOF
38
+ DEFINES="$DEFINES -DHAVE_LINUX_FUTEX_H"
39
 fi
40
 
41
+done
42
 
43
 
44
 # Check whether --enable-selinux was given.
3
@@ -23308,7 +23308,7 @@ fi
45
@@ -23308,7 +23308,7 @@ fi
4
 
46
 
5
 
47
 
Lines 9-34 Link Here
9
     dri3_default=yes
51
     dri3_default=yes
10
     ;;
52
     ;;
11
 *)
53
 *)
12
@@ -27028,9 +27028,19 @@ if test "x$enable_opencl" = xyes; then
13
         as_fn_error $? "cannot enable OpenCL without Gallium" "$LINENO" 5
14
     fi
15
 
16
+    if test "x$acv_mesa_CLANG" = xno; then
17
+
18
+    GCC_VERSION=`$CC -dumpversion`
19
+    if test $? -eq 0; then
20
+        GCC_VERSION_MAJOR=`echo $GCC_VERSION | cut -d. -f1`
21
+        GCC_VERSION_MINOR=`echo $GCC_VERSION | cut -d. -f2`
22
+    fi
23
+
24
     if test $GCC_VERSION_MAJOR -lt 4 -o $GCC_VERSION_MAJOR -eq 4 -a $GCC_VERSION_MINOR -lt 7; then
25
         as_fn_error $? "gcc >= 4.7 is required to build clover" "$LINENO" 5
26
     fi
27
+# end of clang test.
28
+    fi
29
 
30
     if test "x$have_libclc" = xno; then
31
         as_fn_error $? "pkg-config cannot find libclc.pc which is required to build clover.
32
@@ -27096,9 +27106,6 @@ rm -f core conftest.err conftest.$ac_obj
54
@@ -27096,9 +27106,6 @@ rm -f core conftest.err conftest.$ac_obj
33
         CLANG_LIBDIR=${LLVM_LIBDIR}
55
         CLANG_LIBDIR=${LLVM_LIBDIR}
34
     fi
56
     fi
(-)b/graphics/mesa-dri/files/patch-src_amd_vulkan_winsys_amdgpu_radv__amdgpu__cs.c (+14 lines)
Added Link Here
1
- Define ETIME if missing
2
3
--- src/amd/vulkan/winsys/amdgpu/radv_amdgpu_cs.c.orig	2018-01-23 18:08:49 UTC
4
+++ src/amd/vulkan/winsys/amdgpu/radv_amdgpu_cs.c
5
@@ -33,6 +33,9 @@
6
 #include "radv_amdgpu_bo.h"
7
 #include "sid.h"
8
 
9
+#ifndef ETIME
10
+#define ETIME ETIMEDOUT
11
+#endif
12
 
13
 enum {
14
 	VIRTUAL_BUFFER_HASH_TABLE_SIZE = 1024
(-)b/graphics/mesa-dri/files/patch-src_egl_drivers_dri2_platform__x11.c (-3 / +3 lines)
Lines 1-10 Link Here
1
# work-around for https://bugs.freedesktop.org/show_bug.cgi?id=100627
1
# work-around for https://bugs.freedesktop.org/show_bug.cgi?id=100627
2
#
2
#
3
--- src/egl/drivers/dri2/platform_x11.c.orig	2017-12-21 17:31:21 UTC
3
--- src/egl/drivers/dri2/platform_x11.c.orig	2018-01-23 18:08:49 UTC
4
+++ src/egl/drivers/dri2/platform_x11.c
4
+++ src/egl/drivers/dri2/platform_x11.c
5
@@ -1462,7 +1462,11 @@ dri2_initialize_x11(_EGLDriver *drv, _EG
5
@@ -1466,7 +1466,11 @@ dri2_initialize_x11(_EGLDriver *drv, _EGLDisplay *disp
6
 
6
 
7
    if (!disp->Options.UseFallback) {
7
    if (!disp->Options.ForceSoftware) {
8
 #ifdef HAVE_DRI3
8
 #ifdef HAVE_DRI3
9
+#if (defined(__FreeBSD__) || defined(__FreeBSD_kernel__)) && !defined(__DRM_NEXT__)
9
+#if (defined(__FreeBSD__) || defined(__FreeBSD_kernel__)) && !defined(__DRM_NEXT__)
10
+      if (env_var_as_boolean("LIBGL_DRI3_ENABLE", false) && !env_var_as_boolean("LIBGL_DRI3_DISABLE", false))
10
+      if (env_var_as_boolean("LIBGL_DRI3_ENABLE", false) && !env_var_as_boolean("LIBGL_DRI3_DISABLE", false))
(-)b/graphics/mesa-dri/files/patch-src_gallium_auxiliary_util_u__network.c (-3 / +3 lines)
Lines 1-9 Link Here
1
--- src/gallium/auxiliary/util/u_network.c.orig	2016-11-10 22:05:17 UTC
1
--- src/gallium/auxiliary/util/u_network.c.orig	2018-01-23 18:08:49 UTC
2
+++ src/gallium/auxiliary/util/u_network.c
2
+++ src/gallium/auxiliary/util/u_network.c
3
@@ -6,7 +6,7 @@
3
@@ -9,7 +9,7 @@
4
 #if defined(PIPE_SUBSYSTEM_WINDOWS_USER)
5
 #  include <winsock2.h>
4
 #  include <winsock2.h>
6
 #  include <windows.h>
5
 #  include <windows.h>
6
 #  include <ws2tcpip.h>
7
-#elif defined(PIPE_OS_LINUX) || defined(PIPE_OS_HAIKU) || \
7
-#elif defined(PIPE_OS_LINUX) || defined(PIPE_OS_HAIKU) || \
8
+#elif defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) || defined(PIPE_OS_HAIKU) || \
8
+#elif defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) || defined(PIPE_OS_HAIKU) || \
9
    defined(PIPE_OS_APPLE) || defined(PIPE_OS_CYGWIN) || defined(PIPE_OS_SOLARIS)
9
    defined(PIPE_OS_APPLE) || defined(PIPE_OS_CYGWIN) || defined(PIPE_OS_SOLARIS)
(-)a/graphics/mesa-dri/files/patch-src_gallium_winsys_svga_drm_vmw__screen__ioctl.c (-14 lines)
Removed Link Here
1
--- src/gallium/winsys/svga/drm/vmw_screen_ioctl.c.orig	2016-11-10 22:05:17 UTC
2
+++ src/gallium/winsys/svga/drm/vmw_screen_ioctl.c
3
@@ -70,6 +70,11 @@ vmw_region_size(struct vmw_region *regio
4
    return region->size;
5
 }
6
 
7
+#if defined(__DragonFly__) || defined(__FreeBSD__) || \
8
+    defined(__NetBSD__) || defined(__OpenBSD__)
9
+#define ERESTART EINTR
10
+#endif
11
+
12
 uint32
13
 vmw_ioctl_context_create(struct vmw_winsys_screen *vws)
14
 {
(-)b/graphics/mesa-dri/files/patch-src_intel_compiler_brw__fs__bank__conflicts.cpp (+18 lines)
Added Link Here
1
compiler/brw_fs_bank_conflicts.cpp:719:25: error: scalar initializer cannot be empty
2
      vector_type s_p = {}, s_n = {};
3
                        ^~
4
compiler/brw_fs_bank_conflicts.cpp:719:35: error: scalar initializer cannot be empty
5
      vector_type s_p = {}, s_n = {};
6
                                  ^~
7
8
--- src/intel/compiler/brw_fs_bank_conflicts.cpp.orig	2018-01-23 18:08:50 UTC
9
+++ src/intel/compiler/brw_fs_bank_conflicts.cpp
10
@@ -716,7 +716,7 @@ namespace {
11
                    const weight_vector_type &conflicts)
12
    {
13
       const unsigned m = DIV_ROUND_UP(conflicts.size, vector_width);
14
-      vector_type s_p = {}, s_n = {};
15
+      vector_type s_p = {0}, s_n = {0};
16
 
17
       for (unsigned r = 0; r < m; r++) {
18
          s_p = adds(s_p, mask(bank_mask_p.v[r], conflicts.v[r]));
(-)b/graphics/mesa-dri/files/patch-src_intel_tools_aubinator.c (-1 / +1 lines)
Lines 3-9 Link Here
3
#
3
#
4
--- src/intel/tools/aubinator.c.orig	2017-10-02 15:49:02 UTC
4
--- src/intel/tools/aubinator.c.orig	2017-10-02 15:49:02 UTC
5
+++ src/intel/tools/aubinator.c
5
+++ src/intel/tools/aubinator.c
6
@@ -1237,7 +1237,7 @@ int main(int argc, char *argv[])
6
@@ -637,7 +637,7 @@ int main(int argc, char *argv[])
7
    /* mmap a terabyte for our gtt space. */
7
    /* mmap a terabyte for our gtt space. */
8
    gtt_size = 1ull << 40;
8
    gtt_size = 1ull << 40;
9
    gtt = mmap(NULL, gtt_size, PROT_READ | PROT_WRITE,
9
    gtt = mmap(NULL, gtt_size, PROT_READ | PROT_WRITE,
(-)b/graphics/mesa-dri/files/patch-src_intel_vulkan_anv__allocator.c (-51 / +4 lines)
Lines 1-30 Link Here
1
- Partially implement sys_futex() via _umtx_op()
2
- Partially implement memfd_create() via mkostemp()
1
- Partially implement memfd_create() via mkostemp()
3
- Ignore MAP_POPULATE if unsupported
2
- Ignore MAP_POPULATE if unsupported
4
3
5
--- src/intel/vulkan/anv_allocator.c.orig	2017-08-12 16:09:52 UTC
4
--- src/intel/vulkan/anv_allocator.c.orig	2018-01-23 18:08:50 UTC
6
+++ src/intel/vulkan/anv_allocator.c
5
+++ src/intel/vulkan/anv_allocator.c
7
@@ -26,12 +26,31 @@
6
@@ -25,9 +25,21 @@
8
 #include <unistd.h>
7
 #include <unistd.h>
9
 #include <limits.h>
8
 #include <limits.h>
10
 #include <assert.h>
9
 #include <assert.h>
11
+#ifdef __linux__
10
+#ifdef __linux__
12
 #include <linux/futex.h>
13
 #include <linux/memfd.h>
11
 #include <linux/memfd.h>
14
+#endif
15
 #include <sys/time.h>
16
 #include <sys/mman.h>
17
+#ifdef __linux__
18
 #include <sys/syscall.h>
19
+#else
12
+#else
20
+#include <fcntl.h>
13
+#include <fcntl.h>
21
+#endif
14
+#endif
15
 #include <sys/mman.h>
22
 
16
 
23
+#ifdef __FreeBSD__
24
+#include <errno.h>
25
+#include <sys/umtx.h>
26
+#endif
27
+
28
+#ifndef MAP_POPULATE
17
+#ifndef MAP_POPULATE
29
+#define MAP_POPULATE 0
18
+#define MAP_POPULATE 0
30
+#endif
19
+#endif
Lines 36-78 Link Here
36
 #include "anv_private.h"
25
 #include "anv_private.h"
37
 
26
 
38
 #include "util/hash_table.h"
27
 #include "util/hash_table.h"
39
@@ -112,6 +131,8 @@ struct anv_mmap_cleanup {
28
@@ -113,7 +125,29 @@ struct anv_mmap_cleanup {
40
 
41
 #define ANV_MMAP_CLEANUP_INIT ((struct anv_mmap_cleanup){0})
42
 
43
+#if defined(__linux__)
44
+
45
 static inline long
46
 sys_futex(void *addr1, int op, int val1,
47
           struct timespec *timeout, void *addr2, int val3)
48
@@ -131,11 +152,56 @@ futex_wait(uint32_t *addr, int32_t value)
49
    return sys_futex(addr, FUTEX_WAIT, value, NULL, NULL, 0);
50
 }
51
 
52
+#elif defined(__FreeBSD__)
53
+
54
+/* Based on libxshmfence */
55
+
56
+static inline int
57
+sys_futex(void *addr, int op, int32_t val)
58
+{
59
+   return _umtx_op(addr, op, (uint32_t)val, NULL, NULL) == -1 ? errno : 0;
60
+}
61
+
62
+static inline int
63
+futex_wake(uint32_t *addr, int count)
64
+{
65
+   return sys_futex(addr, UMTX_OP_WAKE, count);
66
+}
67
+
68
+static inline int
69
+futex_wait(uint32_t *addr, int32_t value)
70
+{
71
+   return sys_futex(addr, UMTX_OP_WAIT_UINT, value);
72
+}
73
+#endif
74
+
75
 #ifndef HAVE_MEMFD_CREATE
76
 static inline int
29
 static inline int
77
 memfd_create(const char *name, unsigned int flags)
30
 memfd_create(const char *name, unsigned int flags)
78
 {
31
 {
(-)b/graphics/mesa-dri/files/patch-src_intel_vulkan_anv__device.c (-3 / +3 lines)
Lines 1-7 Link Here
1
- Without sysinfo() fall back to sysconf()
1
- Without sysinfo() fall back to sysconf()
2
- Define ETIME if missing
2
- Define ETIME if missing
3
3
4
--- src/intel/vulkan/anv_device.c.orig	2017-08-12 16:09:52 UTC
4
--- src/intel/vulkan/anv_device.c.orig	2018-01-23 18:08:50 UTC
5
+++ src/intel/vulkan/anv_device.c
5
+++ src/intel/vulkan/anv_device.c
6
@@ -25,7 +25,9 @@
6
@@ -25,7 +25,9 @@
7
 #include <stdbool.h>
7
 #include <stdbool.h>
Lines 13-19 Link Here
13
 #include <unistd.h>
13
 #include <unistd.h>
14
 #include <fcntl.h>
14
 #include <fcntl.h>
15
 #include <xf86drm.h>
15
 #include <xf86drm.h>
16
@@ -39,6 +41,10 @@
16
@@ -40,6 +42,10 @@
17
 
17
 
18
 #include "genxml/gen7_pack.h"
18
 #include "genxml/gen7_pack.h"
19
 
19
 
Lines 24-30 Link Here
24
 static void
24
 static void
25
 compiler_debug_log(void *data, const char *fmt, ...)
25
 compiler_debug_log(void *data, const char *fmt, ...)
26
 { }
26
 { }
27
@@ -73,10 +79,15 @@ anv_compute_heap_size(int fd, uint64_t *heap_size)
27
@@ -75,10 +81,15 @@ anv_compute_heap_size(int fd, uint64_t *heap_size)
28
    }
28
    }
29
 
29
 
30
    /* Query the total ram from the system */
30
    /* Query the total ram from the system */
(-)b/graphics/mesa-dri/files/patch-src_util_futex.h (+48 lines)
Added Link Here
1
- Implement futex_wake() and futex_wait() via _umtx_op()
2
3
--- src/util/futex.h.orig	2018-01-23 18:08:50 UTC
4
+++ src/util/futex.h
5
@@ -29,10 +29,35 @@
6
 #include <limits.h>
7
 #include <stdint.h>
8
 #include <unistd.h>
9
+#if defined(__FreeBSD__)
10
+# if __FreeBSD__ < 11
11
+#  include <machine/atomic.h>
12
+# endif
13
+#include <errno.h>
14
+#include <sys/umtx.h>
15
+#else
16
 #include <linux/futex.h>
17
 #include <sys/syscall.h>
18
+#endif
19
 #include <sys/time.h>
20
 
21
+#if defined(__FreeBSD__)
22
+static inline int futex_wake(uint32_t *addr, int count)
23
+{
24
+   return _umtx_op(addr, UMTX_OP_WAKE, (uint32_t)count, NULL, NULL) == -1 ? errno : 0;
25
+}
26
+
27
+static inline int futex_wait(uint32_t *addr, int32_t value, struct timespec *timeout)
28
+{
29
+   void *uaddr = NULL, *uaddr2 = NULL;
30
+   if (timeout != NULL) {
31
+      const struct _umtx_time tmo = { ._clockid = CLOCK_MONOTONIC, ._flags = UMTX_ABSTIME, ._timeout = *timeout };
32
+      uaddr = (void *)(uintptr_t)sizeof(tmo);
33
+      uaddr2 = (void *)&tmo;
34
+   }
35
+   return _umtx_op(addr, UMTX_OP_WAIT_UINT, (uint32_t)value, uaddr, uaddr2) == -1 ? errno : 0;
36
+}
37
+#else
38
 static inline long sys_futex(void *addr1, int op, int val1, const struct timespec *timeout, void *addr2, int val3)
39
 {
40
    return syscall(SYS_futex, addr1, op, val1, timeout, addr2, val3);
41
@@ -50,6 +75,7 @@ static inline int futex_wait(uint32_t *addr, int32_t v
42
    return sys_futex(addr, FUTEX_WAIT_BITSET, value, timeout, NULL,
43
                     FUTEX_BITSET_MATCH_ANY);
44
 }
45
+#endif
46
 
47
 #endif
48
 
(-)b/graphics/mesa-dri/files/patch-src_util_os__time.c (+22 lines)
Added Link Here
1
- Use monotonic clock for timeouts
2
3
--- src/util/os_time.c.orig	2018-01-23 18:08:50 UTC
4
+++ src/util/os_time.c
5
@@ -55,7 +55,7 @@
6
 int64_t
7
 os_time_get_nano(void)
8
 {
9
-#if defined(PIPE_OS_LINUX)
10
+#if defined(PIPE_OS_BSD) || defined(PIPE_OS_LINUX)
11
 
12
    struct timespec tv;
13
    clock_gettime(CLOCK_MONOTONIC, &tv);
14
@@ -95,7 +95,7 @@ os_time_get_nano(void)
15
 void
16
 os_time_sleep(int64_t usecs)
17
 {
18
-#if defined(PIPE_OS_LINUX)
19
+#if defined(HAVE_CLOCK_NANOSLEEP)
20
    struct timespec time;
21
    time.tv_sec = usecs / 1000000;
22
    time.tv_nsec = (usecs % 1000000) * 1000;
(-)a/graphics/mesa-dri/files/patch-src_util_u__endian.h (-11 lines)
Removed Link Here
1
--- src/util/u_endian.h.orig	2016-11-10 22:05:17 UTC
2
+++ src/util/u_endian.h
3
@@ -54,7 +54,7 @@
4
 # define PIPE_ARCH_BIG_ENDIAN
5
 #endif
6
 
7
-#elif defined(__OpenBSD__) || defined(__NetBSD__)
8
+#elif defined(__OpenBSD__) || defined(__NetBSD__) || defined(__FreeBSD__) || defined(__DragonFly__)
9
 #include <sys/types.h>
10
 #include <machine/endian.h>
11
 
(-)b/graphics/mesa-dri/files/patch-src_util_u__thread.h (+39 lines)
Added Link Here
1
- Implement setting thread name
2
- Use monotonic clock for timeouts
3
4
--- src/util/u_thread.h.orig	2018-02-09 02:18:00 UTC
5
+++ src/util/u_thread.h
6
@@ -34,7 +34,11 @@
7
 
8
 #ifdef HAVE_PTHREAD
9
 #include <signal.h>
10
+#if defined(__DragonFly__) || defined(__FreeBSD__) || defined(__OpenBSD__)
11
+#include <pthread_np.h>
12
+#undef ALIGN /* Avoid conflict on FreeBSD in main/macros.h */
13
 #endif
14
+#endif
15
 
16
 
17
 static inline thrd_t u_thread_create(int (*routine)(void *), void *param)
18
@@ -65,6 +69,12 @@ static inline void u_thread_setname( const char *name 
19
       (__GLIBC__ >= 3 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 12)) && \
20
       defined(__linux__)
21
    pthread_setname_np(pthread_self(), name);
22
+#  elif defined(__sun)
23
+   pthread_setname_np(pthread_self(), name);
24
+#  elif defined(__DragonFly__) || defined(__FreeBSD__) || defined(__OpenBSD__)
25
+   pthread_set_name_np(pthread_self(), name);
26
+#  elif defined(__NetBSD__)
27
+   pthread_setname_np(pthread_self(), "%s", (void*)name);
28
 #  endif
29
 #endif
30
    (void)name;
31
@@ -78,7 +88,7 @@ static inline void u_thread_setname( const char *name 
32
 static inline int64_t
33
 u_thread_get_time_nano(thrd_t thread)
34
 {
35
-#if defined(__linux__) && defined(HAVE_PTHREAD)
36
+#if defined(HAVE_PTHREAD)
37
    struct timespec ts;
38
    clockid_t cid;
39
 

Return to bug 225415