Skip to content

drm/apple: dcp: keep the display DART dark while DPMS has its domains off - #2962

Merged
RyanTheTide merged 1 commit into
integration/aurorafrom
notch-dyn3/dcp-dart-dark
Nov 23, 2026
Merged

RyanTheTide merged 1 commit into
integration/aurorafrom
notch-dyn3/dcp-dart-dark

Conversation

@RyanTheTide

@RyanTheTide RyanTheTide commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

Problem

On a DCP that is power-cycled for DPMS (hw.s2r), DPMS off stops the firmware and lowers the display power domains (DISP_CPU, DISP_FE, DISP_SYS). The display DART, which maps every framebuffer, is in the same domain. It was only marked dark (maps and unmaps go to memory only, TLB invalidations are held until power-on) when the firmware's D572 reported 0 at the stop.

The M4 MacBook Air's firmware (27.2) reports 1 in that D572. The DART therefore stayed "lit" while its domain was off. The first unmap after DPMS off then wrote its TLB registers with the domain off, and the SoC reset with nothing logged. The unmap comes from a compositor freeing a framebuffer.

This is what held #2814 (runtime notch) on the J713. After a hidden->shown switch, Mutter frees the old geometry's buffers some seconds later. A DPMS cycle in that window, or a switch while the display is off, reset the Mac every time. It is not specific to the notch: any framebuffer free while the J713's display is off by DPMS hits it.

Change

dcp_s2r_domains_off() marks the display DART dark (apple_dart_power_dark(..., true)) before it lowers the domains, as the external DCP's power-off already does. dcp_s2r_warm_restart() marks it lit again right after dcp_s2r_domains_on(), which runs the held invalidations.

  • Where D572(0) already marked it dark, the first call is a no-op.
  • D572(1) at power-on still lights it, as before.
  • No new parameter. No chip, board or firmware gate.

Testing

