Forked From Mesa - The 3D Graphics Library
A Mesa build for containers on Android (Proot, Chroot, LXC, etc.), to support hardware acceleration with Adreno GPU.
- The Freedreno driver in Mesa 26.0.0 and later versions supports Adreno 840 GPU.
- Mesa drivers compiled in arm64 chroot containers across multiple popular Linux distributions offer better compatibility and can be used in Proot, chroot, and LXC containers hosted on Android.
- For some Adreno 6xx/7xx GPUs, the Freedreno driver can be used for OpenGL, OpenGL ES, and Vulkan, eliminating the need for Zink for graphics API call translation and significantly improving GPU utilization.
- Only drivers relevant to the vast majority of Android devices are compiled to reduce the package size.
| GPU | OpenGL | OpenGL ES | Vulkan (Zink) | Vulkan |
|---|---|---|---|---|
| Adreno 660 | ✔️ Supported | ✔️ Supported | ✔️ Supported | ✔️ Supported |
| Adreno 730/740/750 | ✔️ Supported | ✔️ Supported | ✔️ Supported | ❌ Not supported |
| Adreno 840 | ✔️ Supported | ✔️ Supported | ❔ Untested | ❌ Not supported |
This project's Releases provide two types of installation packages: one installable via the Linux distribution's package manager, and another that must be installed by direct extraction. The first type is recommended; however, if you need the latest Mesa features (such as Adreno 840 support), use the second type.
Depending on your Linux distribution, go to Releases and download all corresponding packages for a specific release, then follow the installation instructions provided in the release notes. Below are the latest releases for some popular Linux distributions:
| Linux Distribution | Latest Release |
|---|---|
| Debian | 25.0.7-2+deb13u1 |
| Ubuntu | 25.0.7-0ubuntu0.24.04.2 |
| Arch Linux | 26.0.0-2.1 |
ℹ️ Note: The .tar.gz installation packages in Releases can only overwrite the existing Mesa drivers. To uninstall, you must manually delete the extracted files. These packages are intended for testing purposes only.
- Go to Releases and download a
.tar.gzinstallation package. Please note the Linux distribution suffix in the filename, such asdebian_trixie_arm64. You can only install the package that matches your distribution. - Extract the installation package directly to the root directory.
sudo tar -zxvf mesa-for-android-container_26.0.0-devel-20251209_debian_trixie_arm64.tar.gz -C /- Refresh the dynamic linker cache.
sudo ldconfigUninstallation can be performed by referring to the following commands:
# Copy the file list output by this command
tar tf mesa-for-android-container_26.0.0-devel-20251209_debian_trixie_arm64.tar.gz | grep -v '/$' | tr '\n' ' ' ; echo
cd /
# Replace <file-list> with the actual file list
sudo rm <file-list>
# Reinstall the distribution-maintained Mesa drivers
# Debian or Ubuntu:
sudo apt update
sudo apt install --reinstall libegl-mesa0 libgbm1 libgl1-mesa-dri libglx-mesa0 mesa-libgallium mesa-vulkan-drivers
# Fedora:
sudo dnf reinstall mesa-filesystem mesa-libglapi mesa-libgbm mesa-libEGL mesa-libGL mesa-vulkan-drivers mesa-dri-drivers mesa-libOpenCL
# Arch Linux:
sudo pacman -S mesa mesa-docs opencl-mesa vulkan-freedreno vulkan-mesa-implicit-layers vulkan-mesa-layersSpecify the environment variables MESA_LOADER_DRIVER_OVERRIDE and TU_DEBUG when running a specific program, as follows:
MESA_LOADER_DRIVER_OVERRIDE=kgsl TU_DEBUG=noconform glmark2Alternatively, add them to the /etc/environment file so they are loaded automatically when the container starts:
MESA_LOADER_DRIVER_OVERRIDE=kgsl
TU_DEBUG=noconform
For detailed building procedures, please refer to the official Mesa documentation (Compilation and Installation Using Meson — The Mesa 3D Graphics Library latest documentation). Below are the key steps for building Mesa in a Debian 13 arm64 environment:
- Check if the source code repositories are enabled. If you are using the traditional format for software sources (
/etc/apt/sources.list), check for a configuration similar to the following.
deb-src https://deb.debian.org/debian trixie main contrib non-free non-free-firmware
- Install the dependencies required to build Mesa.
sudo apt build-dep mesa- Clone this project's repository.
git clone https://github.com/lfdevs/mesa-for-android-container.git- Switch to the branch where the relevant patches have been applied, such as
adreno-main.
cd mesa-for-android-container
git checkout adreno-main- Initialize the build directory. You can refer to the meson.options file to see all available build options.
meson setup build/ \
--prefix=/usr \
-Dplatforms=x11,wayland \
-Dgallium-drivers=freedreno,zink,virgl,llvmpipe \
-Dvulkan-drivers=freedreno \
-Degl=enabled \
-Dgles2=enabled \
-Dglvnd=enabled \
-Dglx=dri \
-Dlibunwind=disabled \
-Dmicrosoft-clc=disabled \
-Dvalgrind=disabled \
-Dgles1=disabled \
-Dfreedreno-kmds=kgsl \
-Dbuildtype=release- Start the build.
ninja -C build/- To install directly on the build device, run the following command:
ninja -C build/ install- If you need to package the built Mesa drivers for installation on other devices with the same distribution, refer to the following commands:
export MESA_RELEASE_NAME_SUFFIX=26.0.0-devel-20251209_debian_trixie_arm64
sudo mkdir /tmp/mesa-install-tmp
sudo DESTDIR=/tmp/mesa-install-tmp meson install -C build/
sudo tar -zcvf mesa-for-android-container_${MESA_RELEASE_NAME_SUFFIX}.tar.gz -C /tmp/mesa-install-tmp .
sudo chown $USER:$USER mesa-for-android-container_${MESA_RELEASE_NAME_SUFFIX}.tar.gz
chmod 644 mesa-for-android-container_${MESA_RELEASE_NAME_SUFFIX}.tar.gz
sudo rm -rf /tmp/mesa-install-tmpDetailed test results: benchmark-result
| Device | Model | SoC | GPU | glmark2 | glmark2-es2 | vkmark |
|---|---|---|---|---|---|---|
| Redmi K40 Pro | M2012K11G | Qualcomm Snapdragon 888 | Adreno 660 | 842 | 771 | 1170 |
| Xiaomi Pad 6 Pro | 23046RP50C | Qualcomm Snapdragon 8+ Gen 1 | Adreno 730 | 1169 | 1143 | Not working |
| Xiaomi 17 Pro Max | 2509FPN0BC | Qualcomm Snapdragon 8 Elite Gen 5 | Adreno 840 | 2947 | 2901 | Not working |
- Lucas Fryzek: Author of the KGSL backend code for the Mesa Freedreno driver.
- xMeM: For porting the Freedreno driver's KGSL backend to Termux:X11.
- Robert Kirkman: For integrating and improving xMeM's patches.
- Rob Clark: For adding initial Freedreno support for Adreno Gen8 architecture (including Adreno 840).