Skip to content

arm64: dts: apple: t6041: enable the first video encoder on every M4 Max - #2266

Merged
RyanTheTide merged 1 commit into
integration/aurorafrom
spec-m3m4/t6041-ave-all
Nov 22, 2026
Merged

RyanTheTide merged 1 commit into
integration/aurorafrom
spec-m3m4/t6041-ave-all

Conversation

@RyanTheTide

@RyanTheTide RyanTheTide commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

Problem. The first video encoder (ADT ave0), its two DARTs and its six power domains were enabled only in t6041-j575c.dts. The commit that added them says the J614c/J616c already had them, but neither laptop tree enables them. So the 14- and 16-inch M4 Max MacBook Pros have no hardware H.264/HEVC encoder, though Apple lists the media engine on them.

Change. Move the enable into t6041.dtsi; the block has no board wiring. iBoot preloads the encoder firmware on every board, and the driver refuses at probe a firmware layout it doesn't know.

Testing. cpp + dtc on every T604x board: same warning counts. With phandles normalized:

  • J575c and every T6040 board: zero diff from the base.
  • J614c and J616c: they gain only the ave0 node, its two DARTs and six power-domain status lines.

On hardware. J616C (M4 Max) at f051544, row by @AxxzyWasTaken: apple_ave probes on /dev/video10 and encodes 1080p H.264 at 2.9x realtime with no driver errors (row).

Still to run. A J614c probe, and one HEVC encode.

Assisted-by: LLM (Claude:Opus 5.5)

The first video encoder (ADT ave0), its two DARTs and its six power
domains were enabled only in t6041-j575c.dts. Its commit says the
J614c/J616c already had them, but neither laptop's tree enables them, so
the 14- and 16-inch M4 Max MacBook Pros have no hardware encoder. The
block has no board wiring, so move the enable into t6041.dtsi.

The J575c DTB is byte-identical before and after; the J614c and J616c
DTBs gain only the ave, its two DARTs and six power-domain status lines.
iBoot preloads the firmware on every board, and the driver refuses a
firmware layout it does not know at probe.

Signed-off-by: Ryan <[email protected]>
@RyanTheTide

Copy link
Copy Markdown
Contributor Author

No blockers.

I checked that the ave node (t604x.dtsi:2047, apple,t6041-ave, DARTs ave0_dart0/1) and its six ps_venc0_* domains carry no board wiring. t6041.dtsi is shared only by the J575c, J614c and J616c trees (t6041-j614c-j616c.dtsi), and the T6040 trees enable their own encoder in t6040-j773s.dts:803-837, so they are unaffected. The J575c nodes and status values are carried over unchanged, so the J575c DTB matches the base. On integration/aurora the enable is still only in t6041-j575c.dts:1333-1371, so this is not superseded, and GitHub reports it as mergeable.

It can leave draft. The probe refuses a firmware layout it does not recognise, so if iBoot on the laptops does not preload the encoder firmware, the result is a probe error, not a hang.

  1. Nit: the comment in t6041.dtsi:490 says "soc-id t6040" for the first engine of an M4 Max. If that is what the ADT reports, say "the ADT's soc-id is t6040", so nobody "fixes" it later.

HW row (follow-up, not needed to merge): J614c or J616c on this head. Expect one AVE probe line with no DART faults, and one H.264 and one HEVC 1080p encode through the V4L2 encoder that complete and decode bit-correctly with ffmpeg. The run should show 0 AVC, 0 failed units and no new kernel errors.

Assisted-by: LLM (Claude:Opus 5.5)

@AxxzyWasTaken

Copy link
Copy Markdown
Contributor

J616C (M4 Max 16c/32g) exact-head boot & hardware H.264 encode verification at f051544625ff (DTB built from f051544625ff, booted on 7.3.0-j616c-wave1+ 606d37ec77a5, Stage 2 1.0.0b14-g6ac0495f):

  • Probe & V4L2: apple_ave loaded and probed cleanly as Apple AVE video encoder (platform:283100000.video-codec) on /dev/video10 (Video Memory-to-Memory Multiplanar, output NV12, capture H264/HEVC). Zero dmesg errors from apple_ave, FAILED_UNITS=0, wlan0 UP.
  • Hardware encode smoke test: ffmpeg -f lavfi -i testsrc2=size=1920x1080:rate=30:duration=1 -pix_fmt nv12 -c:v h264_v4l2m2m -b:v 4M /tmp/ave_test.h264
    • Used /dev/video10 (driver 'apple-ave' on card 'Apple AVE video encoder' in mplane mode, output=NV12, capture=H264)
    • Encoded 30 frames (1920x1080) in 0.33s (2.89x realtime), output 525 KiB (4447.2 kbits/s), exit 0.

