Hardware Acceleration in Termux
Note: This section collects information gathered during ongoing research. Hardware acceleration is a large and complex topic. If you notice any errors or misconceptions, please comment on YouTube or Telegram, or open an issue on GitHub.
1. Install Required Packages
Install the following packages in Termux:
pkg install mesa-zink virglrenderer-mesa-zink vulkan-loader-android virglrenderer-android
2. Initialize the Graphical Server in Termux
Before logging into a proot distribution and using hardware acceleration, you must start a graphical server in Termux.
Vulkan (ZINK)
MESA_NO_ERROR=1 \
MESA_GL_VERSION_OVERRIDE=4.3COMPAT \
MESA_GLES_VERSION_OVERRIDE=3.2 \
GALLIUM_DRIVER=zink \
ZINK_DESCRIPTORS=lazy \
virgl_test_server --use-egl-surfaceless --use-gles &
OpenGL (VIRGL)
virgl_test_server_android &
Turnip (Adreno 6xx / 7xx Only)
No graphical server initialization is required. Follow the steps described in the Reddit post below.
Summary:
-
Download the Turnip driver:
mesa-vulkan-kgsl_23.3.0-devel-20230905_arm64.deb -
Install it inside the proot-distro (example for Debian):
sudo dpkg -i mesa-vulkan-kgsl_23.3.0-devel-20230905_arm64.deb
To remove the driver:
sudo dpkg -r mesa-vulkan-drivers:arm64
3. Inside proot-distro
Start the desktop environment using a script. If starting manually, ensure the temporary directory is shared.
./startxfce4_debian.sh
To run a program with hardware acceleration:
VIRGL or ZINK
GALLIUM_DRIVER=virpipe MESA_GL_VERSION_OVERRIDE=4.0 program
Turnip
MESA_LOADER_DRIVER_OVERRIDE=zink TU_DEBUG=noconform program
Performance Results
Device: Lenovo Legion Y700 (2022) Snapdragon 870 – Adreno 650
GLMARK2
Install glmark2:
# In Termux
pkg install glmark2
# In proot-distro (Debian)
sudo apt install glmark2
Important: The following tests were run in a proot-distro (Debian) using an XFCE4 desktop.
| Run | LLVMPIPE | VIRGL | VIRGL ZINK | TURNIP | ZINK |
|---|---|---|---|---|---|
| 1 | 93 | 70 | 66 | 198 | Error |
| 2 | 93 | 77 | 66 | 198 | Error |
| 3 | 72 | 70 | 71 | 198 | Error |
| 4 | 94 | 76 | 66 | 197 | Error |
| 5 | 93 | 75 | 67 | 198 | Error |
Initialization and Commands
- LLVMPIPE: No server required
- VIRGL:
virgl_test_server_android & - VIRGL ZINK: ZINK server command
- TURNIP: No server required
Command Used
glmark2GALLIUM_DRIVER=virpipe MESA_GL_VERSION_OVERRIDE=4.0 glmark2MESA_LOADER_DRIVER_OVERRIDE=zink TU_DEBUG=noconform glmark2
Important: The following tests were run directly in Termux (not in proot-distro).
| Run | LLVMPIPE | VIRGL | VIRGL ZINK | ZINK | TURNIP |
|---|---|---|---|---|---|
| 1 | 69 | Error | 92 | 121 | N/A |
| 2 | 70 | Error | 92 | 122 | N/A |
| 3 | 69 | Error | 93 | 121 | N/A |
| 4 | 69 | Error | 93 | 124 | N/A |
| 5 | 69 | Error | 93 | 123 | N/A |
Firefox WebGL Aquarium Benchmark
Note: WebGL must be enabled in Firefox.
Debian proot (Firefox ESR – FPS)
| LLVMPIPE | VIRGL | VIRGL ZINK | TURNIP |
|---|---|---|---|
| 4 | 20 | 17 | Web page crash |
Termux (Not proot – Firefox ESR FPS)
| LLVMPIPE | VIRGL | VIRGL ZINK | ZINK | TURNIP |
|---|---|---|---|---|
| 2 | Error | 24 | 40 | N/A |