Skip to content

media: apple: ProRes encoder for the Neo (T8140), with the ProRes UAPI - #835

Merged
RyanTheTide merged 6 commits into
aurora-wipfrom
prores/t8140-encoder
Nov 2, 2026
Merged

RyanTheTide merged 6 commits into
aurora-wipfrom
prores/t8140-encoder

Conversation

@RyanTheTide

Copy link
Copy Markdown
Contributor

ProRes encoder for the MacBook Neo (T8140)

A V4L2 memory-to-memory encoder for the A18 Pro's ProRes engine (APR), with the ProRes UAPI from RFC #738 as its first consumer.

  • media: v4l2: the two [RFC] media: v4l2: define ProRes frames, profiles and P216/P416 #738 commits (PRES compressed format, encoder profile menu, P216/P416 raw formats and docs).
  • dt-bindings and arm64: dts: apple: t8140: the engine node next to its DART, both interrupts, ps_prores as power domain and reset. Enabled on the J700.
  • media: apple: the driver. It takes NV16/P216 (4:2:2) and NV24/P416 (4:4:4) and encodes 422 Proxy, LT, 422, HQ, 4444 and 4444 XQ. Before the first job it applies the engine's and its AXI bridge's fixed settings, installs the ring and a statistics area, and loads the quantisation matrices and DC scale table (generated from formulas; KUnit checks them against known register values). Job descriptors are built from format and profile; nothing is replayed.
  • tools/asahi/prores-enc.c: encode tool for checks and benchmarks.

Credit: the first Linux encode on this engine was Acelogic's diagnostic (linked as Originally-by in the commits).

Tested on the Neo

Kernel 7.3.0-aurora-fleet14k-codec1 (this series and #834 Main 10 change, on aurora-wip ce900d1), one-shot boot b973bd14 with a one-shot Stage 2 whose only change is this DT node (restored early; committed Stage 2 unchanged).

1920x1080 3840x2160
422 Proxy / LT / 422 / HQ (NV16) 700 / 709 / 719 / 708 fps 261 / 170 / 169 / 174 fps
4444 / 4444 XQ (NV24) 462 / 464 fps 114 / 114 fps
  • All six profiles, 8 and 16-bit input: every frame decodes with FFmpeg (yuv422p10le / yuv444p10le), PSNR 48.8 to 49.4 dB (4:2:2) and 46.5 to 46.9 dB (4:4:4) against the source.
  • v4l2-compliance 48/48; interrupts fire per job (600 IRQs for 600 frames); no DART faults; journalctl -p 3 clean of driver lines.
  • Same boot, no AVE regression: H.264 1080p 163.8 fps, HEVC 155.3 fps.
  • KUnit 8/8 (arm64 QEMU), W=1 clean.

Known gaps

  • Rate control uses one known-good setting for all profiles. At 1080p the profiles currently give similar frame sizes, so bit rates don't follow Apple's per-profile targets yet. A macOS comparison of fps and sizes is still owed.
  • No alpha plane yet (4444 is encoded opaque). Ring wrap is avoided by reprogramming the ring every 341 jobs.
  • The Neo needs a Stage 2 DT refresh for the node to appear.

🤖 Generated with Claude Code

Define a complete-frame ProRes compressed format and a six-entry encoder
profile menu. Add contiguous little-endian 16-bit P216 and P416 raw formats
for semiplanar 4:2:2 and 4:4:4 storage, with core format descriptions.

These are RFC allocations. Merge this interface together with its first
driver consumer after media review, rather than as a standalone ABI.

Assisted-by: LLM
Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
Specify complete ProRes frame payloads, encoder-only profile selection,
and contiguous 16-bit raw layouts including chroma strides and allocation
bounds. Distinguish storage precision from coded precision and alpha.

Keep the proposed ABI under RFC review until its first driver consumer
validates these contracts and can merge with the definitions.

Assisted-by: LLM
Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
Describe the APR ProRes engine in the A18 Pro (T8140). It is programmed
directly through MMIO and a DMA descriptor ring behind its own DART, has
no firmware, and its power domain doubles as its reset.

Assisted-by: LLM
Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
Add a V4L2 memory-to-memory encoder for the APR engine in the A18 Pro
(T8140). It takes 8 or 16 bit semi-planar 4:2:2 (NV16, P216) and 4:4:4
(NV24, P416) frames and produces ProRes 422 Proxy, LT, 422 and HQ, and
4444 and 4444 XQ.

Before the first job the driver applies the engine's and its AXI bridge's
fixed register settings, installs the descriptor ring and a statistics
area, enables completion and error interrupts, and loads the quantisation
matrices and DC scale table, which are generated from formulas that KUnit
checks against the values the engine is known to run with. Each job
descriptor is built from the format and profile. The ring is reprogrammed
instead of wrapped, since the wrap protocol is not known. A lost interrupt
is caught by a poll and a hung engine is reset through its power domain.

Rate control uses one known-good setting for every profile, so profile
bit rates do not yet follow Apple's targets.

Originally-by: Acelogic <miguelc4600@gmail.com>
Link: aurora-silicon/linux-aurora@3e77f27
Assisted-by: LLM
Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
Add the APR engine next to its DART, with both interrupts and its power
domain as reset, and enable it on the J700. Build the driver as a module.

Originally-by: Acelogic <miguelc4600@gmail.com>
Link: aurora-silicon/linux-aurora@3e77f27
Assisted-by: LLM
Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
prores-enc encodes raw NV16, P216, NV24 or P416 frames through a V4L2
ProRes encoder, writes each frame for FFmpeg to check and reports the
encode rate without file I/O.

Assisted-by: LLM
Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
@RyanTheTide
RyanTheTide merged commit d433ad1 into aurora-wip Nov 2, 2026
@RyanTheTide
RyanTheTide deleted the prores/t8140-encoder branch November 2, 2026 03:53
notmysegv pushed a commit to notmysegv/linux that referenced this pull request Nov 4, 2026
…tion/aurora

Bring integration/aurora up to aurora-wip e1524e6, the source of
7.3.0-aurora-fleet14l, promoted on all four machines on 2026-11-02.
The range also covers the fleet14i, fleet14j and fleet14k sources
(a8fa302, d67eece, ce900d1). It adds aurora-silicon#822, aurora-silicon#823, aurora-silicon#824, aurora-silicon#827,
aurora-silicon#829, aurora-silicon#834, aurora-silicon#835, aurora-silicon#836, aurora-silicon#838, aurora-silicon#840 and aurora-silicon#839. No conflicts.

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