Skip to content

drm/apple: m4: wake an idle T8132 external DCP without a DPTX re-announcement - #4040

Open
DjDeveloperr wants to merge 2 commits into
mainfrom
fix/t8132-ext-dcp-wake
Open

DjDeveloperr wants to merge 2 commits into
mainfrom
fix/t8132-ext-dcp-wake

Conversation

@DjDeveloperr

Copy link
Copy Markdown
Contributor

What: On a T8132 Mac with firmware 26.6.2, a monitor plugged in more than 5 s after boot stays dark, and that external DCP is gone until a reboot (external DCP restart failed at DPTX ready: -110). #3321 stops an idle external DCP after 5 s, and its wake waits for the firmware to announce its DPTX ports again, which it never does. Commit 1 keeps the ports over the stop, as before #3321, and drops the wait. Commit 2 makes a replug take the other external DCP when one has failed.

Tested: no hardware yet. Host tests: --only dcp 103/103, apple-dcp --group m4 10/10 (new m4-ext-wake), afk-compact-start 11/11, dcp-tunnel-prepare 18/18, apple-afkv2 2/2, dcpext26-startup-tests.py --mutants. Fabric KUnit on UML 118/118. W=1 of drivers/gpu/drm/apple/ with the T8132 backend built, LLVM and GCC: no new warnings.

Risk: two-way door · M4 (T8132) external displays on firmware 26.6.2; a plain revert undoes it.

Not yet: the hardware row: J713 (or J773g or J604) on firmware 26.6.2, external monitor plugged in more than 5 s after boot, replug, DPMS off/on, one s2idle, with 0 external DCP restart failed. A deep sleep with the monitor attached is worth adding, as the same wait broke that too.

Details

What breaks. iomfb_m4_ext_stop() withdrew both DPTX ports (port->enabled = false), and iomfb_m4_ext_start() ended in iomfb_m4_ext_reset_finish(), which waited 1 s for unit 0 to be announced and started under a new afk_power_gen. In the J713 report on #3454 every step before that works (power domain, both DARTs, RTKit to ON), then no AFK message arrives at all and the wait times out. The session is quarantined for the rest of the boot.

Why the ports are still there. apple_rtkit_wake_retained() restarts the firmware image that was kept: it answers the endpoint map with the endpoints already started, sends no INIT and starts nothing. Two things from before #3321 show that the firmware's DPTX session goes on:

So the AFK endpoints do not need an INIT, and there is nothing to wait for.

What this does. The ports stay published over the stop. The wake replays the receive words it held back, drops leftovers of an earlier teardown, opens transmission and is done. Anything that tries to use a stopped DCP gets -EBUSY from the AFK transmit fence, and a route wakes the DCP before its first DPTX call. The code that only existed for the second announcement goes away: rebind_allowed, dptx_service_rebind(), compact_rebind_gen, compact_start_err.

Sleep. Deep sleep uses the same stop and wake, so by the code every deep sleep with a live external DCP on 26.6.2 fails the same way since #3321 (nobody has run one since); before it, those rows passed. s2idle leaves the firmware running, so a monitor that is on survives it. An external DCP that was already stopped for idle stays stopped through either sleep and today fails at the next plug.

Commit 2. services_ready was only worked out for Thunderbolt tunnels, so a direct DP alt mode display kept getting the failed DCP, as the port's last pipeline. It is now false for a direct stream when the session failed, and dcp_fabric_free_route() passes such a pipeline over. With no other pipeline left the display waits, as it does when all of them are in use.

If the row shows that the firmware does not answer DPTX calls after the idle wake, the next step is to stop setting ext_idle_capable, so that the idle stop stays off.

Evidence
  • Head aad3a8509d3d, base main 5f32aa72fa7e.
  • Host tests ran in the CI image's toolchains (ubuntu 24.04, clang 18, gcc 13).
  • m4-ext-wake runs iomfb_m4_ext_stop(), iomfb_m4_ext_start() and iomfb_m4_ext_reset_finish() from the source, for the idle stop and for a deep sleep, with no announcement. It fails with the port withdrawn at the stop, with the wake timing out, and on main's iomfb_m4.c.
  • tunnel-route-tests.py: new case and the negative control snapshot-ignores-failure.
  • Fabric KUnit: 117 before, 118 with fabric_direct_services_test.
  • LLVM W=1 (aurora config, KUnit suites on, 70 objects): 0 warnings. GCC 16 W=1: two warnings in files this does not touch (apple_drv.c, dcp-m4-profile.h).
  • checkpatch.pl --strict: 0 errors, 0 warnings.