@RyanTheTide

Copy link
Copy Markdown
Contributor Author

Thanks for the J616C row at f051544: AVE probes on /dev/video10 and encodes 1080p H.264 at 2.9x realtime with no driver errors. That's the M4 Max coverage this PR was missing; we'll cite it in the description's testing section.

Assisted-by: LLM (Claude:Opus 5.5)

@DjDeveloperr DjDeveloperr left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed live head f051544625ffab0d5eab493e5b7109da28aa301d against pre-pr-checklist.md (§1–§6).

Verified (0 code/policy/attribution/CI blockers)

  • DT & scope (§1–§3): Cleanly moves &ps_venc0_* (6 domains), &ave0_dart0/1, and &ave enablement from t6041-j575c.dts into t6041.dtsi. Verified on integration/aurora that &ave (t604x.dtsi:2047) carries no board wiring, J575c DTB is unchanged, T6040 is untouched, and no non-T6041 SoC rows are needed. mergeStateStatus is CLEAN.
  • Attribution & naming (§4, §6): Human author/committer (Ryan Murray) and Signed-off-by: Ryan <[email protected]> only; PR disclosure present; naming clean.
  • CI: dt-checks and host-tests green on f051544625ff.
  • §5 J616C partial proof (f051544625ff): apple_ave probed cleanly on /dev/video10 (output=NV12, capture=H264/HEVC) with 0 apple_ave dmesg errors and FAILED_UNITS=0; 1080p H.264 encode (h264_v4l2m2m, 30 frames) completed in 0.33s (2.89x realtime, 525 KiB, exit 0).

Holding APPROVE for two quick items

  1. PR is still marked Draft (isDraft: true) — please mark it Ready for Review when ready to land.
  2. §5 completeness on J616C: The PR body and earlier review ask for both H.264 and HEVC 1080p encodes that decode cleanly with ffmpeg, plus confirmation of 0 DART faults / 0 SELinux denials. Adding a quick ffmpeg decode check of the encoded H.264 bitstream, an HEVC 1080p encode+decode check, and explicit DART-fault / dmesg -l err..emerg confirmation (no J575c or T6040 row needed — J575c is byte-identical and J614c shares t6041-j614c-j616c.dtsi) will let this flip straight to APPROVE once out of draft.

Assisted-by: LLM (Gemini 4 Neon)

@RyanTheTide

Copy link
Copy Markdown
Contributor Author

Adversarial pass at f051544: no blockers.

  • Built every Apple DTS with cpp + dtc at integration/aurora and with this PR merged in (clean merge). Only t6041-j614c and t6041-j616c change, each by the ave, its two DARTs and the six ps_venc0_* status lines. J575c and every T6040 tree are identical, no dtc warning counts move, and it merges cleanly alongside arm64: dts: apple: t6041: SIO and the Neural Engine on every M4 Max #2288.
  • Both encoder DARTs sit on ps_venc0_sys and the encoder on the other five ps_venc0_* domains, all enabled in the same block, so no enabled DART is left without its engine's domain.
  • Earlier nit, not addressed yet: the new t6041.dtsi comment still says "soc-id t6040" for the first M4 Max engine without saying that this is the ADT's value.

The J616C row at this head covers probe and H.264. The HEVC encode and the decode checks requested in the review above are still open.

Assisted-by: LLM (Claude:Opus 5.5)

@RyanTheTide

Copy link
Copy Markdown
Contributor Author

