# lfdevs/mesa-for-android-container architecture

> Architecture diagram of the GitHub repository lfdevs/mesa-for-android-container, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-25). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/lfdevs/mesa-for-android-container
- Repository: https://github.com/lfdevs/mesa-for-android-container

## Overview

This repository is a Mesa build tailored for ARM64 Linux containers hosted on Android, with a focus on Adreno acceleration. The principal workflow is a containerized application making OpenGL, OpenGL ES, or Vulkan graphics requests that Mesa routes to supported GPU drivers. The README also describes Android-hosted display services and hardware video decode/encode as separate capabilities. The graph reflects those documented capabilities and uses the sampled source index to identify runtime modules; implementation details beyond the excerpts are not assumed.

Main entry points: [`include`](https://github.com/lfdevs/mesa-for-android-container/tree/adreno-main/include) (GL, GLES, Vulkan), [`src/freedreno`](https://github.com/lfdevs/mesa-for-android-container/tree/adreno-main/src/freedreno) (Freedreno / Turnip), [`src/freedreno/vulkan/tu_pipeline.cc`](https://github.com/lfdevs/mesa-for-android-container/blob/adreno-main/src/freedreno/vulkan/tu_pipeline.cc) (Turnip Pipeline), [`src/amd/common/ac_vcn_dec.c`](https://github.com/lfdevs/mesa-for-android-container/blob/adreno-main/src/amd/common/ac_vcn_dec.c) (AMD Video Codec)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_graphics["Graphics APIs"]
  node_graphics_api["GL, GLES, Vulkan"]
end

subgraph group_drivers["GPU Drivers"]
  node_freedreno["Freedreno / Turnip"]
  node_turnip_pipeline["Turnip Pipeline<br/>[tu_pipeline.cc]"]
  node_radv["Radeon Vulkan Driver"]
  node_zink["Zink Driver"]
  node_lavapipe["Lavapipe Driver"]
  node_driver_set["Selected Mesa Drivers"]
end

subgraph group_runtime["Shared Runtime"]
  node_mesa_core["Mesa Core"]
  node_vulkan_runtime["Vulkan Runtime"]
  node_nir["NIR Compiler IR"]
end

subgraph group_media["Media and Display"]
  node_vpe["AMD Video Processing"]
  node_video_codec["AMD Video Codec<br/>[ac_vcn_dec.c]"]
end

node_app(("Container Application"))
node_adreno{{"Adreno GPU"}}
node_display_service(("Android Display Service"))
node_termux_va(("Termux:VA"))

node_app -->|"issues requests"| node_graphics_api
node_graphics_api -->|"uses for Adreno"| node_freedreno
node_graphics_api -->|"routes to drivers"| node_driver_set
node_freedreno -.->|"includes pipeline"| node_turnip_pipeline
node_turnip_pipeline -->|"uses shader IR"| node_nir
node_graphics_api -.->|"uses Vulkan runtime"| node_vulkan_runtime
node_mesa_core -.->|"dispatches graphics"| node_driver_set
node_display_service -->|"provides display"| node_app
node_termux_va -.->|"enables video"| node_video_codec
node_video_codec -.->|"uses hardware"| node_adreno
node_vpe -.->|"processes video"| node_adreno

click node_graphics_api "https://github.com/lfdevs/mesa-for-android-container/tree/adreno-main/include"
click node_mesa_core "https://github.com/lfdevs/mesa-for-android-container/tree/adreno-main/src/mesa"
click node_vulkan_runtime "https://github.com/lfdevs/mesa-for-android-container/tree/adreno-main/src/vulkan/runtime"
click node_nir "https://github.com/lfdevs/mesa-for-android-container/tree/adreno-main/src/compiler/nir"
click node_freedreno "https://github.com/lfdevs/mesa-for-android-container/tree/adreno-main/src/freedreno"
click node_turnip_pipeline "https://github.com/lfdevs/mesa-for-android-container/blob/adreno-main/src/freedreno/vulkan/tu_pipeline.cc"
click node_radv "https://github.com/lfdevs/mesa-for-android-container/tree/adreno-main/src/amd/vulkan"
click node_zink "https://github.com/lfdevs/mesa-for-android-container/tree/adreno-main/src/gallium/drivers/zink"
click node_lavapipe "https://github.com/lfdevs/mesa-for-android-container/tree/adreno-main/src/gallium/frontends/lavapipe"
click node_driver_set "https://github.com/lfdevs/mesa-for-android-container/tree/adreno-main/src"
click node_vpe "https://github.com/lfdevs/mesa-for-android-container/tree/adreno-main/src/amd/vpelib"
click node_video_codec "https://github.com/lfdevs/mesa-for-android-container/blob/adreno-main/src/amd/common/ac_vcn_dec.c"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_graphics_api toneBlue
class node_freedreno,node_turnip_pipeline,node_radv,node_zink,node_lavapipe,node_driver_set toneAmber
class node_mesa_core,node_vulkan_runtime,node_nir toneMint
class node_vpe,node_video_codec toneRose
class node_app,node_adreno,node_display_service,node_termux_va toneIndigo
```

## Components

### Graphics APIs

- [GL, GLES, Vulkan](https://github.com/lfdevs/mesa-for-android-container/tree/adreno-main/include): `include`

### GPU Drivers

- [Freedreno / Turnip](https://github.com/lfdevs/mesa-for-android-container/tree/adreno-main/src/freedreno): `src/freedreno`
- [Turnip Pipeline](https://github.com/lfdevs/mesa-for-android-container/blob/adreno-main/src/freedreno/vulkan/tu_pipeline.cc): `src/freedreno/vulkan/tu_pipeline.cc`
- [Radeon Vulkan Driver](https://github.com/lfdevs/mesa-for-android-container/tree/adreno-main/src/amd/vulkan): `src/amd/vulkan`
- [Zink Driver](https://github.com/lfdevs/mesa-for-android-container/tree/adreno-main/src/gallium/drivers/zink): `src/gallium/drivers/zink`
- [Lavapipe Driver](https://github.com/lfdevs/mesa-for-android-container/tree/adreno-main/src/gallium/frontends/lavapipe): `src/gallium/frontends/lavapipe`
- [Selected Mesa Drivers](https://github.com/lfdevs/mesa-for-android-container/tree/adreno-main/src): `src`

### Shared Runtime

- [Mesa Core](https://github.com/lfdevs/mesa-for-android-container/tree/adreno-main/src/mesa): `src/mesa`
- [Vulkan Runtime](https://github.com/lfdevs/mesa-for-android-container/tree/adreno-main/src/vulkan/runtime): `src/vulkan/runtime`
- [NIR Compiler IR](https://github.com/lfdevs/mesa-for-android-container/tree/adreno-main/src/compiler/nir): `src/compiler/nir`

### Media and Display

- [AMD Video Processing](https://github.com/lfdevs/mesa-for-android-container/tree/adreno-main/src/amd/vpelib): `src/amd/vpelib`
- [AMD Video Codec](https://github.com/lfdevs/mesa-for-android-container/blob/adreno-main/src/amd/common/ac_vcn_dec.c): `src/amd/common/ac_vcn_dec.c`

### Other components

- **Container Application**
- **Adreno GPU**
- **Android Display Service**
- **Termux:VA**

## Connections

- Container Application → GL, GLES, Vulkan: issues requests
- GL, GLES, Vulkan → Freedreno / Turnip: uses for Adreno
- GL, GLES, Vulkan → Selected Mesa Drivers: routes to drivers (evidence: `src/imagination/vulkan/pvr_arch_pipeline.c`)
- Freedreno / Turnip → Turnip Pipeline: includes pipeline (evidence: `src/freedreno/vulkan/tu_pipeline.cc`)
- Turnip Pipeline → NIR Compiler IR: uses shader IR (evidence: `src/freedreno/vulkan/tu_pipeline.cc`)
- GL, GLES, Vulkan → Vulkan Runtime: uses Vulkan runtime (evidence: `src/vulkan/runtime/vk_blend.h`)
- Mesa Core → Selected Mesa Drivers: dispatches graphics (evidence: `src/mesa/main/pipelineobj.c`)
- Android Display Service → Container Application: provides display
- Termux:VA → AMD Video Codec: enables video
- AMD Video Codec → Adreno GPU: uses hardware
- AMD Video Processing → Adreno GPU: processes video
