Repository navigation
Conversation
A DPMS off of a Type-C output releases its DPTX session; the enable
that follows reconnects it in dcp_poweron() before the mode set of the
same commit. The HPD the firmware answers that reconnect with runs the
hotplug worker while the mode is not set yet, and the worker reported
the link bad and replayed the CRTC. wlroots answers a bad link by
destroying the output, which disables the CRTC it was enabling; the
next enable does the same, forever.
On a J813 with an EIZO EV2780 on USB-C, every DPMS off and on ended in
that loop: about three cycles a second ("connector DP-2: Bad link
detected", "Destroying output 'DP-2'"), the display dark and the
desktop sluggish, until the output was disabled or the cable pulled.
Mark the CRTC enable as pending, from before dcp_poweron() until its
mode set has run, and let the worker report a bad link, or replay the
CRTC, only when no such enable and no mode set is in flight. A mode set
that fails still ends in a bad link once the enable is done.
Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de>
This was referenced Nov 15, 2026
Contributor
Author
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.
A DPMS off and on of a USB-C display can end in an endless loop. In it, wlroots destroys and re-creates the output about three times a second. The display stays dark and the desktop gets sluggish until the output is disabled or the cable is pulled. This fixes the loop.
The loop
dcp_poweroff()).dcp_poweron()reconnects DPTX before this commit's mode set.connectedwith no valid mode, sets the link-status property BAD and replays the CRTC.connector DP-2: Bad link detected,Destroying output 'DP-2'). That disables the CRTC (set_hpd(0)viaapple_crtc_atomic_disable()→dcp_poweroff()), and the firmware tears the video interface down.The tree already guards this wlroots cycle twice:
typec_crtc_off);dcp_poweron()waits for (typec_poweron_hpd).Neither covers the window in which the CRTC enable runs.
typec_crtc_offis cleared at the start ofdcp_poweron(), andtypec_poweron_hpdis cleared before the asynchronous worker runs.The fix
apple_crtc_atomic_enable()marks the enable pending (typec_enable_pending) beforedcp_poweron(), and clears the mark once the commit's mode set has run, or on itsfailed:path. While the enable is pending, or a mode set is in flight (mode_state.changing), the hotplug worker neither reports a bad link nor replays the CRTC. The hotplug event itself is still sent. A mode set that fails still ends in a bad link once the enable is done.Testing
Reproduced on a J813 (M5 MacBook Air, macOS 27.2 stub, Linux at EL2). The kernel was our J813 tree with the external display commits of #1806, and the display was an EIZO EV2780 directly on the rear USB-C port. Under sway 1.12,
swaymsg 'output * power off', 12 s,swaymsg 'output * power on', three rounds each:DP-2after the wakeBad link detectedand noDestroying output 'DP-2'. There were no hotplugs while idle.dptxport_set_hpd()(theset_hpd(0)came from sway's commit throughapple_crtc_atomic_disable()), andsway -d.tools/asahi/run-host-tests.py: 321/321.drivers/gpu/drm/apple/builds with defconfig +asahi.config(LLVM 22).apple_drv.candiomfb.cbuild with W=1 and no warnings.--strictis clean.The T8142 external display path itself is #1806 (draft). The code changed here is the generic Type-C DCP path, and it applies to integration unchanged.
cc @Acelogic @DjDeveloperr @RyanTheTide @LiamRay10