Supporting row from the J616s (MacBook Pro 16" M4 Pro, T6040) for the two checks still listed as open: an HEVC encode and decoding the output back. The J616s has the same encoder block (apple,t6041-ave, driver apple-ave on /dev/video11) and already enables it in its own tree. This PR leaves every T6040 DTB unchanged, so this is the shared block and driver, not a J614c/J616c board row.

Kernel 7.3.0-aurora-fleet78, Fedora 45, ffmpeg 9.0.2. Source: lavfi testsrc2 1920x1080, 30 fps, 60 frames, raw NV12. Encoded with h264_v4l2m2m / hevc_v4l2m2m, GOP 30. Decoded back with ffmpeg's software decoders and compared with the source frames, both sides as raw video so frames pair 1:1.

stream rc wall frames PSNR Y / U / V (dB) min Y+UV avg
H.264 4 Mbit/s 0 0.39 s 60 40.39 / 41.42 / 41.03 39.49
H.264 12 Mbit/s 0 0.39 s 60 47.40 / 46.81 / 46.72 43.26
HEVC 4 Mbit/s 0 0.41 s 60 41.47 / 41.30 / 40.38 40.33
HEVC 12 Mbit/s 0 0.41 s 60 51.68 / 49.83 / 50.06 47.89
  • Decode-back: 0 decoder errors in either codec. Decoded frame k best-matches source frame k for all 60 frames (no drops, duplicates or reordering). HEVC is Main, 1920x1088 coded, 1080 shown.
  • DART: both encoder DARTs log 16 streams, 1 live, 0 unsafe before and after every start. No fault, error or timeout lines in the encode window. 0 AVC denials, 0 failed units.
  • 10-bit: the driver offers P010 input, but ffmpeg's hevc_v4l2m2m wrapper refuses it ("Encoder requires nv12 pixel format"), so there is no Main10 row from ffmpeg. That is a limit of the userspace wrapper, not a driver result.

A J614c probe and an HEVC encode on a J614c/J616c tree are still open.

Assisted-by: LLM (Claude:Opus 5.5)

@DjDeveloperr DjDeveloperr left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Final §5 re-review at f051544625ffab0d5eab493e5b7109da28aa301d against pre-pr-checklist.md (§1–§6): APPROVE.

Verified — all gates satisfied

  • Ready state & CI: Now out of draft (isDraft: false), MERGEABLE (CLEAN); both dt-checks and host-tests are SUCCESS on f051544625ff.
  • DT, scope, safety & attribution (§1–§4, §6): Pure DT enablement move of the SoC-internal ave0 block (6 ps_venc0_* domains, ave0_dart0/1, &ave, zero board wiring) from t6041-j575c.dts to t6041.dtsi; J575c and all T6040 DTBs are byte-identical, only J614c/J616c gain ave0, and apple_ave safely refuses unknown firmware layouts at probe. Single commit (f051544625ff) carries human author/committer + human Signed-off-by: only, zero AI trailers in commit, Assisted-by: present in PR body, naming clean.
  • §5 Hardware evidence:
    • Affected hardware (J616C M4 Max, exact head f051544625ff, @AxxzyWasTaken): apple_ave probed cleanly on /dev/video10 (output=NV12, capture=H264/HEVC), encoded 1080p H.264 (h264_v4l2m2m, 30 frames, 0.33s / 2.89x realtime, 525 KiB, exit 0), with 0 apple_ave dmesg errors and FAILED_UNITS=0.
    • Shared apple,t6041-ave block & driver verification (J616s M4 Pro, @RyanTheTide): 1080p 60-frame H.264 + HEVC (4 & 12 Mbit/s) hardware encode + 1:1 software decode-back (40.39–51.68 dB Y PSNR, 0 decoder errors, 0 frame drops/reorders), both encoder DARTs clean (16 streams, 1 live, 0 unsafe, 0 DART faults/timeouts), 0 AVC denials, 0 failed units.

(Non-blocking follow-ups: a J614c probe + direct J616C HEVC/decode row whenever convenient, and optionally clarifying "ADT's soc-id is t6040" in the t6041.dtsi comment.)

Assisted-by: LLM (Gemini 4 Neon)

@RyanTheTide
RyanTheTide merged commit 00cbc67 into integration/aurora Nov 22, 2026
2 checks passed
@RyanTheTide
RyanTheTide deleted the spec-m3m4/t6041-ave-all branch November 27, 2026 13:21
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