Skip to content

Adreno740 ​

Start with the adaptation procedure for board inputs, source changes, build integration and verification order.

Adreno740 implements the A740 kernel GPU interface used by SM8550. It manages command submission, memory, fences, and GPU initialization. The SoC profile supplies shared GPU, GMU, and SMMU operations. Each board supplies signed firmware, power policy, reserved-memory adjustments, and display integration.

The recorded hardware target is sheng. Its stack uses 4 KiB SMMU translation, GMU firmware, a CP ring, fences, and GPU compositing into scanout.

Runtime path ​

  1. AdrenoMetal 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 Adreno740 user client.
  4. Adreno740 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. GopFramebuffer 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.

Adreno740 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/AdrenoMetalMetal frontend, metal2vulkan, command encoding, IOSurface and scanout client
drivers/Adreno740GPU service, GMU/CP startup, user client, BO, VM, ring, submit and fence
drivers/GopFramebufferSwap 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

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.

Memory and TLB ​

ItemBehavior
Objects per clientUp to 16384, found through a handle index
Owned BOsFrom the board's contiguous pool (1 GiB on sheng), else scattered pages. Mapped without the alias check against existing ranges
Imported memoryMapped without that check when every mapped import shares its cache class and it overlaps neither the pool nor an owned mapping; otherwise fully checked
UnmapUp to 512 pages invalidated one by one, larger unmaps by ASID
SubmissionNo TLB invalidation; a stalled fence still invalidates
Boot log rows[vm map], [vm unmap], [vm kinds], [bo pool]

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.