[Adreno 840] Inconsistent Vulkan behavior and KGSL crashes
Device: Xiaomi 17 Pro (HyperOS3) GPU: Adreno 840 Kernel version: 6.12.23 Container OS: Arch Linux (LXC) Display: Termux:X11
I installed the drivers using pacman as instructed for Arch Linux in the release notes. Prior to installing these packages, no desktop environment or Mesa-related packages were installed.
- Downloaded and extracted
mesa-for-android-container_26.1.0-devel-20260404_archlinux_arm64.tarand Installed the extracted packages usingpacman -U. - Downloaded
vulkan-freedreno-1-26.1.0-4-aarch64.pkg.tar.xzfrom unpatched Turnip drivers release. Installed the package usingpacman -U.
Issue Description
- Inconsistent Vulkan behavior: vkcube runs correctly, but vulkaninfo fails randomly. Running vulkaninfo multiple times in a row might yield a successful output followed immediately by a failure:
[alarm@archlinux ~]$ vulkaninfo
XCB failed to connect to the X server due to error:1.
ERROR at /build/vulkan-tools/src/Vulkan-Tools/vulkaninfo/./vulkaninfo.h:905: AppCreateXcbSurface failed to establish connection
For detailed information, please refer to: vulkaninfo.txt
- OpenGL/GLES crash: When trying to run OpenGL or OpenGL ES applications using the Freedreno driver (
MESA_LOADER_DRIVER_OVERRIDE=kgsl), it consistently crashes with a DRI3 buffer allocation error followed by a Segmentation fault:
Variables: MESA_LOADER_DRIVER_OVERRIDE=kgsl and TU_DEBUG=noconform
Run glmark2 or glmark2-es2.
[alarm@archlinux ~]$ glmark2
MESA-LOADER: failed to retrieve device information
MESA: error: kgsl_pipe_get_param:103: invalid param id: 13
MESA: error: dri3_alloc_render_buffer:1608 xcb_dri3_pixmap_from_buffer[s] failed
MESA: error: X error: 2
MESA: error: dri3_alloc_render_buffer:1608 xcb_dri3_pixmap_from_buffer[s] failed
MESA: error: X error: 2
=======================================================
glmark2 2023.01
=======================================================
OpenGL Information
GL_VENDOR: freedreno
GL_RENDERER: Adreno (TM) 840
GL_VERSION: 4.6 (Compatibility Profile) Mesa 26.1.0-arch1.4 (git-dee0d39008)
Surface Config: buf=32 r=8 g=8 b=8 a=8 depth=24 stencil=0 samples=0
Surface Size: 800x600 windowed
=======================================================
MESA: error: dri3_alloc_render_buffer:1608 xcb_dri3_pixmap_from_buffer[s] failed
MESA: error: X error: 2
MESA: error: dri3_alloc_render_buffer:1608 xcb_dri3_pixmap_from_buffer[s] failed
MESA: error: X error: 2
[build] use-vbo=false:Segmentation fault glmark2
[alarm@archlinux ~]$ glmark2-es2
MESA-LOADER: failed to retrieve device information
MESA: error: kgsl_pipe_get_param:103: invalid param id: 13
MESA: error: dri3_alloc_render_buffer:1608 xcb_dri3_pixmap_from_buffer[s] failed
MESA: error: X error: 2
=======================================================
glmark2 2023.01
=======================================================
OpenGL Information
GL_VENDOR: freedreno
GL_RENDERER: Adreno (TM) 840
GL_VERSION: OpenGL ES 3.2 Mesa 26.1.0-arch1.4 (git-dee0d39008)
Surface Config: buf=32 r=8 g=8 b=8 a=8 depth=24 stencil=0 samples=0
Surface Size: 800x600 windowed
=======================================================
MESA: error: dri3_alloc_render_buffer:1608 xcb_dri3_pixmap_from_buffer[s] failed
MESA: error: X error: 2
[build] use-vbo=false:Segmentation fault glmark2-es2
Without the environment variable MESA_LOADER_DRIVER_OVERRIDE=kgsl, glmark2 and glmark2-es2 works (Zink Vulkan 1.4).
[alarm@archlinux ~]$ glmark2
=======================================================
glmark2 2023.01
=======================================================
OpenGL Information
GL_VENDOR: Mesa
GL_RENDERER: zink Vulkan 1.4(Adreno (TM) 840 (MESA_TURNIP))
GL_VERSION: 4.6 (Compatibility Profile) Mesa 26.1.0-arch1.4 (git-dee0d39008)
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: 126 FrameTime: 7.993 ms
[build] use-vbo=true:^C
[alarm@archlinux ~]$ glmark2-es2
libEGL warning: DRI3 error: Could not get DRI3 device
libEGL warning: Ensure your X server supports DRI3 to get accelerated rendering
=======================================================
glmark2 2023.01
=======================================================
OpenGL Information
GL_VENDOR: Mesa
GL_RENDERER: zink Vulkan 1.4(Adreno (TM) 840 (MESA_TURNIP))
GL_VERSION: OpenGL ES 3.2 Mesa 26.1.0-arch1.4 (git-dee0d39008)
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: 125 FrameTime: 8.000 ms
[build] use-vbo=true:^C
I am quite confused by this behavior as it seems very strange. Since I am a complete beginner in this field, the information I provided might be insufficient. Please let me know if you need any additional logs or execution results. Thank you very much for your help and your time!
You can test the driver on PRoot/Chroot first, because strange issues might be encountered if the LXC mount points are not set correctly. Currently, I haven't tested the effect of the driver inside an LXC container on Adreno 8xx devices. However, based on testing, the 26.1.0-devel-20260404 version of the driver is running normally on Debian 13 PRoot on an Adreno 830 device.
This is the key configuration I used for testing on Adreno 660 devices before, but I'm not quite sure if the mount points required for using the driver on Adreno 8xx devices have changed: https://github.com/lfdevs/mesa-for-android-container/issues/2#issuecomment-3446701735
Thank you for your reference configuration. For my current LXC configuration, I have mounted the following nodes: /dev/dri, /dev/kgsl-3d0 and /dev/dma_heap/system (as /dev/ion has been deprecated on this device).
Regarding the instability of vulkaninfo, I have a new finding that aligns with your suspicion about the environment: when I do not set the DISPLAY=:0 variable, vulkaninfo runs correctly every time. This confirms that the Vulkan driver itself is functioning properly, which also explains why vkcube and Zink work. The issue seems to be specifically related to the EGL/DRI3 path when interacting with the X server.
I will check my configuration again. Thank you again for your time and advice :)
I still recommend that you test in a PRoot or Chroot container first.
All releases with titles that do not have the turnip- prefix have the Termux:X11 KGSL DRI3 patch applied, but you can also test using version 26.1.0-devel-20260208 first, because someone has already tested this version of the driver on Adreno 840, and Freedreno (OpenGL, OpenGL ES) and Turnip (Vulkan) all work normally.
Thank you, I'll give it a try.
Update: I've done some testing and wanted to share the latest results.
I just completed testing in an Arch Linux chroot environment with Mesa and unpatched Turnip version 26.1.0-devel-20260404. vulkaninfo, glmark2, and glmark2-es2 now work exactly as expected with the following scores:
glmark2: 1333 log glmark2.txt glmark2-es2: 1989 log glmark2-es2.txt
I did notice that these scores are significantly lower than the 2947 / 2901 reported for the Xiaomi 17 Pro Max (which has the same GPU) in the documentation. There is a noticeable performance gap, but at least the drivers are working.
Still, I am getting errors within LXC. I should note that my current LXC setup was deployed automatically using Droidspaces. This leads me to suspect that the issue might stem from specific container configurations. I'll manually deploy a container to isolate the issue and verify if it is indeed a configuration problem.
Thanks for your time and for providing these packages :)
I did notice that these scores are significantly lower than the 2947 / 2901 reported for the Xiaomi 17 Pro Max (which has the same GPU) in the documentation. There is a noticeable performance gap, but at least the drivers are working.
All benchmarks in the README were tested under the condition of not starting a desktop environment and keeping only the Termux App (not Termux:X11) in the foreground, so the resulting scores may be higher. Different versions may also have an impact, so please rely on the performance of actual applications for the driver's acceleration effect.
I wanted to provide an update on this issue. I have successfully resolved these problems, and I can confirm that they are related to my specific environment (LXC configuration and SELinux) rather than the mesa drivers provided in this repository. Here are the details:
-
Freedreno glmark2 crash This was caused by SELinux restrictions . When I temporarily set SELinux to Permissive and restarted the LXC container, glmark2 ran perfectly using Freedreno. I have since fixed this permanently by making a custom SELinux policy module specifically for these denied operations.
-
vulkaninfo random failures This appears to be an issue caused by the high concurrency/probing pressure when vulkaninfo queries the hardware, rather than a driver failure. I tested this by unset variable DISPLAY, or pinning the execution to a single CPU core using taskset. Under both condition, it executes successfully every time. The Vulkan driver itself is actually working as expected.