Skip to content

t6041-j575c: hardware video encoding (M4 Max AVE firmware) and JPEG - #1677

Merged
RyanTheTide merged 2 commits into
aurora-silicon:integration/aurorafrom
7robertodantas:j575c-ave
Nov 13, 2026
Merged

RyanTheTide merged 2 commits into
aurora-silicon:integration/aurorafrom
7robertodantas:j575c-ave

Conversation

@7robertodantas

@7robertodantas 7robertodantas commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

Written with an AI assistant (Claude) on @7robertodantas's behalf; every hardware step was run and checked on the owner's J575c.

t6041-j575c: hardware video encoding (M4 Max AVE firmware) and JPEG

The J575c (Mac Studio, M4 Max) DT left the video encoder and both JPEG engines disabled, unlike the J614c/J616c and J773s. With them enabled the JPEG engines work as they are, but apple-ave refused the encoder firmware at probe (unexpected firmware segment sizes).

Cause. The M4 Max's first encoder is the M4 Pro's kind (ADT ave0, soc-id t6040), but iBoot 25G83 preloads it with a different build of AppleAVE2FW 9003.78.0 (version string in TEXT):

M4 Pro (T6040 variant) M4 Max (J575c)
TEXT / DATA 0x14c000 / 0x12c000 0x14c000 / 0x130000
TEXT CRC 0x68d5f9f6, fixed different on every boot (727b63c0, 4708feec, 0ed5df70)