A monitor plugged into a T8132 Mac on firmware 26.6.2 more than 5 s after
boot stays dark, and its external DCP is lost until a reboot:

  external DCP restart failed at DPTX ready: -110
  Retained DCP session quarantined: -110

The wake from the runtime idle stop takes the CPU out of reset, withdraws
both DPTX ports and then waits 1 s for the firmware to announce them
again. The firmware does not: apple_rtkit_wake_retained() restarts the
image it kept, with no INIT and no endpoint start, so its AFK endpoints
and the services on them are the ones of before the stop. On a J713 with
26.6.2 no AFK message arrives and the wait times out.

That the firmware keeps the ports was known: one left connected across
the stop is still connected when the CPU restarts, see
dcp_t8132_sleep_release(). And until the idle stop was added, a port that
was announced again could not bind, as dptx_service_bind() refuses a port
that has a service. All the 26.6.2 deep sleeps that brought an external
display back did so over the service of before the sleep.

A deep sleep stops and wakes the DCP with the same two functions, so the
same wait fails the wake of every deep sleep with a live external DCP.
s2idle leaves the firmware running and is not affected.

Keep the ports published over the stop and wait for nothing at the wake,
as before. What may use a stopped DCP is already fenced: AFK transmission
is closed until the wake is done, and a route wakes the DCP before its
first DPTX call. Nothing needs to bind a second service to a port, or a
second service to an interface, so remove the code that did:
rebind_allowed, dptx_service_rebind(), compact_rebind_gen and
compact_start_err. Receive words held back over the wake are still
replayed, and calls left over from an earlier teardown still dropped.

The new m4-ext-wake test runs the stop and both wakes with no
announcement.

Fixes: e2b3bb8 ("drm/apple: m4: power down idle external DCPs at runtime")
Signed-off-by: DjDeveloperr <hey@djdev.me>
A quarantined T8132 external DCP cannot drive a display until a reboot,
but the route selection for a direct DP alt mode display does not look at
that: services_ready is only worked out for tunnels. A replug therefore
takes the failed DCP again, as the port's last pipeline or the lowest
free one, and fails with its error each time, while the other external
DCP is idle.

Work out services_ready for direct streams too, from the session's
failure alone, and let only a pipeline with it take one. A stream with no
other pipeline waits, as it does when the others drive displays, and a
modeset no longer moves a stream to the failed pipeline.

Signed-off-by: DjDeveloperr <hey@djdev.me>
@DjDeveloperr
DjDeveloperr requested review from a team as code owners December 3, 2026 03:13
@github-actions github-actions Bot added area:display Area from CODEOWNERS (bot) area:gpu Area from CODEOWNERS (bot) blast:m4 Macs affected, from Merge risk (bot) door:two-way Revertible or not, from Merge risk (bot) needs-hw-row No hardware row at the PR head (bot) needs-review No approving review from Core or Omarchy Mac yet (bot) labels Dec 3, 2026
@github-actions

github-actions Bot commented Dec 3, 2026 •

Copy link
Copy Markdown

Merge readiness at aad3a850: not ready yet

Check Detail
CI at head ok 9 checks passed
Review ok approved by RyanTheTide
Requested changes ok none
Hardware row at head no no line with the head SHA aad3a850, a Mac and a result in the PR body or a comment
Conflicts ok none
PR text ok Risk: two-way · M4 (T8132) external displays on firmware 26.6.2; a plain revert undoes it.

Areas: area:display, area:gpu

Updated by pr-readiness on pushes, edits, reviews and comments, and on a schedule. Rules: merge policy · labels.

@RyanTheTide RyanTheTide 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.

Reviewed aad3a85. The retained wake preserves the DPTX service, clears sink AV state and still replays AFK before checking the session error. Direct route selection skips a quarantined M4 pipeline while preserving the existing tunnel readiness check. The reported fixtures cover retained wake and alternate route selection. The 26.6.2 hardware row is pending.

@github-actions github-actions Bot removed the needs-review No approving review from Core or Omarchy Mac yet (bot) label Dec 3, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:display Area from CODEOWNERS (bot) area:gpu Area from CODEOWNERS (bot) blast:m4 Macs affected, from Merge risk (bot) door:two-way Revertible or not, from Merge risk (bot) needs-hw-row No hardware row at the PR head (bot)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants