From 9a60d0e764ab9bbe3fb3bf5ea67d489997336188 Mon Sep 17 00:00:00 2001 From: xMeM Date: Fri, 8 Nov 2024 17:47:40 +0800 Subject: [PATCH 1/5] addpkg(main/vulkan-wrapper-android): 25.0.0 --- .../0000-disable-android-detection.patch | 13 +++ .../0001-fix-for-anon-file.patch | 16 ++++ .../0002-wsi-no-pthread_cancel.patch | 85 +++++++++++++++++++ ...03-vulkan-x11-disable-immediate-mode.patch | 14 +++ packages/vulkan-wrapper-android/build.sh | 56 ++++++++++++ .../vulkan-wrapper-android/cmake-wrapper.in | 16 ++++ 6 files changed, 200 insertions(+) create mode 100644 packages/vulkan-wrapper-android/0000-disable-android-detection.patch create mode 100644 packages/vulkan-wrapper-android/0001-fix-for-anon-file.patch create mode 100644 packages/vulkan-wrapper-android/0002-wsi-no-pthread_cancel.patch create mode 100644 packages/vulkan-wrapper-android/0003-vulkan-x11-disable-immediate-mode.patch create mode 100644 packages/vulkan-wrapper-android/build.sh create mode 100644 packages/vulkan-wrapper-android/cmake-wrapper.in diff --git a/packages/vulkan-wrapper-android/0000-disable-android-detection.patch b/packages/vulkan-wrapper-android/0000-disable-android-detection.patch new file mode 100644 index 00000000000..9b09c16b899 --- /dev/null +++ b/packages/vulkan-wrapper-android/0000-disable-android-detection.patch @@ -0,0 +1,13 @@ +diff --git a/src/util/detect_os.h b/src/util/detect_os.h +index 86286dfbe70..f589104f6a7 100644 +--- a/src/util/detect_os.h ++++ b/src/util/detect_os.h +@@ -24,7 +24,7 @@ + * Android defines __linux__, so DETECT_OS_LINUX and DETECT_OS_POSIX will + * also be defined. + */ +-#if defined(__ANDROID__) ++#if 0 + #define DETECT_OS_ANDROID 1 + #endif + diff --git a/packages/vulkan-wrapper-android/0001-fix-for-anon-file.patch b/packages/vulkan-wrapper-android/0001-fix-for-anon-file.patch new file mode 100644 index 00000000000..85e6a033df6 --- /dev/null +++ b/packages/vulkan-wrapper-android/0001-fix-for-anon-file.patch @@ -0,0 +1,16 @@ +Fallback to `@TERMUX_PREFIX@/tmp` if env `XDG_RUNTIME_DIR` is not set. + +--- a/src/util/anon_file.c ++++ b/src/util/anon_file.c +@@ -136,6 +136,11 @@ + char *name; + + path = getenv("XDG_RUNTIME_DIR"); ++#ifdef __TERMUX__ ++ if (!path) { ++ path = "@TERMUX_PREFIX@/tmp"; ++ } ++#endif + if (!path) { + errno = ENOENT; + return -1; diff --git a/packages/vulkan-wrapper-android/0002-wsi-no-pthread_cancel.patch b/packages/vulkan-wrapper-android/0002-wsi-no-pthread_cancel.patch new file mode 100644 index 00000000000..2f5b63fe891 --- /dev/null +++ b/packages/vulkan-wrapper-android/0002-wsi-no-pthread_cancel.patch @@ -0,0 +1,85 @@ ++++ ./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/packages/vulkan-wrapper-android/0003-vulkan-x11-disable-immediate-mode.patch b/packages/vulkan-wrapper-android/0003-vulkan-x11-disable-immediate-mode.patch new file mode 100644 index 00000000000..1d0ec0b0676 --- /dev/null +++ b/packages/vulkan-wrapper-android/0003-vulkan-x11-disable-immediate-mode.patch @@ -0,0 +1,14 @@ +diff --git a/src/vulkan/wsi/wsi_common_x11.c b/src/vulkan/wsi/wsi_common_x11.c +index 22ac573cca2..9e0eb25f45f 100644 +--- a/src/vulkan/wsi/wsi_common_x11.c ++++ b/src/vulkan/wsi/wsi_common_x11.c +@@ -462,7 +462,9 @@ static const VkFormat formats[] = { + }; + + static const VkPresentModeKHR present_modes[] = { ++#ifndef __TERMUX__ + VK_PRESENT_MODE_IMMEDIATE_KHR, ++#endif + VK_PRESENT_MODE_MAILBOX_KHR, + VK_PRESENT_MODE_FIFO_KHR, + VK_PRESENT_MODE_FIFO_RELAXED_KHR, diff --git a/packages/vulkan-wrapper-android/build.sh b/packages/vulkan-wrapper-android/build.sh new file mode 100644 index 00000000000..38663f123a0 --- /dev/null +++ b/packages/vulkan-wrapper-android/build.sh @@ -0,0 +1,56 @@ +TERMUX_PKG_HOMEPAGE=https://www.mesa3d.org +TERMUX_PKG_DESCRIPTION="Android Vulkan ICD" +TERMUX_PKG_LICENSE="MIT" +TERMUX_PKG_LICENSE_FILE="docs/license.rst" +TERMUX_PKG_MAINTAINER="xMeM " +TERMUX_PKG_VERSION="25.0.0" +TERMUX_PKG_REVISION=2 +TERMUX_PKG_SRCURL=git+https://github.com/xMeM/mesa +TERMUX_PKG_GIT_BRANCH=wrapper +_COMMIT=e65c7eb6ee2f9903c3256f2677beb1d98464103f +TERMUX_PKG_DEPENDS="libandroid-shmem, libc++, libdrm, libx11, libxcb, libxshmfence, libwayland, vulkan-loader-generic, zlib, zstd" +TERMUX_PKG_BUILD_DEPENDS="libwayland-protocols, libxrandr, xorgproto" +TERMUX_PKG_API_LEVEL=26 + +TERMUX_PKG_EXTRA_CONFIGURE_ARGS=" +--cmake-prefix-path $TERMUX_PREFIX +-Dcpp_rtti=false +-Dgbm=disabled +-Dopengl=false +-Dllvm=disabled +-Dshared-llvm=disabled +-Dplatforms=x11,wayland +-Dgallium-drivers= +-Dxmlconfig=disabled +-Dvulkan-drivers=wrapper +-Db_ndebug=true +" + +termux_step_post_get_source() { + git fetch --unshallow + git checkout $_COMMIT + # Do not use meson wrap projects + rm -rf subprojects +} + +termux_step_pre_configure() { + termux_setup_cmake + + CPPFLAGS+=" -D__USE_GNU" + LDFLAGS+=" -landroid-shmem" + + _WRAPPER_BIN=$TERMUX_PKG_BUILDDIR/_wrapper/bin + mkdir -p $_WRAPPER_BIN + if [ "$TERMUX_ON_DEVICE_BUILD" = "false" ]; then + sed 's|@CMAKE@|'"$(command -v cmake)"'|g' \ + $TERMUX_PKG_BUILDER_DIR/cmake-wrapper.in \ + > $_WRAPPER_BIN/cmake + chmod 0700 $_WRAPPER_BIN/cmake + termux_setup_wayland_cross_pkg_config_wrapper + fi + export PATH=$_WRAPPER_BIN:$PATH +} + +termux_step_post_configure() { + rm -f $_WRAPPER_BIN/cmake +} diff --git a/packages/vulkan-wrapper-android/cmake-wrapper.in b/packages/vulkan-wrapper-android/cmake-wrapper.in new file mode 100644 index 00000000000..7cd20167cc8 --- /dev/null +++ b/packages/vulkan-wrapper-android/cmake-wrapper.in @@ -0,0 +1,16 @@ +#!/bin/sh + +if [ -e CMakeLists.txt ]; then + sed -i '1s|^|project(foo LANGUAGES C CXX)\n|' CMakeLists.txt +fi + +for f in "$@"; do + case "${f}" in + -DCMAKE_TOOLCHAIN_FILE=* ) + sed -i "${f#-DCMAKE_TOOLCHAIN_FILE=}" \ + -e 's|\(set(CMAKE_SYSTEM_NAME\) "Android")|\1 "Linux")|g' + ;; + esac +done + +exec @CMAKE@ "$@" From 680ad751dcf7f0bc25682befdaa52759b9e9791c Mon Sep 17 00:00:00 2001 From: Robert Kirkman <31490854+robertkirkman@users.noreply.github.com> Date: Mon, 2 Feb 2026 12:24:07 +0800 Subject: [PATCH 2/5] fix(main/vulkan-wrapper-android): some build failures The patch is from @robertkirkman: https://github.com/termux/termux-packages/pull/22500#issuecomment-3335562426 --- .../0001-fix-for-anon-file.patch | 16 ++++++++++++++++ packages/vulkan-wrapper-android/build.sh | 7 +++++-- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/packages/vulkan-wrapper-android/0001-fix-for-anon-file.patch b/packages/vulkan-wrapper-android/0001-fix-for-anon-file.patch index 85e6a033df6..10ba5ff54fc 100644 --- a/packages/vulkan-wrapper-android/0001-fix-for-anon-file.patch +++ b/packages/vulkan-wrapper-android/0001-fix-for-anon-file.patch @@ -14,3 +14,19 @@ Fallback to `@TERMUX_PREFIX@/tmp` if env `XDG_RUNTIME_DIR` is not set. if (!path) { errno = ENOENT; return -1; +diff --git a/meson.build b/meson.build +index b9edca30189..dbede3ca76a 100644 +--- a/meson.build ++++ b/meson.build +@@ -1376,11 +1376,9 @@ endforeach + functions_to_detect = { + 'strtof': '', + 'mkostemp': '', +- 'memfd_create': '', + 'random_r': '', + 'flock': '', + 'strtok_r': '', +- 'getrandom': '', + 'qsort_s': '', + 'posix_fallocate': '', + 'secure_getenv': '', diff --git a/packages/vulkan-wrapper-android/build.sh b/packages/vulkan-wrapper-android/build.sh index 38663f123a0..53c3146c7d3 100644 --- a/packages/vulkan-wrapper-android/build.sh +++ b/packages/vulkan-wrapper-android/build.sh @@ -4,7 +4,6 @@ TERMUX_PKG_LICENSE="MIT" TERMUX_PKG_LICENSE_FILE="docs/license.rst" TERMUX_PKG_MAINTAINER="xMeM " TERMUX_PKG_VERSION="25.0.0" -TERMUX_PKG_REVISION=2 TERMUX_PKG_SRCURL=git+https://github.com/xMeM/mesa TERMUX_PKG_GIT_BRANCH=wrapper _COMMIT=e65c7eb6ee2f9903c3256f2677beb1d98464103f @@ -19,7 +18,7 @@ TERMUX_PKG_EXTRA_CONFIGURE_ARGS=" -Dopengl=false -Dllvm=disabled -Dshared-llvm=disabled --Dplatforms=x11,wayland +-Dplatforms=x11 -Dgallium-drivers= -Dxmlconfig=disabled -Dvulkan-drivers=wrapper @@ -36,6 +35,10 @@ termux_step_post_get_source() { termux_step_pre_configure() { termux_setup_cmake + if [ "$TERMUX_ON_DEVICE_BUILD" = "true" ]; then + CFLAGS+=" --target=$TERMUX_HOST_PLATFORM$TERMUX_PKG_API_LEVEL" + fi + CPPFLAGS+=" -D__USE_GNU" LDFLAGS+=" -landroid-shmem" From 28191215b50a873c65e40685966baa51cfa2998d Mon Sep 17 00:00:00 2001 From: nicman23 Date: Mon, 2 Feb 2026 22:36:26 +0800 Subject: [PATCH 3/5] fix(main/vulkan-wrapper-android): physical device enumeration for PowerVR GPUs This patch is from @nicman23: https://gitlab.freedesktop.org/nicman23/mesa/-/commit/d3eec9f0c4a45a96dc6ea7cb4f469e49cf64d3ed The previous implementation used a fixed-size static array of 16 VkPhysicalDevice handles, which could cause a segfault on certain drivers (notably PowerVR DXT-48 on Pixel 10 devices) when the driver's behavior with the pre-allocated array differed from expectations. Replace the static array with dynamic allocation: i. Query the actual device count first by calling EnumeratePhysicalDevices with NULL ii. Allocate the array based on the returned count iii. Handle VK_INCOMPLETE by reallocating with a larger size iv. Add proper error handling and memory cleanup This follows the Vulkan specification more closely and should be more robust across different driver implementations. Fixes: segfault on PowerVR DXT-48 GPU --- ...-device-enumeration-for-PowerVR-GPUs.patch | 91 +++++++++++++++++++ 1 file changed, 91 insertions(+) create mode 100644 packages/vulkan-wrapper-android/0004-fix-physical-device-enumeration-for-PowerVR-GPUs.patch diff --git a/packages/vulkan-wrapper-android/0004-fix-physical-device-enumeration-for-PowerVR-GPUs.patch b/packages/vulkan-wrapper-android/0004-fix-physical-device-enumeration-for-PowerVR-GPUs.patch new file mode 100644 index 00000000000..bb0c0a5bbf1 --- /dev/null +++ b/packages/vulkan-wrapper-android/0004-fix-physical-device-enumeration-for-PowerVR-GPUs.patch @@ -0,0 +1,91 @@ +From 25f05c8e6fffdaa65a1d90668ea6f08fe48a8341 Mon Sep 17 00:00:00 2001 +From: Nikos F +Date: Sat, 31 Jan 2026 17:18:52 +0200 +Subject: [PATCH] Fix powervr gpus - namely the DXT-48 of pixel 10 line it had + a nullptr and it segfaulted if the wrapper just allocated statically a 16 + empty array on physical_devices + +also add some logging +--- + src/vulkan/wrapper/wrapper_physical_device.c | 59 ++++++++++++++++++-- + 1 file changed, 55 insertions(+), 4 deletions(-) + +diff --git a/src/vulkan/wrapper/wrapper_physical_device.c b/src/vulkan/wrapper/wrapper_physical_device.c +index 56a18847154..39bcfdd49be 100644 +--- a/src/vulkan/wrapper/wrapper_physical_device.c ++++ b/src/vulkan/wrapper/wrapper_physical_device.c +@@ -70,16 +70,67 @@ wrapper_wsi_proc_addr(VkPhysicalDevice physicalDevice, const char *pName) + + VkResult enumerate_physical_device(struct vk_instance *_instance) + { +- struct wrapper_instance *instance = (struct wrapper_instance *)_instance; +- VkPhysicalDevice physical_devices[16]; +- uint32_t physical_device_count = 16; ++ struct wrapper_instance *instance = container_of(_instance, struct wrapper_instance, vk); ++ VkPhysicalDevice *physical_devices = NULL; /* Will be allocated after we know the count */ ++ uint32_t physical_device_count = 0; /* Will be set after first call */ + VkResult result; + ++ /* Direct output to make sure we can see this */ ++ fprintf(stderr, "WRAPPER: Entering enumerate_physical_device function\n"); ++ fflush(stderr); ++ ++ if (!instance->dispatch_table.EnumeratePhysicalDevices) { ++ free(physical_devices); /* This will be safe since physical_devices is NULL at this point */ ++ return VK_ERROR_INITIALIZATION_FAILED; ++ } ++ ++ /* First call with NULL to get the actual count */ ++ uint32_t actual_count = 0; ++ result = instance->dispatch_table.EnumeratePhysicalDevices( ++ instance->dispatch_handle, &actual_count, NULL); ++ ++ if (result != VK_SUCCESS && result != VK_INCOMPLETE) { ++ free(physical_devices); /* This will be safe since physical_devices is NULL at this point */ ++ return result; ++ } ++ ++ /* Allocate the physical devices array based on the actual count */ ++ if (actual_count > 0) { ++ physical_devices = malloc(sizeof(VkPhysicalDevice) * actual_count); ++ if (!physical_devices) { ++ return VK_ERROR_OUT_OF_HOST_MEMORY; ++ } ++ physical_device_count = actual_count; ++ } ++ ++ /* Direct output before the call that crashes */ ++ fprintf(stderr, "WRAPPER: About to call EnumeratePhysicalDevices\n"); ++ fflush(stderr); ++ + result = instance->dispatch_table.EnumeratePhysicalDevices( + instance->dispatch_handle, &physical_device_count, physical_devices); + +- if (result != VK_SUCCESS) ++ if (result == VK_INCOMPLETE) { ++ /* Try again with a larger count if we got VK_INCOMPLETE */ ++ uint32_t larger_count = physical_device_count * 2; ++ ++ /* Reallocate the array with the larger size */ ++ VkPhysicalDevice *larger_array = realloc(physical_devices, sizeof(VkPhysicalDevice) * larger_count); ++ if (!larger_array) { ++ free(physical_devices); ++ return VK_ERROR_OUT_OF_HOST_MEMORY; ++ } ++ physical_devices = larger_array; ++ physical_device_count = larger_count; ++ ++ result = instance->dispatch_table.EnumeratePhysicalDevices( ++ instance->dispatch_handle, &physical_device_count, physical_devices); ++ } ++ ++ if (result != VK_SUCCESS) { ++ free(physical_devices); + return result; ++ } + + for (int i = 0; i < physical_device_count; i++) { + PFN_vkGetInstanceProcAddr get_instance_proc_addr; +-- +2.47.3 + From fcd127b937cd5ec8425c958ab4dc6dba1f9a34bf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=CE=9D=CE=B9=CE=BA=CF=8C=CE=BB=CE=B1=CE=BF=CF=82=20=CE=9A?= =?UTF-8?q?=CF=85=CF=81=CE=B9=CE=AC=CE=BA=CE=BF=CF=82=20=CE=A6=CF=85=CF=84?= =?UTF-8?q?=CE=AF=CE=BB=CE=B7=CF=82?= Date: Tue, 3 Mar 2026 16:30:36 +0200 Subject: [PATCH 4/5] Change Upstream to pipetto-crypto --- packages/vulkan-wrapper-android/build.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/vulkan-wrapper-android/build.sh b/packages/vulkan-wrapper-android/build.sh index 53c3146c7d3..7c32db4c49c 100644 --- a/packages/vulkan-wrapper-android/build.sh +++ b/packages/vulkan-wrapper-android/build.sh @@ -4,9 +4,9 @@ TERMUX_PKG_LICENSE="MIT" TERMUX_PKG_LICENSE_FILE="docs/license.rst" TERMUX_PKG_MAINTAINER="xMeM " TERMUX_PKG_VERSION="25.0.0" -TERMUX_PKG_SRCURL=git+https://github.com/xMeM/mesa -TERMUX_PKG_GIT_BRANCH=wrapper -_COMMIT=e65c7eb6ee2f9903c3256f2677beb1d98464103f +TERMUX_PKG_SRCURL=git+https://gitlab.freedesktop.org/Pipetto-crypto/mesa +TERMUX_PKG_GIT_BRANCH=wrapper-25 +_COMMIT=e03c3486fcdab12ba5727765e09f6bea816a7abe TERMUX_PKG_DEPENDS="libandroid-shmem, libc++, libdrm, libx11, libxcb, libxshmfence, libwayland, vulkan-loader-generic, zlib, zstd" TERMUX_PKG_BUILD_DEPENDS="libwayland-protocols, libxrandr, xorgproto" TERMUX_PKG_API_LEVEL=26 From 672eeaa0ca3208595016dd6cc9ba16d79df1ceee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=CE=9D=CE=B9=CE=BA=CF=8C=CE=BB=CE=B1=CE=BF=CF=82=20=CE=9A?= =?UTF-8?q?=CF=85=CF=81=CE=B9=CE=AC=CE=BA=CE=BF=CF=82=20=CE=A6=CF=85=CF=84?= =?UTF-8?q?=CE=AF=CE=BB=CE=B7=CF=82?= Date: Tue, 3 Mar 2026 16:43:07 +0200 Subject: [PATCH 5/5] upstreamed --- .../0000-disable-android-detection.patch | 13 --- .../0001-fix-for-anon-file.patch | 32 ------- .../0002-wsi-no-pthread_cancel.patch | 85 ----------------- ...03-vulkan-x11-disable-immediate-mode.patch | 14 --- ...-device-enumeration-for-PowerVR-GPUs.patch | 91 ------------------- 5 files changed, 235 deletions(-) delete mode 100644 packages/vulkan-wrapper-android/0000-disable-android-detection.patch delete mode 100644 packages/vulkan-wrapper-android/0001-fix-for-anon-file.patch delete mode 100644 packages/vulkan-wrapper-android/0002-wsi-no-pthread_cancel.patch delete mode 100644 packages/vulkan-wrapper-android/0003-vulkan-x11-disable-immediate-mode.patch delete mode 100644 packages/vulkan-wrapper-android/0004-fix-physical-device-enumeration-for-PowerVR-GPUs.patch diff --git a/packages/vulkan-wrapper-android/0000-disable-android-detection.patch b/packages/vulkan-wrapper-android/0000-disable-android-detection.patch deleted file mode 100644 index 9b09c16b899..00000000000 --- a/packages/vulkan-wrapper-android/0000-disable-android-detection.patch +++ /dev/null @@ -1,13 +0,0 @@ -diff --git a/src/util/detect_os.h b/src/util/detect_os.h -index 86286dfbe70..f589104f6a7 100644 ---- a/src/util/detect_os.h -+++ b/src/util/detect_os.h -@@ -24,7 +24,7 @@ - * Android defines __linux__, so DETECT_OS_LINUX and DETECT_OS_POSIX will - * also be defined. - */ --#if defined(__ANDROID__) -+#if 0 - #define DETECT_OS_ANDROID 1 - #endif - diff --git a/packages/vulkan-wrapper-android/0001-fix-for-anon-file.patch b/packages/vulkan-wrapper-android/0001-fix-for-anon-file.patch deleted file mode 100644 index 10ba5ff54fc..00000000000 --- a/packages/vulkan-wrapper-android/0001-fix-for-anon-file.patch +++ /dev/null @@ -1,32 +0,0 @@ -Fallback to `@TERMUX_PREFIX@/tmp` if env `XDG_RUNTIME_DIR` is not set. - ---- a/src/util/anon_file.c -+++ b/src/util/anon_file.c -@@ -136,6 +136,11 @@ - char *name; - - path = getenv("XDG_RUNTIME_DIR"); -+#ifdef __TERMUX__ -+ if (!path) { -+ path = "@TERMUX_PREFIX@/tmp"; -+ } -+#endif - if (!path) { - errno = ENOENT; - return -1; -diff --git a/meson.build b/meson.build -index b9edca30189..dbede3ca76a 100644 ---- a/meson.build -+++ b/meson.build -@@ -1376,11 +1376,9 @@ endforeach - functions_to_detect = { - 'strtof': '', - 'mkostemp': '', -- 'memfd_create': '', - 'random_r': '', - 'flock': '', - 'strtok_r': '', -- 'getrandom': '', - 'qsort_s': '', - 'posix_fallocate': '', - 'secure_getenv': '', diff --git a/packages/vulkan-wrapper-android/0002-wsi-no-pthread_cancel.patch b/packages/vulkan-wrapper-android/0002-wsi-no-pthread_cancel.patch deleted file mode 100644 index 2f5b63fe891..00000000000 --- a/packages/vulkan-wrapper-android/0002-wsi-no-pthread_cancel.patch +++ /dev/null @@ -1,85 +0,0 @@ -+++ ./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/packages/vulkan-wrapper-android/0003-vulkan-x11-disable-immediate-mode.patch b/packages/vulkan-wrapper-android/0003-vulkan-x11-disable-immediate-mode.patch deleted file mode 100644 index 1d0ec0b0676..00000000000 --- a/packages/vulkan-wrapper-android/0003-vulkan-x11-disable-immediate-mode.patch +++ /dev/null @@ -1,14 +0,0 @@ -diff --git a/src/vulkan/wsi/wsi_common_x11.c b/src/vulkan/wsi/wsi_common_x11.c -index 22ac573cca2..9e0eb25f45f 100644 ---- a/src/vulkan/wsi/wsi_common_x11.c -+++ b/src/vulkan/wsi/wsi_common_x11.c -@@ -462,7 +462,9 @@ static const VkFormat formats[] = { - }; - - static const VkPresentModeKHR present_modes[] = { -+#ifndef __TERMUX__ - VK_PRESENT_MODE_IMMEDIATE_KHR, -+#endif - VK_PRESENT_MODE_MAILBOX_KHR, - VK_PRESENT_MODE_FIFO_KHR, - VK_PRESENT_MODE_FIFO_RELAXED_KHR, diff --git a/packages/vulkan-wrapper-android/0004-fix-physical-device-enumeration-for-PowerVR-GPUs.patch b/packages/vulkan-wrapper-android/0004-fix-physical-device-enumeration-for-PowerVR-GPUs.patch deleted file mode 100644 index bb0c0a5bbf1..00000000000 --- a/packages/vulkan-wrapper-android/0004-fix-physical-device-enumeration-for-PowerVR-GPUs.patch +++ /dev/null @@ -1,91 +0,0 @@ -From 25f05c8e6fffdaa65a1d90668ea6f08fe48a8341 Mon Sep 17 00:00:00 2001 -From: Nikos F -Date: Sat, 31 Jan 2026 17:18:52 +0200 -Subject: [PATCH] Fix powervr gpus - namely the DXT-48 of pixel 10 line it had - a nullptr and it segfaulted if the wrapper just allocated statically a 16 - empty array on physical_devices - -also add some logging ---- - src/vulkan/wrapper/wrapper_physical_device.c | 59 ++++++++++++++++++-- - 1 file changed, 55 insertions(+), 4 deletions(-) - -diff --git a/src/vulkan/wrapper/wrapper_physical_device.c b/src/vulkan/wrapper/wrapper_physical_device.c -index 56a18847154..39bcfdd49be 100644 ---- a/src/vulkan/wrapper/wrapper_physical_device.c -+++ b/src/vulkan/wrapper/wrapper_physical_device.c -@@ -70,16 +70,67 @@ wrapper_wsi_proc_addr(VkPhysicalDevice physicalDevice, const char *pName) - - VkResult enumerate_physical_device(struct vk_instance *_instance) - { -- struct wrapper_instance *instance = (struct wrapper_instance *)_instance; -- VkPhysicalDevice physical_devices[16]; -- uint32_t physical_device_count = 16; -+ struct wrapper_instance *instance = container_of(_instance, struct wrapper_instance, vk); -+ VkPhysicalDevice *physical_devices = NULL; /* Will be allocated after we know the count */ -+ uint32_t physical_device_count = 0; /* Will be set after first call */ - VkResult result; - -+ /* Direct output to make sure we can see this */ -+ fprintf(stderr, "WRAPPER: Entering enumerate_physical_device function\n"); -+ fflush(stderr); -+ -+ if (!instance->dispatch_table.EnumeratePhysicalDevices) { -+ free(physical_devices); /* This will be safe since physical_devices is NULL at this point */ -+ return VK_ERROR_INITIALIZATION_FAILED; -+ } -+ -+ /* First call with NULL to get the actual count */ -+ uint32_t actual_count = 0; -+ result = instance->dispatch_table.EnumeratePhysicalDevices( -+ instance->dispatch_handle, &actual_count, NULL); -+ -+ if (result != VK_SUCCESS && result != VK_INCOMPLETE) { -+ free(physical_devices); /* This will be safe since physical_devices is NULL at this point */ -+ return result; -+ } -+ -+ /* Allocate the physical devices array based on the actual count */ -+ if (actual_count > 0) { -+ physical_devices = malloc(sizeof(VkPhysicalDevice) * actual_count); -+ if (!physical_devices) { -+ return VK_ERROR_OUT_OF_HOST_MEMORY; -+ } -+ physical_device_count = actual_count; -+ } -+ -+ /* Direct output before the call that crashes */ -+ fprintf(stderr, "WRAPPER: About to call EnumeratePhysicalDevices\n"); -+ fflush(stderr); -+ - result = instance->dispatch_table.EnumeratePhysicalDevices( - instance->dispatch_handle, &physical_device_count, physical_devices); - -- if (result != VK_SUCCESS) -+ if (result == VK_INCOMPLETE) { -+ /* Try again with a larger count if we got VK_INCOMPLETE */ -+ uint32_t larger_count = physical_device_count * 2; -+ -+ /* Reallocate the array with the larger size */ -+ VkPhysicalDevice *larger_array = realloc(physical_devices, sizeof(VkPhysicalDevice) * larger_count); -+ if (!larger_array) { -+ free(physical_devices); -+ return VK_ERROR_OUT_OF_HOST_MEMORY; -+ } -+ physical_devices = larger_array; -+ physical_device_count = larger_count; -+ -+ result = instance->dispatch_table.EnumeratePhysicalDevices( -+ instance->dispatch_handle, &physical_device_count, physical_devices); -+ } -+ -+ if (result != VK_SUCCESS) { -+ free(physical_devices); - return result; -+ } - - for (int i = 0; i < physical_device_count; i++) { - PFN_vkGetInstanceProcAddr get_instance_proc_addr; --- -2.47.3 -