Skip to content
This repository was archived by the owner on Jan 16, 2026. It is now read-only.

Commit f4b1fdb

Browse files
Add 'libadrenotools' and a wrapper with adrenotools, Enable 'gst-plugins-bad', Use llvm-mingw 20240619 instead of Red Rose MinGW
1 parent bbf2c8a commit f4b1fdb

14 files changed

+517
-2
lines changed

build-all.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ setupBuildEnv()
2626

2727
tar -xf "cache/$MINGW_FILENAME" -C "cache"
2828

29-
mv "cache/$(tar -tf "cache/$MINGW_FILENAME" | cut -d "/" -f 1 | head -n 1)/$(tar -tf "cache/$MINGW_FILENAME" | cut -d "/" -f 2 | head -n 1)" "cache/mingw"
29+
mv "cache/$(tar -tf "cache/$MINGW_FILENAME" | cut -d "/" -f 1 | head -n 1)" "cache/mingw"
3030

3131
rm -f "cache/$MINGW_FILENAME"
3232

@@ -481,7 +481,7 @@ fi
481481

482482
export NDK_URL="https://dl.google.com/android/repository/android-ndk-r26b-linux.zip"
483483
export NDK_FILENAME="${NDK_URL##*/}"
484-
export MINGW_URL="http://techer.pascal.free.fr/Red-Rose_MinGW-w64-Toolchain/Red-Rose-MinGW-w64-Posix-Urct-v12.0.0.r458.g03d8a40f5-Gcc-11.5.0.tar.xz"
484+
export MINGW_URL="https://github.com/mstorsjo/llvm-mingw/releases/download/20240619/llvm-mingw-20240619-ucrt-ubuntu-20.04-x86_64.tar.xz"
485485
export MINGW_FILENAME="${MINGW_URL##*/}"
486486

487487
export PACKAGES="$(cat packages/index)"

