Skip to content

Adreno 740 driver ​

sheng drives the Adreno 740 through native XNU services. The stack uses native 4 KiB SMMU translation, GMU firmware, a CP ring, real fences and GPU compositing into the scanout.

Runtime path ​

  1. NativeMetal publishes a Metal device through the system MTLAddDevice path. The published mode returns the device to backboardd, and listed processes receive their own device. It owns the Metal objects, encoders, IOSurfaces, events, fences and pipeline archives.
  2. metal2vulkan translates AIR to SPIR-V and supplies pipeline descriptors, binding plans and function constants.
  3. Turnip compiles SPIR-V through NIR to A740 IR3. Its Darwin KMD talks to the NativeAdreno user client.
  4. NativeAdreno owns BOs, GPU addresses, the submission ring, fences and SMMU contexts. The GMU brings the GPU out of reset and applies power votes. The CP executes the IBs.
  5. The plugin composites the finished frame into scanout pages. NativeMobileDisplay offers and retires the swap.

The runtime compiler chain is Metal, AIR, SPIR-V, NIR, IR3. AirNir is an offline direct AIR to NIR to IR3 compiler.

Publish to the render server ​

scripts/add-gpu-plugin-data.py stages the plugin into a copy of the packed Data seed.

OptionEffect
--publishWrites NativeAdrenoMetal.publish. backboardd returns the native device to the original discovery, and CARenderServer composites the system UI through it.
--clients NAME,...Writes NativeAdrenoMetal.clients. Each listed process gets its own device and driver connection. Up to two also get a 256 MiB GPU window and their own shader cache. * lists every process.

The published device turns off backboardd's deep and compressed framebuffers. Patch zzw-native-adreno-sandbox-grant lets the accelerator service name the render server in NativeSandboxGrantProcess, so its user-client open passes the sandbox check.

NativeAdreno serves one user-client core per connection. The render server gets a 1 GiB window at 0x20000000, and up to two listed clients get 256 MiB each with their own queue range and teardown.

Components ​

ComponentRole
drivers/NativeMetalMetal frontend, metal2vulkan, command encoding, IOSurface and scanout client
drivers/NativeAdrenoGPU service, GMU/CP startup, user client, BO, VM, ring, submit and fence
drivers/NativeMobileDisplaySwap offer, validation, retirement and scanout hand-off
kits/AdrenoFirmwareGMU HFI, startup, power votes and SQE firmware data
kits/AdrenoPM4A740 PM4 state, constants, VPC and rasterizer packets
kits/ArmSmmu4KNative 4 KiB tables, context, streams, live mappings and TLB maintenance
kits/AirNirOffline AIR to NIR to IR3 compiler

Recent changes, newest first ​

DateCommitChange
2026-10-20UniXNU 16d0b1eGrants the render server its GPU client and silences the per-mapping managed-page report that flooded the kernel message buffer.
2026-10-20UniXNU 6440a94Applies translator patches 0004 and 0005, adds the frontend, archive, resource and registration checks, and stages the published device with --publish and --clients.
2026-10-20NativeMetal 6dcd4cbJournals CPU and system time, page faults, page-ins and context switches for each render pipeline creation.
2026-10-20NativeMetal 5df5195Answers Apple1-3 and Common1-2 GPU families as the original device does, and journals waived feature rows and function specializations.
2026-10-20NativeMetal 5ca27a6Gives each listed process its own device, driver connection and shader cache, and journals QuartzCore callers and context flags.
2026-10-20NativeMetal 8eea9caPrunes uber-shader entries before inlining and keeps recent module decodes and profile fingerprints.
2026-10-20NativeAdreno 805c7e4Skips write-combine re-assertion for pooled BOs; the per-submission pool walk cost 0.65 ms.
2026-10-20NativeAdreno 6fed926Sets the BO pool to 1536 MiB; large BOs stay in the pool and peak use is 782 MiB.
2026-10-20NativeAdreno 2668969Observes owned SMMU routes every 64th table operation and skips the image observation in submission TLB invalidation.
2026-10-20NativeAdreno a1032b2Pools only user BOs and serves one user-client core per process: 1 GiB for the render server, 256 MiB for two clients.
2026-10-20NativeAdreno b6ca2ffWrite-combines the pool once and limits map and unmap observations to the global policy, the context and owned routes.
2026-10-20ArmSmmu4K 4d0d659Reads the context only on whole-verification updates and skips TLB invalidation for invalid leaves.
2026-10-20ArmSmmu4K 960de2cObserves owned streams without the all-slot scan.

State ​

StepResult
GMU cold start and HFIworks
GPU context and CP commandsworks
Native 4 KiB SMMU contextactive
Metal device discoveryworks
GPU frame copy into scanoutworks, pixel-identical
Render server compositingworks
Per-process Metal devicesworks
GPU-composited desktopworks

The GPU path covers discovery, command encoding, pipeline archives, IOSurface imports, fences, compositing and scanout. The render server and listed clients use the native device.

Shader compilation ​

The driver compiles the original UI shaders on the device:

  1. default.metallib carries AIR plus Apple GPU machine code. The AIR feeds the translation path.
  2. metal2vulkan translates AIR to SPIR-V, then Turnip compiles IR3 at pipeline creation.
  3. A cold boot compiles every UI variant it reaches. int-148: 77 pipelines, about 43 s, cache hit 0. int-150: 103 Metal pipelines, 40.1 s total, 1.40 s max; 94 Vulkan pipelines, 23.3 s.
  4. Patch 0004 specializes the QuartzCore uber shaders and folds constant loads before inlining. Patch 0005 keeps recent module decodes and device-profile fingerprints. The pipeline journal records each render pipeline creation.

Implemented mitigations:

MitigationEffect
NDEBUG release buildRemoves per-pass Mesa assertions and NIR validation.
metal2vulkan patch 0004Specializes and prunes QuartzCore uber shaders before Vulkan compilation.
metal2vulkan patch 0005Keeps recent module decodes and device-profile fingerprints.
Priming cacheCaches runtime startup entry-point work.
m2vpack export and importReuses earlier compiled pipeline caches; the export is incremental.
Turnip builtin packEmbeds clear, blit and empty shader variants.
Pipeline journalRecords per-pipeline CPU and system time, page faults and context switches.

The cache chain covers runtime startup and the UI variants an earlier boot exported. A new UI variant compiles once, then enters the exported cache.

Build ​

sh
python3 scripts/build-turnip-darwin.py --target ios
python3 scripts/build-adreno-metal-plugin.py
python3 scripts/add-gpu-plugin-data.py --publish --clients <name,...> <seed>.dbr <output>.dbr

The staging script output is the Data seed for unixnu build payload --data-ramdisk.

Host checks:

sh
python3 scripts/check-native-metal-frontend-host.py
python3 scripts/check-turnip-darwin-host.py
python3 scripts/check-smmu4k-live.py
python3 scripts/check-turnip-pipeline-cache-host.py
python3 scripts/check-priming-cache-host.py --output build/priming-cache/run
python3 scripts/probe-turnip-internal-compiler-host.py --qualification <old> --output <new>

The device repository adds the original-input checks:

sh
python3 scripts/build-adreno-compiler-host.py --probe
python3 scripts/build-turnip-ios-compiler-peer.py
python3 scripts/check-turnip-ios-compiler-cache.py
python3 scripts/check-quartzcore-turnip-cache-host.py

Released under the BSD-2-Clause-Patent License.