Repository navigation
AVE/AVD: hold the SoC rail floor while encoding or decoding on the M4 Pro (performance votes) - #773
Merged
Merged
Conversation
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]>
Contributor
Author
|
Benchmark summary against macOS on the same J616s (VideoToolbox baseline from 10-31). Encode (avebench, 3 reps on the avepv1 boot):
Decode (avd-bench N=1 Q4, best of 3, every frame MD5-checked against software decode):
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]>
This was referenced Nov 1, 2026
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]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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:
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.floor-soc-max(SoC rail, state 2) as the encoder'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:
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.
pmc-soc-max: rail1 level 2 held(AP agent floor 0x20) during an encode,released(floor 0) 5 s after the last session.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