pkgsrc-WIP-changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

wip/mesa: Fix NetBSD build with vulkan option * vulkaninfo from graphics/vulkan-tools gets segfault. * vkcube and vkcubepp work with lvp (software rendering).



Module Name:	pkgsrc-wip
Committed By:	Ryo ONODERA <ryoon%NetBSD.org@localhost>
Pushed By:	ryoon
Date:		Sat Oct 24 02:16:15 2026 +0900
Changeset:	3418691579af0e9d3c76df2a12b35007a9418274

Modified Files:
	mesa/distinfo
Added Files:
	mesa/patches/patch-src_util_futex.c
	mesa/patches/patch-src_util_futex.h
	mesa/patches/patch-src_vulkan_wsi_wsi__common__wayland.c

Log Message:
wip/mesa: Fix NetBSD build with vulkan option
* vulkaninfo from graphics/vulkan-tools gets segfault.
* vkcube and vkcubepp work with lvp (software rendering).

To see a diff of this commit:
https://wip.pkgsrc.org/cgi-bin/gitweb.cgi?p=pkgsrc-wip.git;a=commitdiff;h=3418691579af0e9d3c76df2a12b35007a9418274

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

diffstat:
 mesa/distinfo                                      |  3 ++
 mesa/patches/patch-src_util_futex.c                | 45 ++++++++++++++++++++++
 mesa/patches/patch-src_util_futex.h                | 15 ++++++++
 .../patch-src_vulkan_wsi_wsi__common__wayland.c    | 20 ++++++++++
 4 files changed, 83 insertions(+)

diffs:
diff --git a/mesa/distinfo b/mesa/distinfo
index 89ca42813d..af4095d5b4 100644
--- a/mesa/distinfo
+++ b/mesa/distinfo
@@ -13,4 +13,7 @@ SHA1 (patch-src_glx_glxcurrent.c) = be95c084b834275ca65a38f446487c68889e1ab5
 SHA1 (patch-src_intel_compiler_gen_gen__private.h) = a45ad64b465ba0bc55b55bdecc35e75eae797af4
 SHA1 (patch-src_panfrost_perf_pan__perf.h) = 93294e8b121f9b01a3d1abf8d257a5f917c530cb
 SHA1 (patch-src_util_build__id.c) = 7a9547bbda9d2fb9f0018ccf27b70b59e497aa2c
+SHA1 (patch-src_util_futex.c) = 4ad0d60e008fe8b5a4bb600e32e8f155d6c95b37
+SHA1 (patch-src_util_futex.h) = a4a2827406102d855bb8afadecb7ce5a42fd5ecd
 SHA1 (patch-src_util_os__file.c) = c80d88255a8f800d1e36fc199f3869ecdb61d203
+SHA1 (patch-src_vulkan_wsi_wsi__common__wayland.c) = 1b8017f21855e01183a2343af64cf7fc8ca13ebe
diff --git a/mesa/patches/patch-src_util_futex.c b/mesa/patches/patch-src_util_futex.c
new file mode 100644
index 0000000000..edd3770a77
--- /dev/null
+++ b/mesa/patches/patch-src_util_futex.c
@@ -0,0 +1,45 @@
+$NetBSD$
+
+* Add futex support functions for NetBSD.
+
+--- src/util/futex.c.orig	2026-10-23 06:41:48.873423635 +0000
++++ src/util/futex.c
+@@ -151,6 +151,38 @@ int futex_wait(uint32_t *addr, int32_t value, const st
+    return GetLastError() == ERROR_TIMEOUT ? ETIMEDOUT : -1;
+ }
+ 
++#elif defined(__NetBSD__)
++#include <unistd.h>
++#include <sys/syscall.h>
++#include <sys/futex.h>
++#include <sys/time.h>
++
++static int futex(uint32_t *uaddr, int op, int val, const struct timespec *timeout,
++                 int *uaddr2, int val3)
++{
++   return syscall(SYS___futex, uaddr, op, val, timeout, uaddr2, val3);
++}
++
++int futex_wake(uint32_t *addr, int32_t count)
++{
++   return futex(addr, FUTEX_WAKE, count, NULL, NULL, 0);
++}
++
++int futex_wait(uint32_t *addr, int32_t value, const struct timespec *timeout)
++{
++   struct timespec tsnow, tsrel;
++
++   if (timeout == NULL)
++      return futex(addr, FUTEX_WAIT, value, NULL, NULL, 0);
++
++   clock_gettime(CLOCK_MONOTONIC, &tsnow);
++   if (timespeccmp(&tsnow, timeout, <))
++      timespecsub(timeout, &tsnow, &tsrel);
++   else
++      timespecclear(&tsrel);
++   return futex(addr, FUTEX_WAIT, value, &tsrel, NULL, 0);
++}
++
+ #else
+ #error UTIL_FUTEX_SUPPORTED is not implemented but the header told it is supported on this platform
+ #endif
diff --git a/mesa/patches/patch-src_util_futex.h b/mesa/patches/patch-src_util_futex.h
new file mode 100644
index 0000000000..98d80f7f6b
--- /dev/null
+++ b/mesa/patches/patch-src_util_futex.h
@@ -0,0 +1,15 @@
+$NetBSD$
+
+* Support futex_wake() for NetBSD.
+
+--- src/util/futex.h.orig	2026-10-23 06:40:10.243611849 +0000
++++ src/util/futex.h
+@@ -35,6 +35,8 @@
+ #define UTIL_FUTEX_SUPPORTED 1
+ #elif defined(_WIN32) && !defined(WINDOWS_NO_FUTEX)
+ #define UTIL_FUTEX_SUPPORTED 1
++#elif defined(__NetBSD__)
++#define UTIL_FUTEX_SUPPORTED 1
+ #else
+ #define UTIL_FUTEX_SUPPORTED 0
+ #endif
diff --git a/mesa/patches/patch-src_vulkan_wsi_wsi__common__wayland.c b/mesa/patches/patch-src_vulkan_wsi_wsi__common__wayland.c
new file mode 100644
index 0000000000..c3594efb89
--- /dev/null
+++ b/mesa/patches/patch-src_vulkan_wsi_wsi__common__wayland.c
@@ -0,0 +1,20 @@
+$NetBSD$
+
+* Fix build under NetBSD.
+
+--- src/vulkan/wsi/wsi_common_wayland.c.orig	2026-10-23 06:28:38.886516782 +0000
++++ src/vulkan/wsi/wsi_common_wayland.c
+@@ -22,6 +22,13 @@
+  * IN THE SOFTWARE.
+  */
+ 
++/*
++ * NetBSD has no CLOCK_MONOTONIC_RAW.
++ */
++#if !defined(CLOCK_MONOTONIC_RAW)
++#define CLOCK_MONOTONIC_RAW	-1
++#endif
++
+ #include <wayland-client.h>
+ 
+ #include <assert.h>


Home | Main Index | Thread Index | Old Index