[Request] mesa-for-android-termux(bionic)
@lfdevs Hello sir, I’ve been using GPU acceleration for the Adreno series very well in the PRoot-Distro environment thanks to the package you distributed!
Would it be possible for you to build A8xx Turnip and A8xx Freedreno (kgsl) that work in the Termux bionic environment, not in PRoot/Chroot/LXC?
In my case, I run Linux programs from a PRoot-Distro Debian container inside Termux-Desktop (XFCE4), so if possible, I hope Termux itself can also run A8xx Turnip and A8xx Freedreno (kgsl) in the same way.
Currently, the Mesa package distributed in the Termux main-repo is an official stable release version, so it will take a very long time for A8xx support to be included. Therefore, I would really appreciate it if you could create a Termux binary package that already includes the Adreno Gen8 series support changes.
Please consider this request. Thank you.
For the Turnip driver, you can use the mesa package built in this PR: https://github.com/lfdevs/termux-packages/pull/2
For the Freedreno (KGSL) driver, I plan to attempt building for Termux Native after resolving the current issue in this repository of "using two sets of source code to separately compile unpatched Turnip and patched Freedreno (KGSL)". Because after applying the original Termux:X11 DRI3 patch to newer versions of Mesa, on Adreno 7xx/8xx, only Freedreno (KGSL) works, while Turnip (Vulkan) does not.
Although in theory, unpatched Turnip and patched Freedreno (KGSL) can coexist under Termux Native + Bionic just as they do in the PRoot + Glibc environment, for the convenience of packaging and installation, I have decided to attempt this only after resolving the issue, which may take a long time.
@lfdevs Thank you! I'll test Turnip after work today!
@lfdevs i build & install freedreno kgsl for Termux native
LDFLAGS="$LDFLAGS -landroid-shmem" meson --prefix=$PREFIX -Dplatforms=x11,wayland -Dbuildtype=release -Degl-native-platform=x11 -Dgallium-drivers=freedreno -Dvulkan-drivers= -Dfreedreno-kmds=kgsl -Dshader-cache=enabled -Dgles1=enabled -Dgles2=enabled -Dopengl=true -Dgbm=enabled -Dglx=dri -Degl=enabled -Dglvnd=disabled -Dmicrosoft-clc=disabled -Dllvm=disabled -Dshared-llvm=disabled -Dc_args='-Wno-error=incompatible-function-pointer-types -Wno-error=implicit-function-declaration' -Dallow-kcmp=disabled -Dandroid-libbacktrace=disabled -Dexpat=disabled -Dandroid-stub=false -Dandroid-strict=false -Dperfetto=false -Dsysprof=false -Dgpuvis=false -Dandroid-libperfetto=disabled
Simple used os detection patches
diff --git a/include/vulkan/vk_android_native_buffer.h b/include/vulkan/vk_android_native_buffer.h
index 21f82ef..8920746 100644
--- a/include/vulkan/vk_android_native_buffer.h
+++ b/include/vulkan/vk_android_native_buffer.h
@@ -17,7 +17,8 @@
* system rather the build target.
*/
-#if defined(__ANDROID__) || defined(ANDROID)
+//#if defined(__ANDROID__) || defined(ANDROID)
+#if 0
#include <cutils/native_handle.h>
#if ANDROID_API_LEVEL < 28
diff --git a/src/gallium/targets/dri/dri.sym.in b/src/gallium/targets/dri/dri.sym.in
index d987668..4d33c60 100644
--- a/src/gallium/targets/dri/dri.sym.in
+++ b/src/gallium/targets/dri/dri.sym.in
@@ -6,8 +6,8 @@
_mesa_glapi_get_proc_offset;
_mesa_glapi_set_context;
_mesa_glapi_set_dispatch;
- _mesa_glapi_tls_Context;
- _mesa_glapi_tls_Dispatch;
+ __emutls_v._mesa_glapi_tls_Context;
+ __emutls_v._mesa_glapi_tls_Dispatch;
ddebug_screen_create;
noop_screen_create;
diff --git a/src/util/detect_os.h b/src/util/detect_os.h
index 7403724..d91f9b5 100644
--- a/src/util/detect_os.h
+++ b/src/util/detect_os.h
@@ -24,7 +24,8 @@
* Android defines __linux__, so DETECT_OS_LINUX and DETECT_OS_POSIX will
* also be defined.
*/
-#if defined(__ANDROID__)
+//#if defined(__ANDROID__)
+#if 0
#define DETECT_OS_ANDROID 1
#endif
diff --git a/src/util/os_file.c b/src/util/os_file.c
index d3d3fb0..cb7c29a 100644
--- a/src/util/os_file.c
+++ b/src/util/os_file.c
@@ -6,7 +6,7 @@
#include "os_file.h"
#include "detect_os.h"
#include "util/detect.h"
-
+#include <sys/epoll.h>
#include <errno.h>
#include <fcntl.h>
#include <stdlib.h>
@@ -34,6 +34,9 @@
#endif
#endif
+//#ifndef EPOLL_CLOEXEC
+//#define EPOLL_CLOEXEC 02000000
+//#endif
FILE *
os_file_create_unique(const char *filename, int filemode)
Driver working
termux@android:~$ glmark2
MESA: error: kgsl_pipe_get_param:103: invalid param id: 13
=======================================================
glmark2 2023.01
=======================================================
OpenGL Information
GL_VENDOR: freedreno
GL_RENDERER: FD735
GL_VERSION: 4.6 (Compatibility Profile) Mesa 26.1.0-devel (git-7a610c0e6d)
Surface Config: buf=32 r=8 g=8 b=8 a=8 depth=24 stencil=0 samples=0
Surface Size: 800x600 windowed
=======================================================
[build] use-vbo=false: FPS: 2260 FrameTime: 0.443 ms
[build] use-vbo=true: FPS: 2157 FrameTime: 0.464 ms
[texture] texture-filter=nearest:^C
Glxinfo & eglinfo
termux@android:~$ glxinfo -B
name of display: :0
MESA: error: kgsl_pipe_get_param:103: invalid param id: 13
display: :0 screen: 0
direct rendering: Yes
Extended renderer info (GLX_MESA_query_renderer):
Vendor: freedreno (0x5143)
Device: FD735 (0xffffffff)
Version: 26.1.0
Accelerated: yes
Video memory: 11272MB
Unified memory: yes
Preferred profile: core (0x1)
Max core profile version: 4.6
Max compat profile version: 4.6
Max GLES1 profile version: 1.1
Max GLES[23] profile version: 3.2
Memory info (GL_ATI_meminfo):
VBO free memory - total: 11272 MB, largest block: 11272 MB
VBO free aux. memory - total: 0 MB, largest block: 0 MB
Texture free memory - total: 11272 MB, largest block: 11272 MB
Texture free aux. memory - total: 0 MB, largest block: 0 MB
Renderbuffer free memory - total: 11272 MB, largest block: 11272 MB
Renderbuffer free aux. memory - total: 0 MB, largest block: 0 MB
Memory info (GL_NVX_gpu_memory_info):
Dedicated video memory: 11272 MB
Total available memory: 11272 MB
Currently available dedicated video memory: 11272 MB
OpenGL vendor string: freedreno
OpenGL renderer string: FD735
OpenGL core profile version string: 4.6 (Core Profile) Mesa 26.1.0-devel (git-7a610c0e6d)
OpenGL core profile shading language version string: 4.60
OpenGL core profile context flags: (none)
OpenGL core profile profile mask: core profile
OpenGL version string: 4.6 (Compatibility Profile) Mesa 26.1.0-devel (git-7a610c0e6d)
OpenGL shading language version string: 4.60
OpenGL context flags: (none)
OpenGL profile mask: compatibility profile
OpenGL ES profile version string: OpenGL ES 3.2 Mesa 26.1.0-devel (git-7a610c0e6d)
OpenGL ES profile shading language version string: OpenGL ES GLSL ES 3.20
os_same_file_description couldn't determine if two DRM fds reference the same file description. (Operation not permitted)
Let's just assume that file descriptors for the same file probablyshare the file description instead. This may cause problems whenthat isn't the case.
termux@android:~$ eglinfo -B
GBM platform:
MESA: error: kgsl_pipe_get_param:103: invalid param id: 13
EGL API version: 1.5
EGL vendor string: Mesa Project
EGL version string: 1.5
EGL client APIs: OpenGL OpenGL_ES
OpenGL core profile vendor: freedreno
OpenGL core profile renderer: FD735
OpenGL core profile version: 4.6 (Core Profile) Mesa 26.1.0-devel (git-7a610c0e6d)
OpenGL core profile shading language version: 4.60
OpenGL compatibility profile vendor: freedreno
OpenGL compatibility profile renderer: FD735
OpenGL compatibility profile version: 4.6 (Compatibility Profile) Mesa 26.1.0-devel (git-7a610c0e6d)
OpenGL compatibility profile shading language version: 4.60
OpenGL ES profile vendor: freedreno
OpenGL ES profile renderer: FD735
OpenGL ES profile version: OpenGL ES 3.2 Mesa 26.1.0-devel (git-7a610c0e6d) OpenGL ES profile shading language version: OpenGL ES GLSL ES 3.20
os_same_file_description couldn't determine if two DRM fds reference the same file description. (Operation not permitted)
Let's just assume that file descriptors for the same file probablyshare the file description instead. This may cause problems whenthat isn't the case.
Wayland platform:
eglinfo: eglInitialize failed
X11 platform:
MESA: error: kgsl_pipe_get_param:103: invalid param id: 13
EGL API version: 1.5
EGL vendor string: Mesa Project
EGL version string: 1.5
EGL client APIs: OpenGL OpenGL_ES
OpenGL core profile vendor: freedreno
OpenGL core profile renderer: FD735
OpenGL core profile version: 4.6 (Core Profile) Mesa 26.1.0-devel (git-7a610c0e6d) OpenGL core profile shading language version: 4.60
OpenGL compatibility profile vendor: freedreno
OpenGL compatibility profile renderer: FD735
OpenGL compatibility profile version: 4.6 (Compatibility Profile) Mesa 26.1.0-devel (git-7a610c0e6d)
OpenGL compatibility profile shading language version: 4.60
OpenGL ES profile vendor: freedreno
OpenGL ES profile renderer: FD735
OpenGL ES profile version: OpenGL ES 3.2 Mesa 26.1.0-devel (git-7a610c0e6d)
OpenGL ES profile shading language version: OpenGL ES GLSL ES 3.20
Surfaceless platform:
Segmentation fault eglinfo -B
termux@android:~$
But having some issues with native wine.. unable to run furmark fully glitched
https://github.com/user-attachments/assets/8a2f590a-942b-437a-be39-12c9bae3ca1a
But having some issues with native wine.. unable to run
furmarkfully glitched
Is it work with native + turnip + zink or proot + freedreno? I haven't done any testing related to Wine for the drivers in this repository before.
But having some issues with native wine.. unable to run
furmarkfully glitchedIs it work with native + turnip + zink or proot + freedreno? I haven't done any testing related to Wine for the drivers in this repository before.
Will test and give you report one by one
But having some issues with native wine.. unable to run
furmarkfully glitchedIs it work with native + turnip + zink or proot + freedreno? I haven't done any testing related to Wine for the drivers in this repository before.
Just tested Proot + zink (turnip) not working Proot + freedreno not working Termux native + zink (turnip) not working Termux native + freedreno not working
Simple inside Termux not working
Working inside winlator cmod bionic container
More update for Termux native.. Hangover-wine have issue definitely.. I used another wine it's works with native Termux but with turnip not works anything.. Only works with mesa vulkan wrapper (adreno tools driver) works
@lfdevs update!
This is actually was wine issue..
Your driver actually compatible with wine.. And yes freedreno surfaceless platform always failed.. is it possible to fix ?
write(1, "Surfaceless platform:\n", 22Surfaceless platform: ) = 22
openat(AT_FDCWD, "/dev/dri", O_RDONLY|O_CLOEXEC|O_DIRECTORY) = -1 EACCES (Permission denied)
openat(AT_FDCWD, "/dev/kgsl-3d0", O_RDWR|O_CLOEXEC) = 3
--- SIGSEGV {si_signo=SIGSEGV, si_code=SEGV_MAPERR, si_addr=NULL} --- socket(AF_UNIX, SOCK_DGRAM|SOCK_CLOEXEC|SOCK_NONBLOCK, 0) = 4
connect(4, {sa_family=AF_UNIX, sun_path="/dev/socket/logdw"}, 110) = 0 writev(4, [{iov_base="\0", iov_len=1}, {iov_base="Cw", iov_len=2}, {iov_base="\227J,j\224\227\350\3", iov_len=8}, {iov_base="\4", iov_len=1}, {iov_base="libc\0", iov_len=5}, {iov_base="handling signal: 11\0", iov_len=20}], 6) = 37 close(4) = 0
rt_sigaction(SIGSEGV, NULL, {sa_handler=0x7358c80ab4, sa_mask=~[KILL STOP], sa_flags=SA_ONSTACK|SA_RESTART|SA_SIGINFO|0x800}, 8) = 0 prctl(PR_GET_NO_NEW_PRIVS, 0, 0, 0, 0) = 0
openat(AT_FDCWD, "/proc/self/comm", O_RDONLY|O_CLOEXEC) = 4
read(4, "eglinfo\n", 17) = 8
close(4) = 0 getpid() = 30531
prctl(PR_GET_NAME, "eglinfo") = 0
gettid() = 30531
socket(AF_UNIX, SOCK_DGRAM|SOCK_CLOEXEC|SOCK_NONBLOCK, 0) = 4 connect(4, {sa_family=AF_UNIX, sun_path="/dev/socket/logdw"}, 110) = 0
writev(4, [{iov_base="\4", iov_len=1}, {iov_base="Cw", iov_len=2}, {iov_base="\227J,j\306\374\t\4", iov_len=8}, {iov_base="\7", iov_len=1}, {iov_base="libc\0", iov_len=5}, {iov_base="Fatal signal 11 (SIGSEGV), code "..., iov_len=108}], 6) = 125 close(4) = 0
gettid() = 30531
prctl(PR_GET_DUMPABLE) = 1 (SUID_DUMP_USER) prctl(PR_SET_DUMPABLE, SUID_DUMP_USER) = 0
prctl(PR_SET_PTRACER, PR_SET_PTRACER_ANY) = -1 EINVAL (Invalid argument) clone(child_stack=0x7357aa6fe0, flags=CLONE_VM|CLONE_SIGHAND|CLONE_THREAD|CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID, child_tidptr=0x7358b65af4) = 30548 futex(0x7358b65af4, FUTEX_WAIT, 4294967295, NULL) = 0
futex(0x7358b65af4, FUTEX_WAIT, 30548, NULL) = -1 EAGAIN (Try again)
prctl(PR_SET_DUMPABLE, SUID_DUMP_USER) = 0 rt_sigaction(SIGSEGV, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=SA_RESTART}, {sa_handler=0x7358c80ab4, sa_mask=~[KILL STOP], sa_flags=SA_ONSTACK|SA_RESTART|SA_SIGINFO|0x800}, 8) = 0
getpid() = 30531 gettid() = 30531
rt_tgsigqueueinfo(30531, 30531, SIGSEGV, {si_signo=SIGSEGV, si_code=SEGV_MAPERR, si_addr=NULL}) = 0 rt_sigreturn({mask=[RTMIN]}) = 12970367421675358320
--- SIGSEGV {si_signo=SIGSEGV, si_code=SEGV_MAPERR, si_addr=NULL} --- +++ killed by SIGSEGV +++ Segmentation fault MESA_LOADER_DRIVER_OVERRIDE=kgsl strace eglinfo -B
For the Turnip driver, you can use the
mesapackage built in this PR: lfdevs/termux-packages#2For the Freedreno (KGSL) driver, I plan to attempt building for Termux Native after resolving the current issue in this repository of "using two sets of source code to separately compile unpatched Turnip and patched Freedreno (KGSL)". Because after applying the original Termux:X11 DRI3 patch to newer versions of Mesa, on Adreno 7xx/8xx, only Freedreno (KGSL) works, while Turnip (Vulkan) does not.
Although in theory, unpatched Turnip and patched Freedreno (KGSL) can coexist under Termux Native + Bionic just as they do in the PRoot + Glibc environment, for the convenience of packaging and installation, I have decided to attempt this only after resolving the issue, which may take a long time.
Update: I opened this draft PR on it just now: https://github.com/lfdevs/termux-packages/pull/25