Skip to content

media: apple: ave: T8132: start the macOS 27.2 encoder firmware (on #1489) - #2643

Open
DjDeveloperr wants to merge 8 commits into
mainfrom
djdev/t8132-ave-272
Open

DjDeveloperr wants to merge 8 commits into
mainfrom
djdev/t8132-ave-272

Conversation

@DjDeveloperr

@DjDeveloperr DjDeveloperr commented Nov 21, 2026 •

Copy link
Copy Markdown

Stacked on #1489 (T8132 AVE support), rebased onto integration/aurora (2701db12c, after #2644). Only the last commit, media: apple: ave: T8132: start the macOS 27.2 encoder firmware, is new. It can be folded into #1489 if @EdupugantiAkhil prefers.

Problem

On the Mac mini M4 (J773g) with macOS 27.2 (26B123) firmware, the encoder probe fails:

apple-ave 421100000.video-encoder: error -EINVAL: unexpected firmware segment sizes

27.2 preloads AppleAVE2FW_H16G 9013.55.1, the release the M5 runs on 27.2 (26.6.2: 9003.78.0):

  • TEXT 0x154000, DATA 0x12c000; uuid 03aa5171-… matches the ADT ave node;
  • TEXT CRC 99fc929a (zlib CRC32 of the image's __TEXT). The per-boot word at 0x4224 is zero in the image too.

What macOS 27.2 starts it as

AppleAVE2 in the 27.2 kernelcache numbers the chips anew:

soc-id 26.6.2 kext (DevID / DevType) 27.2 kext (DevID / DevType / ChipType)
t8132 26 / 24 23 / 23 / 13
t6040 27 / 25 24 / 24 / 14
t8140 29 / 27 26 / 26 / 15
t8142 30 / 28 27 / 27 / 16
t6050 31 / 29 28 / 28 / 17
  • The tables are AVE_FindByDevStr (soc-id → DevID) and AVE_DevCap_Find (DevID → DevType, ChipType).
  • The 26.6.2 rows for t8132, t6040 and t8140 are what the existing 25G83 variants boot with. The 27.x rows for t8142 and t6050 are what their 26A428 variants boot with. Both cross-check the reading.
  • AVE_SVECtrl_GetReg gives chip types 12–23 one SVE block, so the idle word at mailbox +0x118 is cleared before the start, as on T8142/T6050.
  • 9013.55.1 uses the 26B123 command layout already mapped on integration/aurora for AVE_FW_TEXT_CRC_T8132_26B123.

Change

  • struct ave_fw_build may name the variant it starts with (documented in ave.h: NULL keeps the platform's matched variant).
  • T8132 gets a build table:
    • 25G83 keeps its values;
    • 26B123 starts as device 23, type 23, with the SVE idle word, using ave_layout_26b123.
  • KUnit: ave_t8132_build_layouts pins both T8132 CRCs to their layouts (ave_layout_9003_78_0 and ave_layout_26b123) and confirms 26B123 has no MCTF layout.

Testing

Mac mini J773g, 27.2 (26B123) firmware, kernel 7.3.0 (m4drv8), with this driver as a module. The probe logs firmware build 26B123 (TEXT 0x154000 CRC 99fc929a, DATA 0x12c000).

1080p30 testsrc2, 60 frames, scored frame by frame against the source on the host:

Encode Path PSNR avg / min Notes
H.264 Main, 3 B-frames, 8 Mb/s v4l2-ctl 45.60 / 42.50 dB 60 frames in 0.3 s
H.264 High, 3 B-frames v4l2-ctl 45.68 / 42.48 dB
HEVC Main, 3 B-frames v4l2-ctl 46.45 / 44.37 dB
H.264 intra-only v4l2-ctl 56.03 dB
H.264 Baseline ffmpeg h264_v4l2m2m 44.07 dB
  • For comparison, 26.6.2 on the same Mac gave 45.25 dB (H.264) and 46.27 dB (HEVC).
  • No DART faults, and the encoder runtime-suspends after each run.
  • checkpatch --strict: 0 errors, 0 warnings on commit 8.
  • Host tests (tools/asahi/run-host-tests.py --only ave) pass (6/6), plus LLVM/clang compile of ave-{drv,fw,layout,abi-test}.o and all 6 T8132 DTBs.

Assisted-by: LLM (Gemini:4 Neon)

@RyanTheTide

Copy link
Copy Markdown

The driver change reads well. The 26B123 variant is selected by the preloaded image's TEXT CRC, through the build table, and swapped in before the start, so 25G83 boots keep ave_t8132 unchanged. The KUnit case pins both CRCs to their layouts and confirms 26B123 has no MCTF layout. One small thing: ave_fw_build now carries an optional variant, but only T8132 uses it. A sentence in ave.h saying a build with no variant keeps the platform's would help the next SoC that adds one.

The M4 Air (J713/J715) DTs in this stack also enable the encoder, and those boards boot the same 27.2 image, so an H.264/HEVC encode on a J713 with this stack would cover a second T8132 board.

Assisted-by: LLM (Claude:Opus 5.5)

EdupugantiAkhil and others added 8 commits November 21, 2026 15:35
The T8132 (M4) encoder was only allowed in the whole-block "apple,ave"
placeholder form, which the apple-ave driver cannot bind. It is the same
encoder generation as the T6041 (M4 Pro) and T8140 (A18 Pro): describe it
the same way, with the codec, mailbox and coprocessor windows by name, the
five named power domains and the firmware memory regions.

Drop the T8132 branch of the placeholder form, and list T8132 with the
T6041 and T8140 in the named form. The remaining conditions move up one
level, which is most of the diff (re-indentation only).

Assisted-by: LLM
Signed-off-by: Akhil <akhile76@gmail.com>
On the MacBook Air M4 (J713, OS firmware 26.6.2), iBoot preloads the
encoder firmware with TEXT 0x148000 and DATA 0x12c000 (ADT ave
segment-ranges), TEXT CRC 9308d2ab (AppleAVE2FW 9003.78.0). The
capability table in that TEXT has device 26, type 24 as its default
target.

Started with the T6041 (M4 Pro) coprocessor registers and start
sequence, from the code base the bootloader left (checked, not
written), the firmware boots as device 26, accepts the handshake for
type 24 and runs H.264 and HEVC sessions with the 9003.78.0 command
layout.

On the Mac mini M4 (J773g) the same build's TEXT CRC changes on every
boot: two boots' TEXT differ only in the word at 0x4224, and with that
word zeroed the CRC is 9308d2ab, as on the T6041 (M4 Max) preload. The
J713 has read 9308d2ab on every boot tested so far, but give the variant
the same per-boot word so either form is accepted.

Add the variant, its TEXT CRC, and map that CRC to the 9003.78.0
layout.

Tested on J713 with this driver (integration/aurora 0abc2f3 plus
this commit) built against the running 7.3.0 kernel, the encoder
described as in the following DT commits, and the firmware handed over
by aura with the T8132 handoff:
- FFmpeg VA-API H.264 720p/1080p/2160p, CBR/VBR and Constrained
  Baseline: 41.5-45.3 dB PSNR against the source, all frames decodable;
- HEVC Main 720p/1080p (43.5/43.8 dB) and Main 10 1080p (46.7 dB);
- Chrome 156 WebCodecs H.264 hardware encode: 44.7 dB.

Assisted-by: LLM
Signed-off-by: Akhil <akhile76@gmail.com>
Describe the T8132 encoder like the T6041 (M4 Pro) one, as the binding
now asks:
- bind through "apple,t8132-ave";
- give the codec, mailbox and coprocessor windows by name, and drop the
  pmgr and fabric windows, which the driver does not use on this
  generation;
- list the five encoder power domains by name, dropping venc_sys, which
  is the DARTs' domain and the parent of venc_dma;
- give both encoder DARTs venc_sys and the encoder's DMA range.

The nodes stay disabled. The bootloader adds the firmware memory regions.

Tested on a MacBook Air M4 (J713) by applying the same properties at
runtime as an overlay: FFmpeg VA-API H.264 and HEVC (Main, Main 10) and
Chrome WebCodecs H.264 encode, 43.5-45.5 dB PSNR against the source.

Assisted-by: LLM
Signed-off-by: Akhil <akhile76@gmail.com>
Enable the AVE encoder, its two DARTs and the six VENC power domains on
the MacBook Air M4, 13-inch (J713) and 15-inch (J715).
t8132-j713-pmgr.dtsi, shared by the two, had disabled the domains.

The encoder needs the bootloader's firmware handoff for T8132 (aura:
"apple,t8132-ave" in the AVE compatible list). Without it, the bootloader
leaves the node disabled.

Tested on J713 with the equivalent runtime overlay (see the previous
commit). J715 is untested.

Assisted-by: LLM
Signed-off-by: Akhil <akhile76@gmail.com>
Enable the AVE encoder, its two DARTs and its six VENC power domains on
the Mac mini (M4, J773g).

State the VENC domains in the board tree rather than relying on the
T8132 PMGR policy, which gives a domain the board leaves without a status
the policy's own status: on a J773g in review the VENC domains came up
disabled that way, and the encoder DARTs deferred until the probe timed
out.

Tested on a J773g in review (with the per-boot TEXT word in the T8132
variant): H.264 and HEVC 1080p encode, all frames decodable, no DART
faults. It needs the bootloader's T8132 AVE firmware handoff.

Assisted-by: LLM
Signed-off-by: Akhil <akhile76@gmail.com>
Enable the AVE encoder, its two DARTs and its six VENC power domains on
the MacBook Pro (14-inch, M4, J604).

State the VENC domains in the board tree rather than relying on the
T8132 PMGR policy, which gives a domain the board leaves without a status
the policy's own status: on the Mac mini M4 (J773g) the VENC domains came
up disabled that way, and the encoder DARTs deferred until the probe
timed out.

Untested on J604: the encoder and its resources are SoC blocks, the
same as on the MacBook Air M4 (J713) and the Mac mini M4 (J773g), where
this configuration encodes. It needs the bootloader's T8132 AVE firmware
handoff.

Assisted-by: LLM
Signed-off-by: Akhil <akhile76@gmail.com>
Enable the AVE encoder, its two DARTs and its six VENC power domains on
the iMac (24-inch, M4, J623 and J624).

State the VENC domains in the board tree rather than relying on the
T8132 PMGR policy, which gives a domain the board leaves without a status
the policy's own status: on the Mac mini M4 (J773g) the VENC domains came
up disabled that way, and the encoder DARTs deferred until the probe
timed out.

Untested on J623/J624: the encoder and its resources are SoC blocks, the
same as on the MacBook Air M4 (J713) and the Mac mini M4 (J773g), where
this configuration encodes. It needs the bootloader's T8132 AVE firmware
handoff.

Assisted-by: LLM
Signed-off-by: Akhil <akhile76@gmail.com>
macOS 27.2 (26B123) preloads the M4's build of AppleAVE2FW 9013.55.1,
the release the M5 runs on 27.2: TEXT 0x154000 and DATA 0x12c000 (J773g
ADT ave segment-ranges and uuid 03aa5171-556b-39a3-b4ae-e08520c39f82,
the IPSW's AppleAVE2FW_H16G image), TEXT CRC 99fc929a, the zlib CRC32 of
the image's __TEXT. The 25G83 sizes are pinned, so the probe refused it:
"unexpected firmware segment sizes". macOS 27.2.1 ships the same image.

AppleAVE2 27.2 numbers the chips anew. Its soc-id table
(AVE_FindByDevStr) gives "t8132" device 23, and its device table
(AVE_DevCap_Find) device type 23 and chip type 13. The 26.6.2 kext's
tables give device 26 and type 24, the values the 25G83 build starts
with, and "t6040", "t8140", "t8142" and "t6050" read back as their
variants start (27/25, 29/27, 27/27, 28/28), which checks the reading.
AVE_SVECtrl gives chip types 12 to 23 one SVE register block, so the
idle word at mailbox +0x118 is cleared before the start, as on T8142
and T6050. The 26B123 command layout is already mapped for this CRC.

Give T8132 a build table: 25G83 keeps its values, and a build may name
the variant it starts with (NULL keeps the platform's matched variant),
here device 23, type 23 and the SVE idle word. The per-boot TEXT word at
0x4224 is zero in the 27.2 image too.

Signed-off-by: Diljit Singh <hey@djdev.me>
@DjDeveloperr

Copy link
Copy Markdown
Author

Rebased cleanly onto integration/aurora (2701db12c, picking up #2644's ave_layout_26b123 and apple,t8140-ave.yaml schema updates) in 3e35182fd:

  • Preserved Akhil's 7 #1489 commits cleanly on top of integration/aurora (including collapsing the last placeholder if: branch in apple,t8140-ave.yaml and dropping the stale /delete-property/ power-domains on dart_ave0..2 in t8132-j713-j715.dtsi now that ps_venc_sys is enabled).
  • Kept integration/aurora's ave_layout_26b123 mapping for AVE_FW_TEXT_CRC_T8132_26B123 and updated ave_t8132_build_layouts accordingly.
  • Added the requested note on struct ave_fw_build::variant in ave.h clarifying that a build with variant == NULL keeps the platform's matched variant.
  • Stripped the Co-Authored-By trailer from commit 8 (scripts/checkpatch.pl --strict: 0 errors, 0 warnings) and updated the PR body footer to Assisted-by: LLM (...).

Local checks: tools/asahi/run-host-tests.py --only ave (6/6 passed), LLVM/clang compile of drivers/media/platform/apple/ave/ave-{drv,fw,layout,abi-test}.o, and all 6 T8132 DTBs pass.

Assisted-by: LLM (Gemini:4 Neon)

@RyanTheTide

Copy link
Copy Markdown

Status check against integration/aurora 4a17f73: T8132 encode on the macOS 27.2 firmware is on the tip through #2675 (merged 2026-11-22): the driver has the T8132 entry with the 27.2 image, the retry with the per-boot word zeroed that the J773g needs, the binding, and the encoder enabled on J713/J715. That is why this branch now conflicts in the driver, the binding and the T8132 device trees. What the tip does not have from this stack is #1489's part: enabling the encoder on the J773g, J604 and J623/J624 boards, and the 26.6.2 variant. @DjDeveloperr, could you check on the J773g whether the tip's driver starts the 27.2 image there once the board enables the node; if so, only the board enables remain and they can go through a rebased #1489.

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.

3 participants