J713 (M4 Air, firmware 27.2), fleet85 kernel plus a dev appledrm module set (fleet85 + linux#2814 + this change):

  • Rows that reset 9/9 without this change now pass 11/11 across two one-shot boots:
    • DPMS 3 s after a hidden->shown switch, x5.
    • Switch to shown while DPMS-off, then DPMS on, x2.
    • hidden->shown->hidden, then DPMS 3 s later, x2.
    • The reverse switch, then DPMS 3 s later, x1.
    • One more DPMS row after a switch.
  • Kprobe trace: apple_dart_power_dark(dark=1) at every DPMS power-off and dark=0 right after the domains are up. The kernel log has no DART fault and no DCP error.
  • Neo (T8140, the tip user of this path), the same module set:
    • 6/6 DPMS off/on cycles, the display back each time, no DART fault or DCP error.
    • Its firmware's D572 does report 0 at the stop, so the new dark call is a no-op there.
    • The DART is lit right after the domains are up, before D572(1).
  • J615 (M3 Air) and J616s (M4 Pro MacBook Pro) have no hw.s2r, so they don't use this path. With linux#2814 + this change, the notch DPMS rows pass: J615 5/5, J616s 4/4.
  • checkpatch --strict clean. W=1 dcp.o clean on integration/aurora a4b51cd. apple-dcp host tests: groups lifecycle and quiesce, 0 failures.

Still to run

Nothing for this change.

How it was found (for reviewers)
  • The reset point moved between runs: in DPMS off right after A500, at DPMS on, or (switch while off) at the sysfs write itself with the firmware already stopped and the domains down.
  • With gnome-shell SIGSTOPped around the off-state switch, the kernel side survives 5 s: the connector commit, the hotplug work and the fbdev re-probe. The reset follows gnome-shell's reaction to the hotplug.
  • With printk_delay (dev only) its last ioctls before the reset are DRM_IOCTL_MODE_CLOSEFB and DRM_IOCTL_MODE_DESTROY_DUMB. No DCP mailbox message was sent in the window.
  • Kprobes on the stop path show apple_dart_display_streams(streams 0x10001, on=1) from D572 during every DPMS off on this firmware. Streams 0x10001 are the display subsystem and piodma on iommu@30a300000, which is in the DCP's power domain.
  • The DCP's own DART is stopped by dcp_s2r_stop_streams() as before. Only the framebuffer DART was left lit.

Assisted-by: LLM (Claude:Opus 5.5)

… off

On a DCP that is power-cycled for DPMS (hw.s2r), DPMS off stops the
firmware and lowers DISP_CPU, DISP_FE and DISP_SYS. The display DART,
which maps every framebuffer, goes off with them. It was only marked
dark (maps and unmaps to memory only, invalidations held until power-on)
when the firmware's D572 reported 0 at the stop. The M4 MacBook Air's
firmware (27.2) reports 1 there, so the DART stayed lit: the first unmap
after DPMS off, e.g. a compositor freeing a framebuffer, wrote its TLB
registers with the domain off, and the SoC reset with nothing logged.

A runtime notch switch shows it every time: the compositor frees the
old geometry's buffers some seconds after the switch, so a DPMS cycle in
that window, or a switch while the display is off, reset the Mac.

Mark the display DART dark before the domains go off, as the external
DCP's power-off already does, and lit again as soon as the warm restart
has them back up, which runs the held invalidations. Where D572(0) did
mark it dark, the first call is a no-op; D572(1) at power-on still lights
it as before.

Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>

@DjDeveloperr DjDeveloperr left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Formal §1–§6 pre-PR checklist review at 48b7191062ea66c05643a991fe92aaeed323f5cf:

  • §1 No model gating: Pass. Applies uniformly to every hw.s2r DCP path in dcp_s2r_domains_off() / dcp_s2r_warm_restart() with no chip, board, or firmware gates.
  • §2 Production-ready: Pass. No new parameters, retries, or lab-only paths.
  • §3 Safety: Pass. Marking s2r_disp_dart dark before lowering DISP_CPU/DISP_FE/DISP_SYS (mirroring dcp_s2r_ext_domains_off()) prevents framebuffer unmaps from hitting unpowered DART TLB registers and resetting the SoC when firmware D572 reports 1 at stop. Re-lighting right after dcp_s2r_domains_on() flushes held display_tlb_stale invalidations before DCP streams/RTKit resume; all callers (__dcp_dpms_power_off/dcp_dpms_power_on, dcp_s2r_prewarm_work including its failure fallback, dcp_s2r_refused_domains_off/dcp_s2r_display_on, and dcp_s2r_ext_cycle for t8142-dcpext) pair cleanly, and where D572(0) already marked it dark (e.g. T8140) the call is an idempotent no-op.
  • §4 Clean-room & attribution: Pass. Commit 48b7191062ea carries human author/committer (Ryan Murray <ryan@aurorasilicon.org>) and human Signed-off-by only; Assisted-by: is in the PR body.
  • §5 Evidence: Pass. Strong A/B on J713 (9/9 reset baseline -> 11/11 pass with kprobe verification and zero DART faults/DCP errors), Neo/T8140 (6/6 DPMS cycles), and J615 (5/5), with live CI green (Apple DRM KUnit / kunit and Host tests / host-tests).
  • §6 Naming: Pass.

Non-blocking follow-up notes:

  1. On a dark wake after a real system sleep (dcp_s2r_resume() with pm_dark_wake() && dcp_s2r_capable()), domains were lowered by the sleep controller rather than dcp_s2r_domains_off(), so on firmware where D572 reports 1 at stop s2r_disp_dart->display_dark would remain false while domains stay off across the dark wake — worth checking when extending 27.2 S2R dark-wake coverage.
  2. Pre-existing apple_dart_power_dark(..., true) does not serialize against dart->lock for an already-in-flight TLB flush on another CPU (same as dcp_s2r_ext_domains_off()).
  3. Please include the full default-cmdline regression tuple (0 SELinux denials, 0 failed units, 0 new kernel errors) on the remaining J616s run if convenient.

Verdict: Approve.

Assisted-by: LLM (Gemini 4 Neon)

@RyanTheTide

Copy link
Copy Markdown
Contributor Author

Independent review of 48b7191062ea on integration 48470aad3f07. No blockers. The internal power-off path marks the framebuffer DART dark while the registers are still accessible. The warm restart clears that state after the domains come up, so deferred invalidations run before the firmware restarts. Both transitions use the existing DART helper and add no device selectors.

The diff applied cleanly. Apple DCP host tests passed 35/35 lifecycle and 19/19 quiesce on the combined source. The J713 11/11 and Neo 6/6 DPMS results in the PR cover the changed power path. A separate J713 run should qualify classic DPAV service re-admission with this change present.

Assisted-by: LLM (Codex)

@RyanTheTide

Copy link
Copy Markdown
Contributor Author

Hardware evidence for head 48b7191062ea66c05643a991fe92aaeed323f5cf. Both DART hunks match the tested display-module overlay exactly. The underlying kernel was fleet85 with the runtime notch change and the default kernel command line.

Board Result
J713 (M4 Air, DCP 27.2) 11/11 DPMS rows passed across two one-shot boots. The affected baseline rows reset 9/9.
Neo 6/6 DPMS cycles passed.
J615 (M3 Air) 5/5 notch and DPMS regression rows passed.
J616s (M4 Pro) 4/4 notch and DPMS regression rows passed.

No DART faults or new DCP errors were recorded. All four Macs were restored to their saved fleet85 defaults with SELinux enforcing, an empty next boot entry and 0 failed units. The J713 row whose RTC request returned immediately counts as DPMS coverage.

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.

2 participants