Repository navigation
media: apple: ave: add T8132 (M4) support, with device tree - #1489
EdupugantiAkhil wants to merge 7 commits into
Conversation
RyanTheTide
left a comment
There was a problem hiding this comment.
Thanks for the T8132 encoder work, and for the PSNR numbers across H.264, HEVC and Main 10.
Before this can go in, please rewrite three pieces of text: the commit message of "media: apple: ave: add T8132 (M4) support", the comment above ave_t8132 in ave-drv.c, and the new comment in ave_layout_for_crc(). They explain the variant values by what a macOS driver build does. They should only say what the J713 hardware shows: the firmware segment sizes and TEXT CRC, the ADT values the variant uses (device id, type), what you saw the coprocessor start do, and the encode results. Please drop the macOS driver names and versions, the internal identifiers and the routine comparisons. The firmware build labels next to the CRCs can stay, as elsewhere in ave-fw.c.
The branch also conflicts with integration/aurora now, so a rebase in the same push would help. I'll run the encode regression on our M1 Pro, M2 and Neo once the rewrite is up.
|
One more spot with the same issue: item 2 of the PR description names the macOS driver version. Please drop it there too when you reword the commit message. |
183a42b to
7e3c2d7
Compare
|
Thanks for the review. Pushed:
Retested on J713 (the rebased driver, after a fresh boot; the node is now /dev/video10): FFmpeg H.264 720p/1080p/2160p, CBR/VBR, Constrained Baseline, HEVC 720p/1080p and Main 10, and Chrome WebCodecs H.264. Every PSNR is identical to the previous revision. Hardware decode (H.264/HEVC/VP9/AV1, 6 clips) is still byte-exact. dt-schema now runs locally too: the binding passes |
RyanTheTide
left a comment
There was a problem hiding this comment.
The rewritten comments and commit message describe only what the J713 shows, and the driver changes are new table entries. The AVE driver also runs on the A18 Pro, M1 Pro and M2, so we will run an encode check on those once aura#152 is in, then merge. Thanks for the PSNR table.
7e3c2d7 to
eb4ff8d
Compare
|
Rebased onto |
|
@EdupugantiAkhil #1677 went in first, so this now conflicts in Results so far, with that resolution in a test kernel (integration e661192 plus this PR and the others in this round):
The M2 and A18 Pro encode runs are still queued. |
|
M2 results with this PR's driver code (applied over #1677 with both 25G83 CRCs kept), one-shot test kernel: the M2 encoder binds as before, H.264 1080p is byte-identical to the production kernel (300/300 frames, 23777084 bytes) and HEVC bytes are identical too, before and after 3 s2idle cycles. The conflict in ave-layout.c still needs the rebase described above before this can merge. |
eb4ff8d to
c57eac9
Compare
|
Rebased onto integration/aurora, keeping both 25G83 CRCs (T6041 and T8132). Retested on J713: encode and decode results unchanged. |
|
Tested on a J773g (Mac mini M4, 26.6.2 stub, aura with #152): the encoder works, after two changes to this series.
With both changes, on the J773g (1920x1080 testsrc2, yuv420p, 120 frames,
The encoder's |
|
Thanks for testing on the J773g! I'll fold both changes into the series, rebase onto integration/aurora and retest on the J713. It should be up in under an hour. |
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>
c57eac9 to
96882be
Compare
|
Folded both in and pushed (96882be): |
|
On macOS 27.2 (26B123) firmware, the J773g preloads AppleAVE2FW 9013.55.1 (TEXT 0x154000, CRC 99fc929a), and this series refuses it with "unexpected firmware segment sizes". The 27.2 AppleAVE2 kext renumbers the M4 as device 23, type 23 (26.6.2: 26/24), so the 27.2 build needs its own start identity. #2643 adds it as a T8132 build table on top of this PR: H.264/HEVC with B-frames encode at 45.6/46.5 dB PSNR on the J773g. Feel free to fold it in here instead; otherwise #2643 goes in after this one. Conflicts with current integration/aurora (test merge onto 5b596e6): only in this PR's DT commits. The driver files merge cleanly.
I haven't pushed anything to your branch. |
|
Blockers: 1. The driver part is small and reads correctly: a new compatible-selected variant, its CRC added to the known list, and the CRC mapped to the existing 9003.78.0 layout, with the per-boot TEXT word that the J773g needed. The conflicts with integration/aurora and the 27.2 firmware follow-up are already covered in the earlier comments, so I don't repeat them.
HW row: J713 booted with the DTB built from this branch (not the runtime overlay) on the default command line: FFmpeg H.264/HEVC/Main 10 encode with the PSNR table above, decode unchanged, 0 DART faults, 0 SELinux denials, 0 failed units, 0 new kernel errors. The same encode row on J604 or J623/J624 before their commits go in; otherwise drop those two commits for now. Assisted-by: LLM (Claude:Opus 5.5) |
|
@EdupugantiAkhil, a tidy-up pass over the open PRs here. These of yours need something:
If any of these are no longer needed, closing them helps; otherwise a merge or rebase onto integration/aurora is usually all they need. Thanks! |
This adds hardware video encoding (AVE) on the M4 (T8132). The series:
dt-bindings: media: apple,t8140-ave: describe T8132 like T6041: T8132 was only allowed in the whole-blockapple,aveplaceholder form, which the driver can't bind. It now uses the T6041/T8140 form: named codec/mailbox/coproc windows, five named power domains, firmware memory regions. The T8132 branch of the placeholder form goes; most of the diff is re-indentation.media: apple: ave: add T8132 (M4) support: adds the T8132 variant (device 26, type 24), its 9003.78.0 TEXT CRC, the per-boot TEXT word at 0x4224 (as on T6041; found on the J773g), and the CRC mapped to the 9003.78.0 command layout. The commit message gives what the J713 shows: the preloaded firmware's segment sizes and TEXT CRC, the default target in its capability table (device 26, type 24), what the coprocessor start did, and the encode results.arm64: dts: apple: t8132: describe the video encoder windows: describes the node like the T6041 one, and gives the DARTsvenc_sysand the DMA range.t8132-j713-pmgr.dtsi);okayrather than relying on the PMGR policy (on the J773g they came up disabled without it).Tested on J713 (by me) and J773g (by @DjDeveloperr, with the two changes above). J604 and J623/J624 are untested; drop those commits if you'd rather wait for a tester.
Depends on the aura T8132 AVE firmware handoff (aurora-silicon/aura draft PR, linked below). Without it, aura has no T8132 entry in its AVE handoff list, the node gets no firmware memory regions, and the encoder can't run.
Testing (MacBook Air M4, J713, OS firmware 26.6.2):
Driver: this branch's
drivers/media/platform/apple/ave/(integration/aurora0abc2f3 plus commit 2), built out of tree against the running 7.3.0 kernel after a fresh boot. The out-of-tree build needed two local shims that are not part of this PR: the sharedapple-video-nr.h, and a define forV4L2_PIX_FMT_APPLE_L8V0, which the running kernel's uapi headers predate (only the MCTF node uses it). The encoder registered as/dev/video10.Device tree: applied at runtime as an overlay with the same properties. The J713 tree compiled from this branch matches it, apart from the pmgr/fabric windows, which the driver doesn't use on this generation.
FFmpeg VA-API, PSNR against the source, all frames decodable:
The values, and the Chrome bitstream, are identical to the earlier revisions of this PR.
Chrome 156 WebCodecs H.264 hardware encode (VaapiVideoEncodeAccelerator): 60/60 frames, 44.73 dB.
Hardware decode, H.264/HEVC/VP9/AV1, unchanged: byte-exact.
All six T8132 DTBs compile with no AVE-related DTC warnings (J713's DTC warnings are the same 12 as unmodified
integration/aurora).dt-schema (2026.09) locally:
dt-doc-validatepasses on the binding, and all six T8132 DTBs validate against it with no errors (checked that a deliberately broken copy does fail).Not done:
Userspace (VA-API driver) placeholder: https://github.com/EdupugantiAkhil/aurora-ave-vaapi. Refs #1386.
AI disclosure: developed with AI assistance (Claude). Reviewed and hardware-tested by me. The commits carry
Assisted-by: LLM.🤖 Generated with Claude Code