Two read-only dumps of the preloaded TEXT from two boots (checked against the loader's aurora,ave-text-crc32) differ in one byte: the 32-bit word at TEXT 0x4224 is 0x00dd0000 on one boot and 0x007d0000 on the other. With that word zeroed both give 0x9a080cad. DATA differs only in a small header; the driver already keeps its own pristine copy checked against aurora,ave-data-crc32.

Change.

  1. apple-ave: the T6041 variant also accepts DATA 0x130000 (fw_data_size_alt), and a TEXT CRC that is not a known build is retried with the word at 0x4224 zeroed (text_boot_word). Known CRCs, the M4 Pro's included, are kept as they are, so the M4 Pro path does not change. 0x9a080cad selects the 9003.78.0 command layout, as the M4 Pro build does, and gets an unqualified MCTF entry like it. A KUnit case covers the zeroed-word CRC.
  2. J575c DT: enable ps_venc0_*, ave0_dart0/1, ave, ps_jpg, jpeg0/1 and their DARTs, as t604x-j614-j616.dtsi does. The second encoder (ave1, soc-id t6041) is not described.

Tested on a J575c (linux-aurora 7.3.0; the driver change built as a module against 1943af8, loaded first on a fresh boot; DT = the live J575c tree plus only these nodes, one-shot trial boots):

Test Result
Encoder probe without the driver change: refused (sizes); with it: /dev/video3 apple-ave, H.264/HEVC from NV12/P010
H.264 Main 1080p30, 8 Mb/s (ffmpeg h264_v4l2m2m) 300/300 frames, PSNR 43.7 dB, decodes cleanly in software
HEVC Main 1080p30, 8 Mb/s (hevc_v4l2m2m) 300/300 frames, PSNR 44.5 dB
HEVC Main 10 from P010 (v4l2-ctl; ffmpeg's wrapper only offers NV12) 60/60 frames, yuv420p10le, 10-bit steps kept
Back-to-back sessions (3x 720p) 90/90 frames each
s2idle, then encode 150/150 frames, 42.5 dB
JPEG, both engines, 1920x1088 NV12 valid JFIF, PSNR 47.6 dB (q90) / 38.2 dB (q50), engines byte-identical, same after s2idle
AVD decode with these nodes on H.264, HEVC, VP9 bit-exact as before; HEVC Main 10 from the encoder bit-exact (P010)
dt-validate (this tree's bindings), checkpatch --strict no warnings / only the Co-Authored-By form

Not tested: the KUnit case (compiles with W=1; the ABI tests need VIDEO_APPLE_AVE=y, this kernel has it as a module); the second encoder; other M4 Max boards (J616c/J614c with an M4 Max get the same variant, but their firmware was not seen); constant-quality mode beyond a smoke run; long or concurrent encodes. The MCTF entry stays unqualified, as the M4 Pro's.

Notes:

  • The meaning of the word at TEXT 0x4224 is unknown (a per-boot seed or slide); only its value changes between boots.
  • After a module unload the firmware has run, so a reload refuses it (firmware data is not in its boot state) until the next boot. That is the existing check, unchanged.

🤖 Generated with Claude Code

7robertodantas and others added 2 commits November 12, 2026 08:24
The J575c (Mac Studio, M4 Max) has the M4 Pro's first encoder (ADT ave0,
soc-id t6040), but iBoot 25G83 preloads it with a different build of
AppleAVE2FW 9003.78.0: TEXT 0x14c000 as on the M4 Pro, DATA 0x130000
instead of 0x12c000. Probe stopped at "unexpected firmware segment sizes".

The build also has no fixed TEXT CRC: the loader writes one 32-bit word at
TEXT 0x4224 that differs on every boot (two dumps: 0x00dd0000, 0x007d0000;
everything else equal), so the loader CRC changed with each boot (727b63c0,
4708feec, 0ed5df70). With that word zeroed both boots give 0x9a080cad.

Let the T6041 variant accept the second DATA size and, when its TEXT CRC
is not a known build, retry the CRC with the boot word zeroed. Known CRCs,
the M4 Pro's included, are kept as they are, so the M4 Pro path does not
change. The build speaks the 9003.78.0 command layout, as the M4 Pro's.
Add a KUnit case for the zeroed-word CRC.

Tested on a J575c (linux-aurora 7.3.0, module built against 1943af8;
DT with the encoder nodes enabled), fresh boot, module loaded first:
H.264 Main and HEVC Main 1080p30 at 8 Mb/s, 300/300 frames, PSNR 43.7 and
44.5 dB; HEVC Main 10 from P010 (v4l2-ctl), 60/60 frames, decodes as
yuv420p10le with 10-bit steps kept; back-to-back sessions; encoding after
an s2idle resume. The KUnit case compiles (W=1); not run, the encoder is a
module in this kernel and the ABI tests need it built in.

Signed-off-by: Roberto Dantas <[email protected]>
Assisted-by: LLM (Claude Code)
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Enable the first video encoder (ADT ave0), its two DARTs and its six power
domains, and both JPEG engines with their DARTs and power domain, as
t604x-j614-j616.dtsi does for the J614c/J616c. The J575c ADT has the
preloaded encoder firmware (ave0 pre-loaded, segment-names __TEXT;__DATA).
The second encoder (ave1, soc-id t6041) stays undescribed.

Tested on a J575c (linux-aurora 7.3.0, the live J575c tree plus only these
nodes, one-shot trial boots):
- JPEG: both engines probe (HWREV 0x100008); a 1920x1088 NV12 frame gives a
  valid JFIF, PSNR 47.6 dB at quality 90 and 38.2 dB at 50, both engines
  byte-identical, same output after s2idle.
- Encoder: probes with "media: apple: ave: accept the M4 Max encoder
  firmware"; without it the driver refuses the firmware at probe.
- AVD decode unchanged (H.264, HEVC, VP9 bit-exact); s2idle resume OK.
- dt-validate (this tree's bindings): no warnings before or after.

Signed-off-by: Roberto Dantas <[email protected]>
Assisted-by: LLM (Claude Code)
Co-Authored-By: Claude Opus 5.5 <[email protected]>

@RyanTheTide RyanTheTide 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.

The known-CRC path returns before the retry, so the M4 Pro build is untouched. We confirmed apple-ave still probes and encodes on a J616s with this change. The J575c results are thorough. Looks good.

@RyanTheTide

Copy link
Copy Markdown
Contributor

Ran this on our J616s (M4 Pro, T6040), merged on integration e661192 together with the other PRs in this round, as a one-shot test kernel.

  • apple-ave probes and binds with no AVE errors, so the known-CRC path for the M4 Pro is unchanged.
  • H.264 1080p, 300 frames: output byte-identical to the production kernel (21390163 bytes, PSNR Y 38.18 dB, ~232 fps). HEVC 1080p is also byte-identical to production.
  • Same encodes after 3 s2idle cycles: identical again.
  • 0 AVC, 0 DART faults, 0 kernel errors.

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.

2 participants