Skip to content

media: apple: ave: encode on the M4 Pro and enable it in the J616s DT - #748

Merged
RyanTheTide merged 2 commits into
aurora-wipfrom
ave/t6040-encode-3
Oct 31, 2026
Merged

RyanTheTide merged 2 commits into
aurora-wipfrom
ave/t6040-encode-3

Conversation

@RyanTheTide

Copy link
Copy Markdown
Contributor

Enables the AVE H.264/HEVC encoder on the M4 Pro (J616s), on top of #739 (merged: the 4 GiB window and buffer sizes). Replaces #740, which was based on the tree before #739.

The M4 Pro boots Linux from a 26.6.2 (25G83) stub, so iBoot preloads the 25G83 AVE firmware built for its chip (TEXT 0x14c000, CRC 0x68d5f9f6). It is the same firmware build as the A18 Pro's and takes the same command layout. What differs is the chip identity: AVE device 27, device type 25. The coprocessor registers and start sequence match the A18 Pro.

Commits:

  • media: select the 9003.78.0 layout for CRC 0x68d5f9f6 and complete the T6041 match data (coprocessor registers, device ID and type, boot argument, timebase, VCBAR encoding, boot qualified). Other firmware builds, including macOS 27.0's, are still refused.
  • J616s DT: enable the six VENC power domains, both AVE DARTs with a 4 GiB window, and the encoder. The loader still disables the node if the firmware is not preloaded or cannot be reserved (aura#25, in aura main).

Testing

J616s (M4 Pro), tt3, Stage 2 = aura main loader + this DTB (now the committed J616s Stage 2), module from this series, iommu group lazy (DMA-FQ), avebench 3 reps:

rep 1 rep 2 rep 3
1080p H.264 101.5 99.5 100.8
1080p HEVC 91.2 91.0 91.7
4K H.264 27.1 27.1 27.1
4K HEVC 25.8 (240/240) 25.8 25.8

2 sessions 50.3 + 50.0. 0 DART faults, no AVE errors, firmware CRC 68d5f9f6. Before this series the J616s AVE was disabled in the DT (stock driver: probe only).

Earlier J616s run of the same driver and DT commits on the previous base (fleet12e, aura#25 Stage 2): 1080p H.264 99.5-100.0, HEVC 91.3-92.5; 4K H.264 27.0-29.6, HEVC 25.7-26.0; 2 sessions 50.7 + 50.3; 12-rep 4K fault hunt 24/24 clean, 0 DART faults; GStreamer v4l2h264enc 1080p 120/120 frames decoded by ffprobe.

Neo (J700) regression with this branch, tt3, 4 GiB DT trial, 3 reps: 1080p H.264 109.5-110.5, HEVC 100.6-100.7; 4K H.264 30.2, HEVC 28.7 (240/240); 2 sessions 55.0 + 54.9; 0 DART faults.

The aurora-wip t6040-j616s.dtb with this series differs from the current one in exactly the 11 AVE lines (6 power domains, 2 DARTs, 2 DMA windows, the encoder). W=1 AVE build 0 warnings; t6040-j616s.dtb and t8140-j700.dtb clean. run-host-tests on aurora-wip 65a2821 with this series: 148/158, the same 10 avd-av1-tail failures as the tip alone.

Both chips encode at about 43% (M4 Pro) and 62% (A18 Pro) of macOS on the same machine. Encoder performance votes are being worked on separately and are not part of this PR.

🤖 Generated with Claude Code

The M4 Pro boots Linux from a 26.6.2 (25G83) stub, so iBoot preloads the
25G83 build of the AVE firmware for its chip: TEXT 0x14c000, CRC
0x68d5f9f6. That is the build the A18 Pro runs (0x69c54454), compiled
for the M4 Pro, and its command parser takes the same Config, Open,
Start and Process layout. The macOS 25G83 driver builds identical
commands for both chips.

What differs is the chip identity. The M4 Pro is AVE device 27 with
device type 25 (the A18 Pro is 29 and 27). Its coprocessor uses the same
registers and start sequence as the A18 Pro.

Select the existing layout for this CRC, and give the T6041 match data
the coprocessor registers, device ID, device type, the A18 Pro boot
argument, timebase and VCBAR encoding, and the qualified boot flag.
Other firmware builds are still refused, the macOS 27.0 one included
(TEXT 0x154000), whose commands are laid out differently.

Assisted-by: LLM
Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
Enable the AVE encoder on the J616s together with its two DARTs and the
six VENC power domains it sits in. The loader disables the node again
when the firmware is not preloaded or cannot be reserved.

Both AVE DARTs get a 4 GiB DMA window above the firmware at
0x100_0000_0000. The ADT gives these DARTs a 0x100_0000_0000 +
0x300_0000_0000 VM range, and macOS keeps every encoder address in
0x100_xxxx_xxxx. A 4K session needs about 180 MiB of encoder buffers
before its frame queues, so the 256 MiB the A18 Pro DT uses is not
enough.

Assisted-by: LLM
Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant