Documentation
On this page

Subsystems

GPU

The Mali-G57 MC2 and the Metal driver over Panfrost.

Hardware

An Arm Mali-G57 MC2 (Valhall) at 0x13000000 (interrupts SPI 274 to 278: GPU, MMU, job, event, power), behind MediaTek’s MFG power blocks (mfgcfg at 0x13fbf000, the SPM, topckgen, apmixed, infracfg_ao). LK leaves the GPU’s rails (VGPU 900 mV, VSRAM_GPU 1000 mV) and clock (300 MHz, from the MFG PLL) set; the power domains are off until the driver powers them.

Driver

MappleGPU.cpp is the kernel’s accelerator for the Mali: it powers the domains (the sequences from MediaTek’s GPU frequency and power-domain code), runs jobs, manages the GPU’s memory and page tables per process, recovers from lost interrupts and hangs (a job’s timeout is 3000 ms by default), and has a frequency governor. With mp_gpu_lkrails=1 it stays at LK’s 300 MHz and rails and makes no PMIC write at all. MappleGPUUserClient.cpp is the user client and MappleSurface.cpp the IOSurfaces. In user space the Metal driver (MappleMTLDriver.bundle, from mapple_gpu_mali) implements Metal on Mesa’s Panfrost and the Valhall compiler: mka gpu builds Mesa from its pinned tarball with the repository’s patches. mtk_gpu_probe.c (mp_gpuprobe) only reports what LK leaves.

Device tree

/arm-io/gpu (mediatek,mt6781-mali): the Mali’s registers, then the MFG blocks it drives, and three interrupts. See Device tree.

Boot-arguments

mp_gpu and the mp_gpu_* family, mp_lpm_gpu, mp_surface_pitch64 and mp_gpuprobe in the catalogue. The spaced line has mp_gpu=2 (power at boot and publish) and mp_gpu_lkrails=1. A safe boot turns mp_gpu=2 into 1. Sysctls: kern.mapple_gpu_* (Sysctls).

User space

MappleMTLDriver.bundle in /System/Library/Extensions (Mesa and the driver), built by mka gpu.

Status

device.conf: partial: the Mali-G57 MC2 at LK’s rails and clock (mp_gpu_lkrails=1, 300 MHz) through Panfrost: Metal draws the UI; heavy posters run out of memory.

Seen: the GPU at LK’s rails, a self-test and compute tests passing, the Metal device named “Mali-G57 MC2 (Panfrost)” (run 8); the UI through Metal from boot (run 9); a lost GPU interrupt recovered (run 44); about five minutes of heavy UI without a hang (run 47).

Known issues

  • The GPU hung in several earlier runs and froze the screen until a restart (a hang in run 46).
  • Heavy animated wallpapers run out of memory.
  • Photo thumbnails and photo wallpapers still draw black.
  • The GPU runs at 300 MHz; the governor’s frequency steps are off with mp_gpu_lkrails=1.

Source files

iokit/Kernel/arm/MappleGPU.cpp, MappleGPU.h, MappleGPUUserClient.cpp, MappleSurface.cpp of the kernel at 76b737c; osfmk/arm64/mtk_gpu_probe.c of the MT6781 layer at 426b4f6; mapple_gpu_mali at 6d36a44; the pinned Mesa in Build targets.

Applies to realme 8i (spaced), release 1 · Updated 15 November 2026