Repository navigation
media: apple: avd: Program the T8132 AXI2AF bridge at power-up - #2696
IronsideXXVI wants to merge 1 commit into
Conversation
On T8132 the decoder's AXI-to-fabric bridge comes back from every power-down with its reset credits (AXI2AF +0x0848 reads 0x01000040 after power-up). With them the decoder cannot write 10-bit 4K frames fast enough. macOS 26 on a J604 runs this decoder as its Daisy generation (AppleAVD logs deviceType 416 and constructs CAvdApCommDaisy). Daisy's loadTunables reprograms the bridge at each power-up: 13 upstream and 2 downstream flow-control entries written without read-back, then the decoder entries our CM3 firmware already applies, then 32 AXI2AF entries with read-back, then a check of both flow-control groups. Map the bridge on T8132 and write the same tables in the same order at every power-up, before the decoder CPU starts. Bit 31 of each flow-control entry loads the count beside it and reads back as 0, so the check leaves it out. If entries still do not read back, the first two power-ups that miss log one warning with the count and name the entries at debug level. Other SoCs do not map the bridge and are not affected. Measured on a J604 (M4, T8132), one boot, with and without the tables in alternating runs, median of six ffmpeg VA-API runs each: 4K clip without with change HEVC Main10 550.2 fps 712.8 fps +29.6 % HEVC Main 724.3 fps 721.9 fps -0.3 % AV1 10-bit 512.3 fps 623.0 fps +21.6 % AV1 8-bit 615.1 fps 624.1 fps +1.5 % Hardware and software frame md5 matched on 60 frames each of the HEVC Main10, HEVC Main and AV1 10-bit clips with the tables in. No run had decoder errors or resets. GPU and CPU benchmarks did not move beyond noise. Signed-off-by: Dylan Ironside <dylan@dylanironside.io>
|
The performance result is clear: +30 % on HEVC Main10 and +22 % on AV1 10-bit, flat on the 8-bit clips, which fits write credits as the bottleneck. The design point is where the values come from. The three tables ( Assisted-by: LLM (Claude:Opus 5.5) |
|
I checked, and they aren't there. On the J604 the The tree does use that scheme for other blocks. 60 nodes have tunables, including That does leave the values tied to the driver and not to the firmware, as you say. Two things I can do about it in this PR:
Tell me if you want the first one now and I'll push it. |
|
integration/aurora at daa9e2d has no AXI2AF programming in the AVD driver, and 57eb00b still merges onto it without conflicts. @IronsideXXVI three things before this can leave draft. First, please state in the commit how the three tables were obtained: values read out of Apple's driver binary cannot go into this tree, values observed on your own machine (register reads or an MMIO trace of the running system) can, and the text currently only says they are what AppleAVD's loadTunables writes. Second, the bridge is mapped by a fixed offset from the control window behind an |
|
Thanks Ryan.
|
|
@IronsideXXVI checking open drafts today. To come out of draft, this still needs:
If it's no longer needed, say so here and we'll close it. Otherwise it stays open as a draft until these are done. |
|
Review note (hardware-facts rule, same stance as #2650). Thanks for chasing the T8132 decoder bring-up; the read-back ordering and the KUnit case are useful.
Checklist line: https://github.com/aurora-silicon/agent-guidelines/blob/main/pre-pr-checklist.md ("No hardware fact as a literal"). |
What: On T8132 (M4), program the AVD AXI-to-fabric bridge at every power-up, before the decoder CPU starts, in the same order macOS uses (flow-control groups, then the AXI2AF table with read-back, then a check). Left at its reset credits, the bridge holds 10-bit 4K decode back. Only T8132 maps the bridge, so other SoCs are untouched. There is no module parameter.
Tested: J604 (M4 MacBook Pro 14") on the J604 release tree 1.1143, which carries the same tables behind a parameter (this head 57eb00b was not booted). One boot, alternating runs, median of six ffmpeg VA-API runs of 1500 frames each: HEVC Main10 went from 550.2 to 712.8 fps (+29.6 %, now 97.8 % of native macOS) and AV1 10-bit from 512.3 to 623.0 fps (+21.6 %); 8-bit moved by noise only. Hardware and software frame md5 matched, with no decoder errors or resets. This head builds, and KUnit avd-pm passes 42/42.
Risk: two-way · T8132 (M4) Macs with AVD. Only the J604 was run. Other SoCs do not map the bridge, so the new code does not run there.
Not yet: This head has not booted on the J604. The read-back check with bit 31 masked has not run on hardware. No other T8132 machine has run this. Draft until the read-back check runs on the J604.
Full description
On the M4 (T8132) the AVD's AXI-to-fabric bridge powers up with its reset
credits, and 10-bit 4K decode is write-bound behind them: HEVC Main10 ran at
about 75 % of native macOS on the same machine and clip. macOS reprograms the
bridge at every power-up from AppleAVD's Daisy loadTunables (flow-control
groups, then the AXI2AF table with read-back, then a check). This does the
same, in the same order, before the decoder CPU starts. Only T8132 maps the
bridge; other SoCs are untouched. No module parameter.
Measured on a J604 (M4 MacBook Pro 14), one boot, alternating runs with and
without the tables, median of six ffmpeg VA-API runs, 1500 frames each:
Hardware and software frame md5 matched on 60 frames each of the HEVC Main10,
HEVC Main and AV1 10-bit clips with the tables in. No run had decoder errors
or resets. CPU and GPU benchmarks did not move beyond noise (-0.5 %, +0.2 %,
+0.8 %). HEVC Main10 is now 97.8 % of native macOS (728.8 fps) on the same
clip.
Tested
(1.1143), not on this head. That tree carries the same tables in the same
order behind a parameter, which is how one boot could alternate. This patch
has no parameter.
passes 42/42. I do not have a J604 tree on current integration/aurora yet.
run the 15 flow-control entries that did not read back differed in bit 31
only (a load strobe that reads back as 0), so I expect all 47 to read back
with it masked. That needs a boot to confirm.
not run there.
Draft until the read-back check has run on the J604.