Repository navigation
drm/apple: enable v27 static-frame idle caching on T8122 - #4242
Conversation
In dcp_v27_early_restart(), the display coprocessor firmware is cold-restarted after power-down, just as in dcp_v27_warm_restart(). Reset the firmware-27 idle-cache state (including v27_idle_method_set, v27_idle_registered, v27_idle_state, and v27_idle_fences) before apple_rtkit_warm_restart() so applyProperty(138, 2) is re-negotiated with the restarted firmware and idle caching does not stall on stale pre-sleep state after deep sleep. Signed-off-by: Satya Benson <satya@benson.earth>
Enable hw.v27_idle_cache on apple_dcp_hw_t8122 so T8122 internal panels
running firmware 27.x participate in static-frame idle caching
("replay"). Older firmware profiles (14.x / 25G83) remain unaffected
because dcp_v27_idle_cache_supported() gates on
fw_compat == DCP_FIRMWARE_V_27_0.
Signed-off-by: Satya Benson <satya@benson.earth>
|
Merge readiness at
Areas: Updated by pr-readiness on pushes, edits, reviews and comments, and on a schedule. Rules: merge policy · labels. |
v27_panel_handoff() extracts apple_dcp_hw_t8122 from dcp.c and compiles it against a local struct apple_dcp_hw_data stub. Declare v27_idle_cache in that stub so the host test compiles after enabling v27_idle_cache on apple_dcp_hw_t8122. Signed-off-by: Satya Benson <satya@benson.earth>
There was a problem hiding this comment.
Verdict: MERGE at 7894c29
Checked: The reset runs only on the existing stopped-DCP path after power and DART restoration, immediately before RTKit restart. The rollback path refuses to power-cycle while RUN remains set. The reset invalidates the old cache state under the idle lock and adds no retry, loop, or firmware operation. An active DCP skips this branch.
Checked: Idle caching still requires the firmware-27 interface, a matching hardware capability, the main display, and an internal panel. The T8122 change is a SoC capability with no board-name conditions, and the corresponding host-test fixture declares the capability field.
Checked: Exact-head Host tests, Apple build, and display KUnit passed. The authored J613 receipt reports resume and cache re-entry after both deep cycles. Verified that the hardware-tested commit and this head differ only in the host-test fixture.
RyanTheTide
left a comment
There was a problem hiding this comment.
Approving at 7894c29. The review-lane App review at this head covers the code (idle-cache ordering vs DCP power-state changes, early-restart reset path, SoC scoping); J613 exact-head row is the hardware evidence. This adds the code-owner approval the branch rules need.
|
J615 (MacBook Air 13" M3, T8122), firmware 27.2, exact head
Afterwards the Mac went back to its production default ( |
DjDeveloperr
left a comment
There was a problem hiding this comment.
Reviewed at 7894c29 (this landed as 89ec99a while the review was running). The code is right.
Reset in the early restart. The reset sits inside if (e->stopped), after the DARTs are back and before apple_rtkit_warm_restart(). So it only runs when the firmware really was stopped and power-cycled, the same as dcp_v27_warm_restart() and dcp_s2r_warm_restart() already do. Nothing races it:
- The PM suspend calls
iomfb_v27_idle_cache_cancel()beforedcp_v27_early_suspend(). That closes admission, cancels the work with_syncand drainsiomfb.lock. - During resume no swap or modeset can reach the DCP before the CRTC comes back.
- The reset also clears
template_valid, so re-entry waits for a new displayed frame. That is the 0 -> 1 -> 2 -> 4 after each wake in your trace. - The second RTKit cycle in
dcp_v27_early_calls_on()(soft-off wakes) runs before any present, so it needs no second reset. - If the restart fails (
goto lost), the cleared state does no harm: the DCP is marked crashed, its CRTC resumes off, and the next sleep power-cycles it.
T8122 flag. It is match data on the DCP's own compatible, the same as T8132, and fw_compat == DCP_FIRMWARE_V_27_0 keeps 14.x off. Side effect worth knowing: dcp_caches_scanout() now returns true on T8122 27.2, so front-buffer drawing goes out through swaps, as it already does on J773g. There is no runtime switch, module parameter, magic constant or ADT value.
Checks on the merge with main.
- Hosted CI ran on the merge ref 764a052 (main a0e5cf1 + this head): build, DCP KUnit, host tests 1127/1127.
- Locally, main vs merge: apple-dcp selftests 102/102 on both (v27-panel-handoff ok) and dcpext26 PASS on both.
- W=1 of drivers/gpu/drm/apple with the J516s config: the same 2 warnings on both, both already on main, none in the touched files.
Still owed (after the merge): a J516s row. dcp_v27_early_restart() also runs on T6030 (v27_early_stop), so every J516s deep wake now runs this reset. Idle caching stays off there and the reset should be a no-op, but the merge rule wants a second-SoC row. We built a J516s A/B kit (main vs main + this PR, 2 deep sleeps each) and handed it to our M3 Pro lead. We'll post the result here.
|
J516s (M3 Pro, T6030, OS firmware 27.2) second-SoC post-merge A/B verification for Builds & boots
Results (2x
|
What: Enable firmware-27 static-frame idle caching (
v27_idle_cache) onapple_dcp_hw_t8122(follow-up to #3289) and reset idle-cache state indcp_v27_early_restart()beforeapple_rtkit_warm_restart()so idle caching re-negotiates cleanly after deep sleep.Tested: J613 MacBook Air 13" M3 (T8122, os-fw 27.2 / 26B123) at
7894c2968b26(identicaldrivers/tree to hardware-tested54aa91b4e4aa;7894c2968b26only addsv27_idle_cacheto theboot.pyhost-test stub) on the default kernel command line: boots cleanly, 0 failed units, 0 new kernel errors;v27_idle_cacheenters state 4 (mem=51117696 host=0) and exits cleanly on frame activity; same-machine A/B static-frame idle power delta at backlight 59/525 (AC): Total System-57 mW(2.687 W -> 2.63 W), AC Input-58 mW(2.688 W -> 2.63 W), Heatpipe-65 mW(838 mW -> 773 mW); 2/2 15 s RTC deep-sleep cycles (rtcwake -d rtc1 -m mem -s 15), including suspending directly from active state 4, with clean post-wake state-4 re-entry (replays=5) and camera //dev/accel/accel0intact;tools/testing/selftests/drivers/gpu/apple-dcp/run.py --group boot6/6 PASS (v27-panel-handoffok).Risk: two-way door · M3 (T8122) internal panels running firmware 27.x, plus any Mac using
dcp_v27_early_restart()Not yet: Other T8122 boards (J504/J513/J615); T8122 systems on firmware 14.x (25G83, gated off by
fw_compat == DCP_FIRMWARE_V_27_0); long-duration battery rundown with idle caching active.Details
drm/apple: reset v27 idle-cache state on early-stop firmware restart(88c2916a1daa):dcp_v27_early_restart()cold-restarts the DCP firmware after power-down viaapple_rtkit_warm_restart(), matchingdcp_v27_warm_restart(). Callingiomfb_v27_idle_cache_reset(dcp)before the restart clearsv27_idle_method_set,v27_idle_registered,v27_idle_state, andv27_idle_fencessoapplyProperty(138, 2)is re-negotiated with the restarted firmware after deep sleep instead of stalling on stale pre-sleep state.drm/apple: enable v27 static-frame idle caching on T8122(54aa91b4e4aa): Sets.v27_idle_cache = trueonapple_dcp_hw_t8122. Becausedcp_v27_idle_cache_supported()checksdcp->fw_compat == DCP_FIRMWARE_V_27_0, T8122 machines running older firmware remain unaffected.selftests: apple-dcp: declare v27_idle_cache in v27_panel_handoff stub(7894c2968b26): Addsv27_idle_cacheto the localstruct apple_dcp_hw_datastub intools/testing/selftests/drivers/gpu/apple-dcp/boot.pysov27-panel-handoffcompiles againstapple_dcp_hw_t8122.Evidence
7894c2968b26(base7303d70ea68d, 3 commits;git diff 54aa91b4e4aa..7894c2968b26 -- drivers/is empty)scripts/checkpatch.pl --no-tree: 0 errors, 0 warnings on all 3 commitspython3 tools/asahi/dcpext26-startup-tests.py: PASSpython3 tools/testing/selftests/drivers/gpu/apple-dcp/run.py --group boot: 6/6 PASS (ok 3 - v27-panel-handoff)s2idle [deep], 0 failed units):59/525, AC power (10 × 1 smacsmc_hwmonsamples after 3 s settle):v27_idle_cache=false,dc68a27f33d8)54aa91b4e4aa, state 4 active)2.687 W(2.674–2.701 W)2.63 W(2.62–2.64 W)-57 mW2.688 W(2.674–2.701 W)2.63 W(2.62–2.64 W)-58 mW838 mW(773–902 mW)773 mW(773–838 mW)-65 mWfile iomfb_v27.c +p) across initial entry, resume, deep sleep cycle 1, and deep sleep cycle 2 (entered directly from active state 4):