Skip to content

AVE/AVD: hold the SoC rail floor while encoding or decoding on the M4 Pro (performance votes) - #773

Merged
RyanTheTide merged 5 commits into
aurora-wipfrom
ave/perf-votes-2
Nov 1, 2026
Merged

RyanTheTide merged 5 commits into
aurora-wipfrom
ave/perf-votes-2

Conversation

@RyanTheTide

Copy link
Copy Markdown
Contributor

On the M4 Pro the video encoder and decoder run on the SoC fabric clock, and Linux leaves the SoC rail at its idle state while they work. macOS raises that rail for every encode and decode. This series lets the DT describe such a rail floor as a PMC power domain and gives it to the encoder and decoder as their "perf" domain, so the floor is held exactly while they are runtime-active.

Commits:

  • pmdomain: apple: pmc: rail floors as power domains. A PMC child floor-<name> { #power-domain-cells = <0>; apple,rail = <N>; apple,level = <L>; } is a genpd. While it is powered, the AP's own voter agent holds rail N at least at state L. Floors on one rail combine to the highest held one, the DCS rail is left to the DCS limit, and floors are dropped when the PMC goes away. KUnit covers combining with the AP's DCS vote and a PMC that does not accept the floor.
  • media: apple: ave: an optional sixth power domain "perf", attached with the others, so it follows runtime PM: held from the first session until the autosuspend after the last one, and dropped across a recovery power cycle.
  • arm64: dts: apple: t6040: floor-soc-max (SoC rail, state 2) as the encoder's perf domain.
  • media: apple: avd: the same for the decoder (domain list with runtime PM links when the node lists more than one domain).
  • arm64: dts: apple: t6040: the decoder's perf domain.

No module parameters or knobs: a board opts in by listing the domain in its DT.

Measurements

J616s (M4 Pro), avebench (16 prefilled NV12 frames, 12 Mb/s, 40 Mb/s above 3 Mpixel, GOP 30, no B-frames, timed to the last drained buffer), SoC floor applied by hand vs off, same boot:

without with macOS (same machine)
1080p H.264 encode 99.7-100.9 218.1-219.5 235.6
1080p HEVC encode 91 198.0-198.4 223.5
4K H.264 encode 27.1 58.9 62.1
4K HEVC encode 25.8 57.3 59.0

AVD (avd-bench N=1, bit-exact against software decode): H.264 1080p 326 -> 695, 4K 117 -> 247; AV1 1080p 571 -> 1109, 4K 198 -> 420; VP9 1080p 248 -> 547, 4K 82 -> 183.

Power (SMC total system power, J616s docked, 4K H.264 decode): idle 9.20 W; decode without the floor 14.80 W at 122.9 fps, with it 15.41 W at 247.2 fps (25 instead of 46 mJ per frame); idle with the floor held 11.87 W, which is why it must follow runtime PM.

Hardware run of this series

J616s, kernel 7.3.0-aurora-avepv1 (this series on aurora-wip 3412c75; rebased onto 437edfa here without conflicts, only the host-test fixture changed), one-boot Stage 2 trial with this branch's t6040-j616s.dtb, boot 6afd8a33. In-tree modules, no hand-applied floor.

avebench, 3 reps rep 1 rep 2 rep 3
1080p H.264 218.6 217.8 219.2
1080p HEVC 198.0 199.1 199.2
4K H.264 58.8 58.7 59.1
4K HEVC 57.6 57.6 57.3
  • 2 concurrent 1080p sessions: 107.7 + 107.2.
  • PMC debugfs: pmc-soc-max: rail1 level 2 held (AP agent floor 0x20) during an encode, released (floor 0) 5 s after the last session.
  • The forced-wedge procedure (debugfs inject_wedge, 1 and 2 clients, re-encode at 212-213 / 195-197 fps after each recovery, recovery limit): 0 DART faults. After the deliberate fourth wedge in ten minutes the encoder stays powered (existing recovery-limit behaviour), and the floor with it.
  • AVD on the same boot (avd-bench N=1, best of 3, bit-exact): H.264 1080p 690.5, 4K 247.6; AV1 1080p 1115.9, 4K 418.5; VP9 1080p 547.6, 4K 183.3; the floor held during every decode.
  • 0 DART faults; no new -p3 lines apart from the deliberate wedge test's own.

Other machines: the J700, M1 Pro and M2 DTs describe no floor, so the AVE driver attaches the same five domains as before, the decoder keeps its single domain, and the PMC registers no floor domain. It rides the next fleet build for the full four-machine validation.

Software: W=1 clean for drivers/pmdomain/apple, drivers/media/platform/apple/ave and avd; t6040-j616s.dtb and t8140-j700.dtb build clean; KUnit apple-pmc 8/8 (arm64 QEMU); run-host-tests 158/158; AVE host builder tests pass. dt_binding_check was not run (no dtschema on the build host).

🤖 Generated with Claude Code

Some devices only run at full speed while a shared rail is above its
lowest state. The M4 Pro video encoder runs on the SoC fabric clock: with
the SoC rail at its idle state it encodes 1080p H.264 at 100 fps, with the
rail at its highest state at 219 fps, close to what macOS gets (it raises
the same rail for every encode session).

Let the DT describe such a floor as a child of the PMC with a rail and a
performance state, and provide it as a power domain. While the domain is
powered, the AP's own voter agent holds the rail at least at that state.
Floors on one rail combine to the highest one held, so several devices
can share a rail. The DCS rail is left to the DCS limit, which votes
through the same agent. Floors are dropped when the PMC goes away.

Add KUnit cases for combining floors next to the AP's DCS vote and for a
PMC that does not take the new floor.

Assisted-by: LLM
Signed-off-by: Ryan Murray <[email protected]>
A chip may need a performance floor for the encoder to run at full speed,
such as the SoC rail floor of the PMC on the M4 Pro. Accept an optional
sixth power domain named "perf" and attach it with the others, so it is
held exactly while the encoder is powered: from the first session until
the autosuspend after the last one, and dropped across a firmware
recovery power cycle like the codec domains.

Assisted-by: LLM
Signed-off-by: Ryan Murray <[email protected]>
The M4 Pro video encoder runs on the SoC fabric clock and encodes at less
than half speed while the SoC rail is at its idle state. Describe a PMC
floor that holds the SoC rail at its highest state, and give it to the
encoder as its performance domain.

Measured on the J616s with the same floor applied by hand (avebench, 600
and 240 frames): 1080p H.264 100 to 219 fps, HEVC 91 to 198, 4K H.264 27
to 59, 4K HEVC 26 to 57. macOS on the same machine: 236, 224, 62 and 59.

Assisted-by: LLM
Signed-off-by: Ryan Murray <[email protected]>
Linux decodes at about half the speed it could on the M4 Pro because
nothing raises the SoC rail while the decoder works; macOS votes a VMAX
floor for the decoder whenever frames are queued. Holding the SoC rail
at its performance level from the AP's PMC agent took H.264 1080p from
326 to 695 fps, AV1 4K from 198 to 420 and VP9 4K from 82 to 183 on a
J616s, every frame bit-exact against software decode.

A node can now list that floor as a second power domain, "perf", next
to the decoder's own. With more than one domain the core attaches none,
so attach them all with runtime PM device links: the floor is held
exactly while the decoder is runtime-active (frames in flight plus the
100 ms autosuspend delay) and released when it idles, rests or is
retired. The floor domain is shared and refcounted by genpd, so the
encoder's vote and this one combine. Nodes without it are unchanged.

The domain list is attached with runtime PM device links (the core
attaches no domain itself once there are several), and the links'
initial active references are settled before runtime PM is enabled, as
the encoder does, so the floor is not held from probe until the first
decode.

Assisted-by: LLM
Signed-off-by: Ryan Murray <[email protected]>
List pmc_soc_max as the decoder's second power domain, "perf", next to
its own, so the floor is held while it decodes and the encoder's and
decoder's votes combine. The binding gains the optional named domain.

With the floor held, a J616s decoded H.264 1080p at 695 fps instead of
326, AV1 4K at 420 instead of 198 and VP9 4K at 183 instead of 82, every
frame bit-exact against software decode.

Assisted-by: LLM
Signed-off-by: Ryan Murray <[email protected]>
@RyanTheTide
RyanTheTide merged commit f41ac3d into aurora-wip Nov 1, 2026
@RyanTheTide
RyanTheTide deleted the ave/perf-votes-2 branch November 1, 2026 04:48
@RyanTheTide

Copy link
Copy Markdown
Contributor Author

Benchmark summary against macOS on the same J616s (VideoToolbox baseline from 10-31).

Encode (avebench, 3 reps on the avepv1 boot):

without floor with floor macOS with floor, % of macOS
1080p H.264 99.7-100.9 217.8-219.2 235.6 93%
1080p HEVC 91.0-91.7 198.0-199.2 223.5 89%
4K H.264 27.1 58.7-59.1 62.1 95%
4K HEVC 25.8 57.3-57.6 59.0 97%

Decode (avd-bench N=1 Q4, best of 3, every frame MD5-checked against software decode):

without floor with floor macOS with floor, % of macOS
H.264 1080p 326 690 2582 27%
H.264 4K 117 248 681 36%
AV1 1080p 571 1116 2395 47%
AV1 4K 198 419 739 57%
VP9 1080p 248 548 897 61%
VP9 4K 82 183 249 74%

The decode gap left after the floor is decoder-side (queue depth and engine count, being worked on separately). Power, 4K H.264 decode, docked, same boot: 14.80 W at 123 fps without the floor, 15.41 W at 247 fps with it (46 to 25 mJ per frame). The floor held at idle costs 2.7 W, so it follows runtime PM and is released after the last session.

🤖 Generated with Claude Code

RyanTheTide added a commit that referenced this pull request Nov 1, 2026
Brings in #758 follow-ups and #773 (PMC performance floor with the AVD
perf-domain consumer). The one conflict is probe: keep the rewrite's
avd_pm_enable() and firmware probe boot, and settle the attached domain
links to suspended before it, as #773 does for the stock driver.

Assisted-by: LLM
Signed-off-by: Ryan Murray <[email protected]>
notmysegv pushed a commit to notmysegv/linux that referenced this pull request Nov 4, 2026
…tion/aurora

Bring integration/aurora up to aurora-wip b359258, the source of
7.3.0-aurora-fleet14f, promoted on the M1 Pro, M2, Neo and J616s on
2026-11-01 and 11-02. The range also covers the fleet14c, fleet14d and
fleet14e sources (f41ac3d, 4759557, 757fc07), each booted on
hardware. It adds aurora-silicon#773, aurora-silicon#776, aurora-silicon#777, aurora-silicon#737, aurora-silicon#713, aurora-silicon#785, aurora-silicon#786, aurora-silicon#788,
aurora-silicon#789 and aurora-silicon#787. No conflicts.

Assisted-by: LLM
Signed-off-by: Ryan Murray <[email protected]>
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