packages/index

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ mesa-vulkan-freedreno
5757
mesa-vulkan-radeon
5858
mesa-vulkan-wrapper-rev8
5959
mesa-vulkan-wrapper-rev9
60+
libadrenotools
6061
mesa-vulkan-wrapper
6162
mesa-zink
6263
pcre2
@@ -66,6 +67,7 @@ gstreamer
6667
gst-plugins-base
6768
gst-plugins-good
6869
gst-plugins-ugly
70+
gst-plugins-bad
6971
box64
7072
wine
7173
libandroid-wordexp
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
diff -uNr libadrenotools/CMakeLists.txt libadrenotools-mod/CMakeLists.txt
2+
--- libadrenotools/CMakeLists.txt 2025-02-22 00:49:47.364769744 +0000
3+
+++ libadrenotools-mod/CMakeLists.txt 2025-02-22 01:19:37.538558903 +0000
4+
@@ -10,6 +10,8 @@
5+
6+
add_subdirectory(lib/linkernsbypass)
7+
8+
+set_property(TARGET linkernsbypass PROPERTY POSITION_INDEPENDENT_CODE ON)
9+
+
10+
set(LIB_SOURCES src/bcenabler.cpp
11+
src/driver.cpp
12+
include/adrenotools/bcenabler.h

packages/libadrenotools/build.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
PKG_VER=v1.0
2+
3+
GIT_URL=https://github.com/bylaws/libadrenotools
4+
GIT_COMMIT=8fae8ce254dfc1344527e05301e43f37dea2df80
5+
6+
CMAKE_ARGS=" "
7+
BLACKLIST_ARCHITECTURE=x86_64
8+
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
mkdir -p $DESTDIR/$PREFIX/lib
2+
mkdir -p $DESTDIR/$PREFIX/include
3+
4+
cp libadrenotools.a $DESTDIR/$PREFIX/lib
5+
cp lib/linkernsbypass/liblinkerbypass.a $DESTDIR/$PREFIX/lib
6+
cp src/hook/*.so $DESTDIR/$PREFIX/lib
7+
cp -rf ../include/* $DESTDIR/$PREFIX/include
8+
cp ../lib/linkernsbypass/android_linker_ns.h $DESTDIR/$PREFIX/include
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
diff --git a/bin/install_megadrivers.py b/bin/install_megadrivers.py
2+
index 216f6999feb..c79e95d1afd 100644
3+
--- a/bin/install_megadrivers.py
4+
+++ b/bin/install_megadrivers.py
5+
@@ -24,7 +24,16 @@
6+
7+
import argparse
8+
import os
9+
+import shutil
10+
+
11+
+def link(src, dest):
12+
+ shutil.copyfile(src, dest)
13+
14+
+def unlink(src):
15+
+ os.remove(src)
16+
+
17+
+os.link = link
18+
+os.unlink = unlink
19+
20+
def resolve_libdir(libdir):
21+
if os.path.isabs(libdir):
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
diff --git a/meson.build b/meson.build
2+
index 66e14c211d2..7e73daf221a 100644
3+
--- a/meson.build
4+
+++ b/meson.build
5+
@@ -1354,7 +1354,7 @@ if not ['linux'].contains(host_machine.system())
6+
endif
7+
endif
8+
9+
-foreach h : ['xlocale.h', 'linux/futex.h', 'endian.h', 'dlfcn.h', 'sys/shm.h',
10+
+foreach h : ['linux/futex.h', 'endian.h', 'dlfcn.h', 'sys/shm.h',
11+
'cet.h', 'pthread_np.h', 'sys/inotify.h', 'linux/udmabuf.h']
12+
if cc.check_header(h)
13+
pre_args += '-DHAVE_@0@'.format(h.to_upper().underscorify())
14+
@@ -1364,11 +1364,9 @@ endforeach
15+
functions_to_detect = {
16+
'strtof': '',
17+
'mkostemp': '',
18+
- 'memfd_create': '',
19+
'random_r': '',
20+
'flock': '',
21+
'strtok_r': '',
22+
- 'getrandom': '',
23+
'qsort_s': '',
24+
'posix_fallocate': '',
25+
'secure_getenv': '',
Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
diff --git a/src/vulkan/wsi/wsi_common_display.c b/src/vulkan/wsi/wsi_common_display.c
2+
index ff57a259046..4703500f374 100644
3+
--- a/src/vulkan/wsi/wsi_common_display.c
4+
+++ b/src/vulkan/wsi/wsi_common_display.c
5+
@@ -176,6 +176,12 @@ struct wsi_display_sync {
6+
7+
static uint64_t fence_sequence;
8+
9+
+#ifdef __ANDROID__
10+
+static void thread_signal_handler (int signum) {
11+
+ pthread_exit (0);
12+
+}
13+
+#endif
14+
+
15+
ICD_DEFINE_NONDISP_HANDLE_CASTS(wsi_display_mode, VkDisplayModeKHR)
16+
ICD_DEFINE_NONDISP_HANDLE_CASTS(wsi_display_connector, VkDisplayKHR)
17+
18+
@@ -1341,7 +1347,9 @@ wsi_display_wait_thread(void *data)
19+
.events = POLLIN
20+
};
21+
22+
+#ifndef __ANDROID__
23+
pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, NULL);
24+
+#endif
25+
for (;;) {
26+
int ret = poll(&pollfd, 1, -1);
27+
if (ret > 0) {
28+
@@ -1369,9 +1377,22 @@ wsi_display_start_wait_thread(struct wsi_display *wsi)
29+
static void
30+
wsi_display_stop_wait_thread(struct wsi_display *wsi)
31+
{
32+
+#ifdef __ANDROID__
33+
+ struct sigaction actions;
34+
+ memset (&actions, 0, sizeof (actions));
35+
+ sigemptyset (&actions.sa_mask);
36+
+ actions.sa_flags = 0;
37+
+ actions.sa_handler = thread_signal_handler;
38+
+ sigaction (SIGUSR2, &actions, NULL);
39+
+#endif
40+
+
41+
mtx_lock(&wsi->wait_mutex);
42+
if (wsi->wait_thread) {
43+
+#ifndef __ANDROID__
44+
pthread_cancel(wsi->wait_thread);
45+
+#else
46+
+ pthread_kill(wsi->wait_thread, SIGUSR2);
47+
+#endif
48+
pthread_join(wsi->wait_thread, NULL);
49+
wsi->wait_thread = 0;
50+
}
51+
@@ -2215,7 +2236,9 @@ udev_event_listener_thread(void *data)
52+
53+
int udev_fd = udev_monitor_get_fd(mon);
54+
55+
+#ifndef __ANDROID__
56+
pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, NULL);
57+
+#endif
58+
59+
for (;;) {
60+
nfds_t nfds = 1;
61+
@@ -2340,6 +2363,15 @@ wsi_display_finish_wsi(struct wsi_device *wsi_device,
62+
struct wsi_display *wsi =
63+
(struct wsi_display *) wsi_device->wsi[VK_ICD_WSI_PLATFORM_DISPLAY];
64+
65+
+#ifdef __ANDROID__
66+
+ struct sigaction actions;
67+
+ memset (&actions, 0, sizeof (actions));
68+
+ sigemptyset (&actions.sa_mask);
69+
+ actions.sa_flags = 0;
70+
+ actions.sa_handler = thread_signal_handler;
71+
+ sigaction (SIGUSR2, &actions, NULL);
72+
+#endif
73+
+
74+
if (wsi) {
75+
wsi_for_each_connector(connector, wsi) {
76+
wsi_for_each_display_mode(mode, connector) {
77+
@@ -2351,7 +2383,11 @@ wsi_display_finish_wsi(struct wsi_device *wsi_device,
78+
wsi_display_stop_wait_thread(wsi);
79+
80+
if (wsi->hotplug_thread) {
81+
+#ifndef __ANDROID__
82+
pthread_cancel(wsi->hotplug_thread);
83+
+#else
84+
+ pthread_kill(wsi->hotplug_thread, SIGUSR2);
85+
+#endif
86+
pthread_join(wsi->hotplug_thread, NULL);
87+
}
88+
Lines changed: 146 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,146 @@
1+
diff --git a/src/vulkan/wrapper/wrapper_physical_device.c b/src/vulkan/wrapper/wrapper_physical_device.c
2+
index 56a18847154..fcb2ac60a30 100644
3+
--- a/src/vulkan/wrapper/wrapper_physical_device.c
4+
+++ b/src/vulkan/wrapper/wrapper_physical_device.c
5+
@@ -155,7 +155,7 @@ VkResult enumerate_physical_device(struct vk_instance *_instance)
6+
}
7+
pdevice->vk.wsi_device = &pdevice->wsi_device;
8+
pdevice->wsi_device.force_bgra8_unorm_first = true;
9+
-#ifdef __TERMUX__
10+
+#ifdef __ANDROID__
11+
pdevice->wsi_device.wants_ahardware_buffer = true;
12+
#endif
13+
14+
diff --git a/src/vulkan/wsi/wsi_common.c b/src/vulkan/wsi/wsi_common.c
15+
index 113b208f27b..8b09e3dcd66 100644
16+
--- a/src/vulkan/wsi/wsi_common.c
17+
+++ b/src/vulkan/wsi/wsi_common.c
18+
@@ -47,7 +47,7 @@
19+
#include <unistd.h>
20+
#endif
21+
22+
-#ifdef __TERMUX__
23+
+#ifdef __ANDROID__
24+
#include <android/hardware_buffer.h>
25+
#endif
26+
27+
@@ -225,7 +225,7 @@ wsi_device_init(struct wsi_device *wsi,
28+
WSI_GET_CB(UnmapMemory);
29+
if (wsi->khr_present_wait)
30+
WSI_GET_CB(WaitSemaphores);
31+
-#ifdef __TERMUX__
32+
+#ifdef __ANDROID__
33+
WSI_GET_CB(GetMemoryAndroidHardwareBufferANDROID);
34+
WSI_GET_CB(GetAndroidHardwareBufferPropertiesANDROID);
35+
#endif
36+
@@ -394,7 +394,7 @@ get_blit_type(const struct wsi_device *wsi,
37+
return wsi_cpu_image_needs_buffer_blit(wsi, cpu_params) ?
38+
WSI_SWAPCHAIN_BUFFER_BLIT : WSI_SWAPCHAIN_NO_BLIT;
39+
}
40+
-#ifdef __TERMUX__
41+
+#ifdef __ANDROID__
42+
case WSI_IMAGE_TYPE_AHB: {
43+
return wsi_get_ahardware_buffer_blit_type(wsi, params, device);
44+
}
45+
@@ -432,7 +432,7 @@ configure_image(const struct wsi_swapchain *chain,
46+
container_of(params, const struct wsi_cpu_image_params, base);
47+
return wsi_configure_cpu_image(chain, pCreateInfo, cpu_params, info);
48+
}
49+
-#ifdef __TERMUX__
50+
+#ifdef __ANDROID__
51+
case WSI_IMAGE_TYPE_AHB: {
52+
return wsi_configure_ahardware_buffer_image(chain, pCreateInfo, params, info);
53+
}
54+
@@ -736,7 +736,7 @@ wsi_destroy_image_info(const struct wsi_swapchain *chain,
55+
vk_free(&chain->alloc, info->modifier_props);
56+
info->modifier_props = NULL;
57+
}
58+
-#ifdef __TERMUX__
59+
+#ifdef __ANDROID__
60+
if (info->ahardware_buffer_desc != NULL) {
61+
vk_free(&chain->alloc, info->ahardware_buffer_desc);
62+
info->ahardware_buffer_desc = NULL;
63+
@@ -804,7 +804,7 @@ wsi_destroy_image(const struct wsi_swapchain *chain,
64+
{
65+
const struct wsi_device *wsi = chain->wsi;
66+
67+
-#ifdef __TERMUX__
68+
+#ifdef __ANDROID__
69+
if (image->ahardware_buffer)
70+
AHardwareBuffer_release(image->ahardware_buffer);
71+
#endif
72+
diff --git a/src/vulkan/wsi/wsi_common.h b/src/vulkan/wsi/wsi_common.h
73+
index 2c0626761d7..0a795bb5712 100644
74+
--- a/src/vulkan/wsi/wsi_common.h
75+
+++ b/src/vulkan/wsi/wsi_common.h
76+
@@ -279,7 +279,7 @@ struct wsi_device {
77+
WSI_CB(MapMemory);
78+
WSI_CB(UnmapMemory);
79+
WSI_CB(WaitSemaphores);
80+
-#ifdef __TERMUX__
81+
+#ifdef __ANDROID__
82+
WSI_CB(GetMemoryAndroidHardwareBufferANDROID);
83+
WSI_CB(GetAndroidHardwareBufferPropertiesANDROID);
84+
#endif
85+
diff --git a/src/vulkan/wsi/wsi_common_private.h b/src/vulkan/wsi/wsi_common_private.h
86+
index 74e0363f01a..baa40decbab 100644
87+
--- a/src/vulkan/wsi/wsi_common_private.h
88+
+++ b/src/vulkan/wsi/wsi_common_private.h
89+
@@ -87,7 +87,7 @@ struct wsi_image_info {
90+
VkExternalMemoryImageCreateInfo ext_mem;
91+
VkImageFormatListCreateInfo format_list;
92+
VkImageDrmFormatModifierListCreateInfoEXT drm_mod_list;
93+
-#ifdef __TERMUX__
94+
+#ifdef __ANDROID__
95+
struct AHardwareBuffer_Desc *ahardware_buffer_desc;
96+
#endif
97+
98+
@@ -171,7 +171,7 @@ struct wsi_image {
99+
int dma_buf_fd;
100+
#endif
101+
void *cpu_map;
102+
-#ifdef __TERMUX__
103+
+#ifdef __ANDROID__
104+
struct AHardwareBuffer *ahardware_buffer;
105+
#endif
106+
};
107+
diff --git a/src/vulkan/wsi/wsi_common_x11.c b/src/vulkan/wsi/wsi_common_x11.c
108+
index 34e559cfad6..99cfd79b833 100644
109+
--- a/src/vulkan/wsi/wsi_common_x11.c
110+
+++ b/src/vulkan/wsi/wsi_common_x11.c
111+
@@ -69,7 +69,7 @@
112+
#include <sys/shm.h>
113+
#endif
114+
115+
-#ifdef __TERMUX__
116+
+#ifdef __ANDROID__
117+
#include <android/hardware_buffer.h>
118+
#include <sys/socket.h>
119+
#endif
120+
@@ -2112,7 +2112,7 @@ x11_image_init(VkDevice device_h, struct x11_swapchain *chain,
121+
/* If the image has a modifier, we must have DRI3 v1.2. */
122+
assert(chain->has_dri3_modifiers);
123+
124+
-#ifdef __TERMUX__
125+
+#ifdef __ANDROID__
126+
int sock_fds[2] = { -1, -1 };
127+
if (image->base.ahardware_buffer) {
128+
if (socketpair(AF_UNIX, SOCK_STREAM, 0, sock_fds) < 0) {
129+
@@ -2153,7 +2153,7 @@ x11_image_init(VkDevice device_h, struct x11_swapchain *chain,
130+
chain->depth, bpp,
131+
image->base.drm_modifier,
132+
fds);
133+
-#ifdef __TERMUX__
134+
+#ifdef __ANDROID__
135+
if (image->base.ahardware_buffer) {
136+
xcb_flush(chain->conn);
137+
uint8_t read_buf;
138+
@@ -2666,7 +2666,7 @@ x11_surface_create_swapchain(VkIcdSurfaceBase *icd_surface,
139+
.alloc_shm = wsi_conn->has_mit_shm ? &alloc_shm : NULL,
140+
};
141+
image_params = &cpu_image_params.base;
142+
-#ifdef __TERMUX__
143+
+#ifdef __ANDROID__
144+
} else if (wsi_device->wants_ahardware_buffer) {
145+
image_params = &(struct wsi_base_image_params){
146+
.image_type = WSI_IMAGE_TYPE_AHB,

0 commit comments

Comments
 (0)