Repository navigation
Conversation
c18032f to
a544621
Compare
|
Rebased onto integration/aurora 0abc2f3. It is now a544621 (was b782c27); the old branch no longer merged.
On 0abc2f3: Image, modules and the J873g DTB build (LLVM 22, the M6's config, W=1, no warnings in the touched files), |
|
Thanks, Thomas. Bit-exact results for five codecs, with a check that rules out software fallback, are a strong start for the M6 decoder. A few code asks, so this keeps working as more T8152 machines are added:
Row: boot the exact PR head on the J873g and repeat your comparison for H.264, HEVC, HEVC Main10, VP9 and AV1, 60 frames each, all exact. Then run 4K60 H.264 to a null sink at 60 fps or more. With power-off added, After that we will run a no-regression row for the shared DART changes on our A18 Pro (Neo) and M4 Pro. |
a544621 to
ee96cb6
Compare
|
Thanks. I've done the parts I can verify without the M6. The head is now
Still open, and both need the M6:
I haven't booted this head yet. When the M6 is back on its tether, I'll run the row you listed: the five codecs × 60 frames compared exactly, 4K60 H.264 to a null sink, and the genpd summary once power-off exists. |
ee96cb6 to
4919818
Compare
|
Small follow-up: I rewrapped one overlong line in the DART commit message (checkpatch), so the head is now |
|
J873g decode row. The exact head can't boot the J873g from its SSD by itself: integration has no J873g NVMe, which comes with #1797. So the kernel is #2178's head
The genpd row (AVD off after 10 s idle, on for the next decode) waits for the power-off path, which is what I'm doing next. It comes with the generic PSD provider discussed on #1797. |
|
Thanks, Thomas. The SoC description, the dropped address check and the comment on the ADT mailbox pair cover those points. The decode row on #2178 is fine given the NVMe dependency. Still open before this leaves draft: the PSD power-off, and Gen3 DART fault reporting ( On the 346 decoder tunables: the table is avd-fw's v5/tier2 one, made for an earlier decoder. Does the J873g ADT Row once power-off lands: |
4919818 to
892664b
Compare
|
The power-off path is in. The head is now
genpd row on the J873g (#2178's stack, which carries these commits):
That leaves the Gen3 DART fault handler, which I'm working on now on the M6. |
892664b to
b4923f3
Compare
|
Gen3 faults are done. The head is now Gen3 DART faults ("iommu: apple-dart: report T8152 Gen3 DART faults"). A Gen3 DART turns out to report faults like a v2 DART: the pending-stream bitmap at 0x4000 and a record per stream at 0x8000 (status, address), acknowledged by writing the bitmap back. So Gen3 DARTs now request their interrupt and use Tested on the J873g with a TEST-only knob that cleared the AVD DART's SID 0 TTBR during an H.264 decode:
The commit is the one I added at the end of #1800, carried here after this PR's copies of #1800's DART commits. I also updated the backend commit's message, because PostOffice completion and suspend/resume are now the only open parts. With the power-off path and this, all of the code asks from your review are addressed. |
b4923f3 to
e9da854
Compare
|
On the decoder tunables: the J873g ADT's I don't have a trace of macOS's register writes on the M6. The macOS tracer I have runs on the J813 only, and an M6 MMIO trace of the decoder bring-up is a separate project. What I can show comes from outside, on the J873g. With this table:
That's what the backend commit ( |
|
Thanks, Thomas. The power-off path with the genpd numbers, and the Gen3 fault handler with the injected-fault test, cover everything we asked for in the code. The lock-on-error case stopping the stream rather than touching the query register is the right call. On the tunables: thanks for checking the ADT and for putting the evidence in the commit. Whether the table needs an M6 trace as well is a question for the maintainer review, so no need to start that project for us. For leaving draft: once #2459 and #1800 are in, a rebase that drops their copies here (the PSD binding and driver, and the DART commits) would leave this PR with only its own decoder changes. |
The DARTs in front of the T8152 display coprocessors (DCP, DCPEXT) and their display pipes (ADT "dart,gen3", version 0x300) use the T8110 register layout, but they belong to the SPTM, and the bootloader hands them over locked. Their TLB command register at 0x80 answers translation queries instead of flushing. A stream is invalidated the way iBoot does it: a payload naming the DART and the stream is written to the SoC's TLB invalidation aperture, which these DARTs share, and a broadcast TLBI follows. Add apple,t8152-dart-gen3 for them, without the apple,t8110-dart fallback, since a T8110 driver would flush through the wrong register, and a "tlbi" register entry for the DART's window in the aperture. Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de> (cherry picked from commit 36cd293)
The T8152 display DARTs (ADT "dart,gen3", version 0x300) use the T8110 register layout but belong to the SPTM: their TLB command register at 0x80 answers translation queries instead of flushing. A stream is invalidated the way iBoot does it, by writing a 128-bit payload (valid, route, SID) to the SoC's shared TLBI aperture and broadcasting a TLBI, which the DART snoops. The route is the DART's 0x4604 register. Admit a Gen3 DART only when the bootloader hands it over locked (its streams cannot be set up cold yet), map the aperture from a second "tlbi" reg entry without claiming it, since every Gen3 DART shares it, flush the whole stream where a range flush would go through 0x80, and do not claim the fault interrupt or drain stale exceptions, whose handling acknowledges through that register as well. The range flush test fixture gains the new hw flag. Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de> (cherry picked from commit 1ce2050)
The Gen3 DART snoops the broadcast TLBI that follows the aperture write. iBoot and the aura bootloader issue TLBI VALE1OS at EL2 without VHE, which targets the EL1&0 regime. On a VHE kernel the same instruction targets EL2&0 while HCR_EL2.TGE is set, so clear TGE around it, as KVM does to reach the EL1&0 regime. The J873g display works with this in place; the effect of the change on its own has not been isolated on hardware. Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de> (cherry picked from commit d57b118)
A T8152 Gen3 DART reports a fault as a v2 DART does: a bitmap of the streams with a pending exception at 0x4000, a record per stream at 0x8000 (status, address), acknowledged by writing the bitmap back. Request its interrupt and let apple_dart_t8110_v2_irq() report and acknowledge its faults instead of leaving them to the firmware. Only the unlock after a lock-on-error exception differs: a Gen3 DART's TLB command register serves translation queries, so it is not used to unlock. A Gen3 DART with lock-on-error set says that its stream stays stopped. The J873g's Gen3 DARTs have it clear. Tested on the J873g by clearing the AVD DART's SID 0 TTBR during an H.264 decode: one interrupt, "translation fault: SID:0 write TTBR invalid at 0x10fff000000 (status 0x00000100)", the bitmap acknowledged with no repeat, and the decoder retired by its recovery path. After the TTBR was restored and the decoder reloaded, the same file decoded bit-exact again. None of the other eight Gen3 DART fault lines fired, including those of the locked display DARTs with three displays running. Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de>
On T8152 the video decoder, the USB4 routers and their PHYs and the USB controllers are powered through PMGR2 PSD services instead of PMGR power-state registers. Each service has a 0x100-byte block with a target state, an acknowledge bit and the current state. Describe one service per node as a power domain, with an optional apple,always-on for a service whose consumers cannot restore what another agent set up in its blocks yet. Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de>
Provide each T8152 PMGR2 PSD service as a power domain. Power-on requests state 0 and power-off the cold state 6. The driver waits for the acknowledge before it reads the state, because reading the state consumes the acknowledge. A service marked apple,always-on is powered at probe and kept on. Otherwise the domain starts in the state the hardware reports, so genpd powers off a service that nothing uses. The consumers include IRQ-safe devices, the DARTs, so the domains are IRQ-safe and a transition is polled atomically, as the PMGR power states are. On the J873g the AVD service (50) reaches state 0 in 390-500 us and the cold state in about 240 us; the timeout is 10 ms. The AVD and the USB4 routers' CIO services, which so far each had their own variant of this, and the USB controllers (services 175 and 176) use it. It has its own Kconfig symbol, APPLE_PMGR_PSD, on by default with ARCH_APPLE and built in by the shared asahi.config profile. Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de>
The AVD Gen3 DART uses the shared TLBI aperture like the display DARTs, but Linux initializes it from an unlocked state with inactive streams. Require its PSD power domain, DMA aperture and initialization tunables. Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de>
Admit cold Gen3 setup only for the instance its apple,t8152-avd-dart compatible selects, with version 0x300, 16 streams, its PSD domain, ADT tunables and inactive streams 0..2. Clear those streams, apply their tunables and use the Gen3 TLBI aperture before enabling translation. Map the TLBI aperture before reset and select a two-level 16K page table inside a single 64 GiB high DMA window. Keep the existing locked display DART admission and all other unlocked Gen3 instances unchanged. On J873g this maps all three decoder streams for bit-exact H.264, HEVC, HEVC Main10, VP9 and AV1 decoding. Gen3 fault IRQ handling and suspend recovery remain outside this initial bring-up. Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de>
Describe the Kopsia MCU, decoder, wrapper and PIODMA register apertures, its three DART streams and its shared PSD power domain. The initial transport submits from the host with the MCU halted and polls completion; it does not use the PostOffice mailbox or the legacy decoder reset line. Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de>
T8152 Kopsia retains the T8142 codec program format but uses different initialization and completion registers. Add a host backend that halts the MCU, initializes the wrapper and PIODMA, and reuses the existing codec submission and completion logic with one frame in flight. Poll VP/PP status only while a frame is active. Enable H.264, HEVC, VP9 and AV1 on this variant without an external firmware image. Retain the 128-byte H.264 MV and HEVC v5 header quirks. Disable recovery reset: the existing watchdog parks DMA and retires the decoder instead of issuing an unqualified reset. The 346 register tunables are unchanged from the MIT-licensed avd-fw v5/tier2 table. The J873g ADT's avd node carries no tunables of its own (unlike its DART's), so there is nothing T8152-specific to describe in the device tree. The table was checked on the J873g by its output: with it, H.264, HEVC, HEVC Main10, VP9 and AV1 decode bit-exact against software (60 frames each), 4K60 H.264 runs at about 150 fps, and the results stay exact across hundreds of power-domain cycles, each of which applies the table again. On J873g, forced DRM PRIME decode and download compares exactly with software for 60 frames of each codec, including HEVC Main10; mpv also renders through DRM PRIME and seeks in both directions. The decoder is runtime power-gated through its PSD domain: the backend is set up again on every resume. A DART fault (injected on the J873g) retires the decoder through the existing recovery path until the module is reloaded. PostOffice completion and suspend/resume remain outstanding. Link: https://github.com/aurora-silicon/avd-fw/blob/ea3a65cc9c0c41907e6ad2714b813e4be6858485/src/hw/tunables/tunables_v5t2.h Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de>
Describe the T8152 Kopsia decoder in the SoC peripherals, disabled, so every T8152 board can enable it: its five register banks, PSD service 50 (apple,t8152-psd) as the power domain shared by the decoder and its DART, powered off by genpd while both are idle, and the DART as the apple,t8152-avd-dart instance with its Gen3 TLBI aperture, its initialization tunables and a 64 GiB window at 1 TiB inside the native 1..4 TiB DMA aperture. The tunables are those of the J873g's ADT. Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de>
Enable the T8152 decoder, its PSD domain and its DART on the J873g. This enables the request decoder node used by FFmpeg and mpv on the M6 Mac mini. The PSD provider supplies both AVD and DART so translation is initialized only after their shared domain is powered. Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de>
e9da854 to
6a2bbe8
Compare
|
Rebased onto integration/aurora Assisted-by: LLM (Claude:Opus 5.5) |
|
Re-review of 6a2bbe8: no change to the decoder or DART code. The only changes are the host-test fixture fields for the new Assisted-by: LLM (Claude:Opus 5.5) |
|
@RyanTheTide the J873g rerun on this head ( Kernel:
The five codecs. 60 frames each, with
Assisted-by: LLM (Claude:Opus 5.5) |
This enables V4L2 Request hardware decoding on the Mac mini M6 (J873g/T8152). With the request-enabled FFmpeg/mpv packages, H.264, HEVC/Main10, VP9 and AV1 decode through Kopsia, and mpv presents DRM PRIME frames without a download to the CPU.
Draft for review of the initial hardware bring-up: completion is polled and the decoder power domain stays on. Suspend and fault recovery are not qualified.
Scope and prerequisites
Based on
integration/auroraat0abc2f385e54. The first three commits carry the Gen3 DART binding, locked-stream support and VHE TLBI fix from #1800, with their source commits recorded. The remaining seven commits add:The 346 decoder tunables match the MIT-licensed avd-fw v5/tier2 table, with its attribution retained. #2106 is a related Gen3 DART implementation to reconcile during review. There are no new aura, FFmpeg or mpv source changes in this series.
Hardware validation
Mac mini M6,
apple,j873g/apple,t8152, Debian forky/sid. Tested kernel:7.3.0-aurora-j873-avd+(#6), built from the local M6 integration base805d9fcc6812plus this decoder implementation. The exact rebased PR branch has not been booted; its build/schema/host checks are listed separately below.Both
asahi,os-fw-versionandasahi,system-fw-versionreportunknown; the installed aura Stage 1 version was not recorded. Userspace: FFmpeg7:9.0.2-6+v4l2req2, mpv/libmpv20.42.0-1+v4l2req2, Mesa26.3.0~aurora.wip.ac9d556248c-1, Sway1.12-1, OpenGL renderer Apple M6 (G18G B1).Repeated after the final reboot:
The tests force
-hwaccel v4l2request -hwaccel_output_format drm_prime, download to NV12/P010, normalize to the software pixel format and compare nonempty frame hashes. Logs must also identify the AVD media driver, so software fallback cannot pass. Three simultaneous H.264/HEVC/VP9 processes also produced 60 exact frames each.Additional hardware results:
hwdec=v4l2requestand DRM PRIME interop, with zero decoder or presentation drops during that test./dev/video10and/dev/media0present; no AVD errors, kernel WARNING/Oops/SError, or failed systemd units in the final boot.Select
hwdec=v4l2requestin mpv. FFmpeg needs-hwaccel v4l2requestbefore the input; use-hwaccel_output_format drm_primewhen retaining hardware frames. CPU filters need an explicit download.Checks on this PR branch
W=1: complete AVD objects, PSD and DART objects, and the J873g DTB build. Existing DART unused-helper and GPU reserved-memory DT warnings remain.dt_binding_check; the J873g DTB passes validation against those schemas.git diff --checkpasses. Checkpatch reports no errors; remaining warnings concern new-file MAINTAINERS coverage and British spelling of acknowledgment.Remaining work
PostOffice completion and runtime power gating are not implemented. The PSD domain remains powered. Gen3 fault interrupts remain disabled, and recovery reset is disabled for Kopsia: the existing watchdog parks DMA and retires the decoder rather than issuing an unqualified reset. Suspend/resume and fault injection have not been tested. Encoding and browser integration are outside this change.
Assisted-by: LLM (Claude:Opus 5.5)