Skip to content

drm: apple: time the relink window from a Type-C CRTC's first enable - #2024

Closed
sithglan wants to merge 3 commits into
aurora-silicon:integration/aurorafrom
sithglan:thomas/dcp-typec-first-enable-relink
Closed

sithglan wants to merge 3 commits into
aurora-silicon:integration/aurorafrom
sithglan:thomas/dcp-typec-first-enable-relink

Conversation

@sithglan

@sithglan sithglan commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

A USB-C monitor plugged in while the outputs are blanked (the compositor's idle power-off) can stay dark after the wake, until the cable is replugged. This lets the existing Type-C relink catch that case too.

What happens

Plugged in while the outputs are off, the sink gets its link trained only when its CRTC is first enabled, possibly minutes later. On a J813 with an EIZO EV2780:

  • The first enable, 137 s after the plug, failed: DCP logged IOAVVideoInterface prepareLink() failed with 0xe0114100 and dropped the sink.
  • The sink still asserted HPD and stayed attached in DP Alt Mode.
  • Nothing retried, so the monitor woke up but showed no picture until it was replugged. A replug with the outputs on brought it up at once.

The relink (d00e624) exists for exactly this kind of drop: DCP drops a sink that still asserts HPD. It starts only within 10 s of the link coming up, though, and that window opens at only two points:

  • the attachment (dcp_dptx_connect()): 137 s earlier here;
  • a DPMS wake of a CRTC that was powered off: this CRTC had never been enabled.

The fix

dcp_poweron() now also times the window from a Type-C CRTC's first enable for an attached sink (dcp_relink_link_up()). Unlike a DPMS wake, this keeps the attachment's retries, so it cannot start a fresh budget of relinks. A new KUnit case, relink_first_enable_test, covers both:

  • a drop long after the attachment relinks when the link came up at the enable;
  • the enable does not reset the retries.

Testing

On a J813 (M5 MacBook Air, macOS 27.2 stub, Linux at EL2): our J813 tree with #1806's external display commits, the EIZO directly on the rear USB-C port, sway 1.12.

  1. Switched the outputs off (swaymsg 'output * power off').
  2. Unplugged and replugged the EIZO.
  3. Woke the outputs 33 s after the attach.

The first mode set failed as before (prepareLink() failed). Then came DCP dropped a sink that asserts HPD, relinking the Type-C sink (1/3), and 1.5 s later mode_set_gated: 2560x1440@59 Hz ... link: 1. The picture was confirmed on the monitor, with 3 hotplugs in total. Without the change the same sequence stays dark.

On this branch, which is integration/aurora c0a2a75 plus this commit:

  • the DCP fabric KUnit suite under QEMU (arm64): 113 passed, 1 skipped, including the new case;
  • tools/asahi/run-host-tests.py: 321/321;
  • drivers/gpu/drm/apple/ builds (defconfig + asahi.config, LLVM 22), and dcp.c builds with W=1 and no warnings;
  • checkpatch --strict is clean.

Refresh on 2026-11-17: head e249b13 merges integration/aurora at a7dd26e and supplies the missing external-relink stub in the existing cold-boot backlight fixture. The fixture fix changes no production code or assertions. All 394 Aurora host runs pass, including the five cold-boot negative controls. The merged production tree also builds dcp.o with W=1 and no warnings, and passes 399 QEMU KUnit cases with two skips. The physical display sequence above remains the qualification of c051d35; no fresh physical run was performed.

This is independent of #2023, the DPMS wake loop fix found in the same session. Each applies to integration on its own.

cc @Acelogic @DjDeveloperr @RyanTheTide @LiamRay10

A USB-C monitor plugged in while the outputs are off (a compositor's
idle blanking) gets its link trained only when its CRTC is first
enabled, possibly minutes later. On a J813, an EIZO EV2780 attached
that way lost the link at that mode set: DCP logged "IOAVVideoInterface
prepareLink() failed with 0xe0114100" and dropped the sink, which still
asserted HPD and stayed attached in DP Alt Mode. The relink window had
been opened at the attachment, 137 s earlier, and the CRTC had never
been powered off, so the DPMS wake path did not open it again either.
The display stayed dark until the cable was replugged; a replug with
the outputs on brought it up at once.

Time the window from that first enable as well, as dcp_dptx_connect()
does for the attachment. Unlike a DPMS wake, it keeps the attachment's
retries.

With this, the same plug-in with the outputs off and a wake 33 s later
failed its first mode set as before, got "relinking the Type-C sink
(1/3)", and was shown at 2560x1440 1.5 s later.

Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de>
The first-enable relink change makes the extracted dcp_poweron function
reference dcp_relink_link_up. The cold-boot backlight fixture models panel
power-on and already stubs the external relink boundary. Add the missing
stub so its existing normal and negative controls compile again.

No production code or test assertions change.

Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de>
@sithglan

Copy link
Copy Markdown
Contributor Author

Both commits are already in integration/aurora through the J813 series #2135: the selftest stub as ce6b4e1 (patch-identical), and the relink-window change as 09ee6cf. That one has the same code and differs only by a paragraph of test results in the commit message. Nothing is left to merge, so I'm closing this PR.

@sithglan sithglan closed this Nov 18, 2026
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