Skip to content

Commit

Permalink
mesa: replace pthread patch with b tread simpler and better every sin…
Browse files Browse the repository at this point in the history
…gle bionic packet has this patch

use BIONIC instead of ANDROID i still have no idea what the point is with this remake i wish all my drivers had a GNU libc version i can't even load them from glibc is it possible have you been able to load the Vulkan driver from glibc all drivers are bionic

try to focus on the important adding virpipe to this packet

only glibc has virpipe GALLIUM_DRIVER=virpipe has no effect here sigh
  • Loading branch information
john-peterson committed Feb 2, 2025
1 parent 6ba08e9 commit a6a29c8
Showing 1 changed file with 15 additions and 85 deletions.
100 changes: 15 additions & 85 deletions packages/mesa/0006-wsi-no-pthread_cancel.patch
Original file line number Diff line number Diff line change
@@ -1,85 +1,15 @@
+++ ./src/vulkan/wsi/wsi_common_display.c
@@ -176,6 +176,12 @@

static uint64_t fence_sequence;

+#ifdef __ANDROID__
+static void thread_signal_handler (int signum) {
+ pthread_exit (0);
+}
+#endif
+
ICD_DEFINE_NONDISP_HANDLE_CASTS(wsi_display_mode, VkDisplayModeKHR)
ICD_DEFINE_NONDISP_HANDLE_CASTS(wsi_display_connector, VkDisplayKHR)

@@ -1341,7 +1347,9 @@
.events = POLLIN
};

+#ifndef __ANDROID__
pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, NULL);
+#endif
for (;;) {
int ret = poll(&pollfd, 1, -1);
if (ret > 0) {
@@ -1369,9 +1377,22 @@
static void
wsi_display_stop_wait_thread(struct wsi_display *wsi)
{
+#ifdef __ANDROID__
+ struct sigaction actions;
+ memset (&actions, 0, sizeof (actions));
+ sigemptyset (&actions.sa_mask);
+ actions.sa_flags = 0;
+ actions.sa_handler = thread_signal_handler;
+ sigaction (SIGUSR2, &actions, NULL);
+#endif
+
mtx_lock(&wsi->wait_mutex);
if (wsi->wait_thread) {
+#ifndef __ANDROID__
pthread_cancel(wsi->wait_thread);
+#else
+ pthread_kill(wsi->wait_thread, SIGUSR2);
+#endif
pthread_join(wsi->wait_thread, NULL);
wsi->wait_thread = 0;
}
@@ -2215,7 +2236,9 @@

int udev_fd = udev_monitor_get_fd(mon);

+#ifndef __ANDROID__
pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, NULL);
+#endif

for (;;) {
nfds_t nfds = 1;
@@ -2340,6 +2363,15 @@
struct wsi_display *wsi =
(struct wsi_display *) wsi_device->wsi[VK_ICD_WSI_PLATFORM_DISPLAY];

+#ifdef __ANDROID__
+ struct sigaction actions;
+ memset (&actions, 0, sizeof (actions));
+ sigemptyset (&actions.sa_mask);
+ actions.sa_flags = 0;
+ actions.sa_handler = thread_signal_handler;
+ sigaction (SIGUSR2, &actions, NULL);
+#endif
+
if (wsi) {
wsi_for_each_connector(connector, wsi) {
wsi_for_each_display_mode(mode, connector) {
@@ -2351,7 +2383,11 @@
wsi_display_stop_wait_thread(wsi);

if (wsi->hotplug_thread) {
+#ifndef __ANDROID__
pthread_cancel(wsi->hotplug_thread);
+#else
+ pthread_kill(wsi->hotplug_thread, SIGUSR2);
+#endif
pthread_join(wsi->hotplug_thread, NULL);
}

diff --git a/src/vulkan/wsi/wsi_common_display.h b/src/vulkan/wsi/wsi_common_display.h
index dd54b9b..897497b 100644
--- a/src/vulkan/wsi/wsi_common_display.h
+++ b/src/vulkan/wsi/wsi_common_display.h
@@ -26,7 +26,9 @@
#include "wsi_common.h"
#include <xf86drm.h>
#include <xf86drmMode.h>
-
+#if __BIONIC__
+#include <bthread.h>
+#endif
struct vk_sync;

/* VK_EXT_display_control */

0 comments on commit a6a29c8

Please sign in to comment.