Repository navigation
drm/apple: train a Type-C display link again when the sink repeats IRQ_HPD, so a display that trained blank gets its picture - #2604
Conversation
|
dj, a small one in your Type-C retrain path, for when you have a minute. On the J775D (firmware 27, 27.2 stub), a DisplayPort monitor on USB-C came up with a signal and no picture after boot The fix reuses your power-cycle path in On the J775D it trained the link again 3.5 s after the first mode set, the desktop showed, and no IRQ_HPD followed in Would you rather have the flag in the hotplug reasons ( |
|
Assisted-by: LLM (Claude:Opus 5.5) |
|
The diagnosis makes sense, and reusing the power-cycle path is a reasonable fix. Two things before it goes in:
It would also help to have a run with a sink that raises IRQ_HPD while its link is good (a dock or an HDCP monitor), to show it does not blank in a loop. Assisted-by: LLM (Claude:Opus 5.5) |
6f5685e to
7adafdc
Compare
|
Thanks. Both points are in the updated commit; the PR still has one commit. Host tests. The apple-dcp failures were one compile error, and test 74 ( (a) Bounded power cycle. A firmware 27 Type-C sink's IRQ_HPD gets the plain same-mode replay first, as it did before this PR. Only when the same connection raises IRQ_HPD again within 30 s of that replay does the hotplug worker power cycle the CRTC. Each power cycle needs a replay that did not help before it, and a connection gets at most two ( On the window: 30 s is not "a few seconds". The blank-trained sink here repeats IRQ_HPD every 18.9 to 19.5 s (14 intervals in one boot), and that repeat is the only sign we get that the replay did not help. With a window of a few seconds the second request is never seen, and the display stays blank. 30 s is about 1.5 times that period. The longer window means more IRQ_HPDs can count as a repeat; the cap of two per connection limits what that costs. If you would rather have a shorter window, 25 s still covers this sink, with less margin. (b) Reason bit. Done. J775D (M5 Ultra), 27.2 stub, a DisplayPort monitor on a USB-C port and HDMI on the other DCP:
Nobody watched the DP monitor during the boot with the power cycle. The earlier version of this patch, which power cycled on the first IRQ_HPD, was watched, and the picture appeared after the cycle. Sink that raises IRQ_HPD with a good link. We have no dock and no HDCP monitor here, so I can't show the no-loop case on hardware. With the cap, such a sink costs at most two blanks per connection. |
|
Checked the updated commit. Both points are covered. A sink IRQ gets the plain replay first. The CRTC is power-cycled only when the same connection asks again within Assisted-by: LLM (Claude:Opus 5.5) |
7adafdc to
4f921ee
Compare
|
Following Aurora's pre-PR checklist, I've dropped the firmware 27 condition. A repeated IRQ_HPD now power cycles the CRTC on every firmware, still only after a replay of the mode that did not help, and at most twice per connection. Where a mode set of an unchanged timing trains the link again, the replay should already fix a blank link, so the sink stops asking and no power cycle follows. The cost on other firmware is a sink that keeps raising IRQ_HPD while its link is good: up to two blanks per connection, where today it gets none. We only have the J775D, on firmware 27. Could your lab run a Type-C DisplayPort monitor on a Mac with older DCP firmware (12.3 to 26.6) on this head? A boot and a replug would do, and a dock or an HDCP monitor too if you have one. The kernel logs Here, on the J775D (firmware 27), this head behaves as before: a boot whose link trained with errors got the replay at the first IRQ_HPD and one power cycle 19.0 s later, after which the link came up and no IRQ_HPD followed up to 123 s. Host tests: 451 of 451 on base and head. |
|
Re-review of 4f921ee: No blockers. Both points from our last comment stay resolved at this head. The power cycle comes only after a replay that did not help, within HW row: a Mac on pre-27 DCP firmware (M1 Pro or M2) on this head with a USB-C DisplayPort monitor: boot plus two replugs, then the same with a dock or an HDCP monitor. Pass: picture on every plug, the count of Assisted-by: LLM (Claude:Opus 5.5) |
|
On the row you asked for: I tried the A18 Pro (J700, firmware 26.x) with this head's appledrm ready to swap in, but its only external display is behind a DisplayLink adapter, not DisplayPort alt mode. Assisted-by: LLM (Claude:Opus 5.5) |
DjDeveloperr
left a comment
There was a problem hiding this comment.
Pre-PR checklist review at 4f921eebe48e (CI: host-tests passing, 451/451 including apple-dcp).
Code & policy (§1–§4, §6): 0 blockers.
- §1: Dropping the firmware-27 gate is right; escalation now depends purely on sink repeat behavior (
DCP_HOTPLUG_SINK_IRQ) across all Type-C DCP firmwares. - §2: Queuing
DCP_HOTPLUG_SINK_IRQ | DCP_HOTPLUG_READYin oneatomic_or()afterdcp_mode_invalidate()and consuming it indcp_hotplug()'satomic_xchg()avoids the worker race cleanly. Verifieddcp->typec_unplugsis incremented only on real disconnect (dcp_dptx_disconnect_oob()indrivers/gpu/drm/apple/dcp.c:3920) and never ondcp_set_crtc_active(), so the 2-power-cycle-per-connection cap holds and resets properly on unplug.DCP_SINK_IRQ_WINDOW_MS(30 s) is a measured repeat-detection window (~1.5× observed 18.9–19.5 s repeat interval), not a sleep/retry hack. - §4 / §6: Single commit carries human author/committer and
Signed-off-by:only (zero AI trailers); PR body hasAssisted-by:; naming clean.
Holding for §5 hardware evidence (and minor housekeeping):
- Pre-27 DCP firmware Mac (12.3–26.6) row still open: Because the firmware-27 gate is gone, this path runs on every Type-C DCP firmware. Still needs a USB-C DisplayPort boot + replug run on a pre-27 Mac (plus a dock/HDCP good-link
IRQ_HPDcheck if available), reporting picture on every plug,sink IRQ_HPD again: power cyclingcount (expected 0 on good links, <= 2 worst case), 0 DCP crashes, and 0 new kernel errors. - J775D live head (
4f921eeb): Boot log confirms replay -> 2ndIRQ_HPD19.0 s later -> power cycle 1/2 -> link up at 31.9 s with 0 furtherIRQ_HPDto 123 s and 0 new failed units, though the PR notes nobody visually watched the monitor on that boot; visual confirmation on the live head would close that gap too. - Please also check/confirm the unchecked
- [ ] Hardware safety rules followed for every test bootitem in the PR body checklist, and update the PR title (which still saysfirmware 27) to match the commit subject.
Minor non-blocking note:
- In
dcp_hotplug()(drivers/gpu/drm/apple/iomfb.c:2081),dcp_sink_irq_power_cycle()runs beforedcp_retrain_active_crtc()checks whether an active retrainable CRTC exists (iomfb.c:1533). If a sink raises repeatedIRQ_HPDbefore userspace enables a CRTC, it could consume a power-cycle budget slot without actually cycling.
Assisted-by: LLM (Gemini 4 Neon)
… so a retrain with nothing to cycle no longer uses up the budget The hotplug worker spent one of a rebuilt T6020 tunnel's DCP_TUNNEL_POWER_CYCLES, the budget that commit 8800ffe ("drm/apple: power-cycle a T6020 tunnel CRTC that lost its mode") added, before dcp_retrain_active_crtc() took the modeset locks. There, finding no active CRTC this connector can retrain, or a mode a commit has already set, it does nothing, yet the slot was gone: two such passes left a later lost mode without its power cycle until the mode was valid again. dcp_retrain_active_crtc() now reports whether it started a power cycle, by asking the CRTC to turn off, and the worker counts it only then. A power cycle whose off fails still counts, so the budget still bounds the attempts, and it is still reset when the mode is valid. The dcpext26 retrain host test passes the new argument and checks it: set for the power cycle it does, clear when a commit has set the mode, when there is no active CRTC, and on the reset and release paths. Signed-off-by: Jeff Queisser <funkzy@users.noreply.github.com>
…Q_HPD, so a display that trained blank gets its picture On the M5 Ultra Mac Studio (J775D), a DisplayPort monitor on a USB-C port can come up with a signal and no picture, after boot or after a replug: its link training reported errors, and the sink then raises IRQ_HPD every 19 s. Each request goes to dcp_retrain_oob(), and the hotplug worker applies the active mode again. On firmware 27 a mode set with an unchanged timing does not train the link again, so the display stays blank until userspace sets another mode. IRQ_HPD does not always mean a lost link: HDCP, MCCS, test requests and dock or adapter state changes raise it too, and for those applying the mode again is enough. So a Type-C sink's IRQ_HPD still gets that replay first. Only when the sink raises IRQ_HPD again within 30 s of a replay does the hotplug worker turn the CRTC off and on, as it already does for a rebuilt T6020 tunnel (dcp_retrain_active_crtc() with power_cycle). That releases the DPTX link and connects it again before the mode is set, so the link is trained anew. The connector stays connected and userspace gets no hotplug event. The link status is not set to bad for a power cycle, so that userspace does not race it with a mode set of its own. Each power cycle needs a replay that did not help before it, and a display connection gets at most two (DCP_SINK_IRQ_POWER_CYCLES); an unplug starts the count again. A power cycle is counted only once it was started, the CRTC asked to turn off, by dcp_power_cycle_done(), which counts a T6020 tunnel's too: one asked for with no active CRTC to cycle, or with a mode a commit had already set, spends nothing. A sink that keeps raising IRQ_HPD while its link is good therefore blanks at most twice per connection, and is then only answered with the replay. The window is 30 s because the blank sink above repeats IRQ_HPD every 18.9 to 19.5 s: a window of a few seconds would never see its second request. The request reaches the worker as a hotplug reason of the connector, DCP_HOTPLUG_SINK_IRQ, as Ryan Murray suggested in review: it is queued with READY in one atomic_or(), after the mode was invalidated, and the worker takes it with the other reasons in its one atomic_xchg(). A flag read apart from the reasons could be taken by a run already under way, and the run queued for that IRQ_HPD would then go without it. The apple-dcp selftests, which build dcp_typec_route_apply() on the host, get a stub for the new dcp_retrain_sink_irq() beside the one for dcp_retrain_oob(). The other IRQ_HPD cases are unchanged: a sink the firmware disconnected still goes through dcp_dptx_recover_irq(), a running relink still connects the sink anew (dcp_typec_sink_relink()), H17P pipes and the T6030 external processors keep their own handling. The new path applies on every firmware, with no version check: the replay comes first, and the cap of two per connection keeps the power cycle to sinks the replay did not help. Where a mode set of an unchanged timing trains the link again, a sink whose link the replay fixed stops raising IRQ_HPD and no power cycle follows; a sink that keeps raising IRQ_HPD with a good link blanks at most twice per connection there too. It was tested on firmware 27, on the J775D only. Tested on the J775D through the 27.2 stub, with a DisplayPort monitor on a USB-C port and HDMI on the other DCP, in three boots; the first two ran with a firmware 27 check in place, which takes the same path on this firmware. In two of them link training at boot reported errors. The sink's first IRQ_HPD, at 10.4 and 10.7 s, got the replay, and the firmware left the link as it was. Its second, 19.0 and 19.1 s later, power cycled the CRTC: the link was trained again and up at 31.9 and 32.2 s, and no further IRQ_HPD came up to 123 and 72 s, when the checks ended. In the other boot the link recovered through the relink before an IRQ_HPD reached the replay, and a cable replug trained cleanly, with the desktop back on the monitor a few seconds after the plug. HDMI kept its desktop throughout, and neither DCP crashed or recovered. No sink that raises IRQ_HPD while its link is good, such as a dock or an HDCP monitor, and no Mac on older DCP firmware was available for testing. Signed-off-by: Jeff Queisser <funkzy@users.noreply.github.com>
4f921ee to
24c9b1a
Compare
|
Thanks. On your minor note: you were right, and it is fixed in the new head, 24c9b1a.
We have no M2 Pro or Max, so the tunnel count is untested here. If you or an M2 Pro/Max owner can run it: a Type-C display through a dock that rebuilds the tunnel, a replug, the power-cycle count in the kernel log and 0 DCP crashes, with and without this PR. Own-base row for this head: integration/aurora 00cbc67 plus #1973 (the J775D's GPU node, for the desktop), with and without this PR, nothing else. Kits The IRQ_HPD case did not run, though: the DisplayPort monitor was on a USB-C port this tree doesn't route to a display coprocessor. The replay-then-power-cycle boot, its baseline and a replug on this base, with someone watching the monitor, come next. Until then the earlier IRQ_HPD boots stay in the body as labelled extra evidence with their base. Your other hold item is still open too: the row on pre-27 DCP firmware (12.3 to 26.6). No such Mac here; the body asks their owners. The hardware-safety box stays unticked for a stated reason. The three IRQ_HPD boots of 11-20, cited as extra evidence, ran before our dead-man and temperature guard. Every own-base boot ran under both. I'll tick the box once the IRQ_HPD row has been rerun under them. The title follows the second commit's subject. Assisted-by: LLM (Claude:Opus 5.5) |
|
Re-review of 24c9b1a: no blockers.
On the T6020 tunnel count: I don't have an M2 Pro or Max either, so that row still needs an owner. The rows still open are the ones you list: the watched replay-then-power-cycle boot and a replug at this head on its own base, and a Mac on pre-27 DCP firmware with a USB-C DisplayPort monitor. Assisted-by: LLM (Claude:Opus 5.5) |
|
Closing in favour of #2879, which takes a different approach after finding the cause: on the alt-mode path a sink's IRQ_HPD was answered by re-applying the unchanged mode instead of reaching the firmware's DPTX port. The power-cycle retry on a repeated IRQ_HPD is withdrawn. Thanks to Ryan and dj for the reviews here. dj, the T6020 tunnel-count fix from this PR's last head is available as its own PR if you want it. |
Problem
On the Mac Studio (M5 Ultra, J775D), a DisplayPort monitor on a USB-C port can come up with a signal and no picture, after boot or after a replug: its link training reported errors, and the sink then raises IRQ_HPD about every 19 s. Each request ends in
dcp_retrain_oob(), and the hotplug worker applies the active mode again. On firmware 27 a mode set with an unchanged timing does not train the link again, so the screen stays blank until userspace sets another mode.Why this shape
IRQ_HPD had one answer, a replay of the active mode, and the driver already has a second one for a link that must be trained again: the CRTC power cycle used for a rebuilt T6020 tunnel (
dcp_retrain_active_crtc()withpower_cycle). An earlier version chose between them by firmware version (27), which would power cycle on IRQ_HPDs raised for HDCP, MCCS or a dock's state, and gates on a version rather than on what happened. Here the sink's behaviour decides: a repeat IRQ_HPD within 30 s of a replay means the replay did not help, so the existing power-cycle path runs, at most twice per connection, with an unplug resetting the count. A power cycle counts against a budget only once it was started, through one helper for both budgets, this one and the T6020 tunnel's: a pass that finds no active CRTC to cycle, or a mode a commit already set, spends nothing. Where a same-mode set does train the link, the sink stops raising IRQ_HPD after the replay and no power cycle follows, so older firmware keeps today's behaviour for sinks the replay fixes. H17P pipes and the T6030 external processors keep their own handling.Change
Two commits in
drivers/gpu/drm/apple.The first changes when the count that dj's 8800ffe ("drm/apple: power-cycle a T6020 tunnel CRTC that lost its mode") added is taken.
dcp_retrain_active_crtc()now reports whether it started a power cycle, by asking the CRTC to turn off, and the hotplug worker counts a rebuilt T6020 tunnel's power cycle (DCP_TUNNEL_POWER_CYCLES) only then; one whose off fails still counts. The rest of that commit's design stays: the branch condition, the cap and its reset when the mode is valid. Before, the slot was spent before the modeset locks were taken; a pass that found no active CRTC this connector can retrain, or a mode a commit had already set, did nothing and still used it up. The dcpext26 retrain host test passes the new argument and checks it on every path.The second answers a sink's repeated IRQ_HPD. A Type-C sink's IRQ_HPD still gets the replay of the mode first, which is enough when the sink raised it for something other than its link (HDCP, MCCS, a test request, a dock's state). Only when the same sink raises IRQ_HPD again within 30 s of that replay does the hotplug worker turn the CRTC off and on, the path it already uses for a rebuilt T6020 tunnel, which trains the link anew. At most two power cycles per display connection, counted like the tunnel's, only once started (
dcp_power_cycle_done()); an unplug resets the count. The connector stays connected, userspace gets no hotplug event, and the link status is not set to bad, so userspace does not race the retrain.Which machines: every DCP pipe behind a Type-C port, on every firmware, with no version check. The replay comes first and the cap of two per connection keeps the power cycle to sinks the replay did not help. Where a mode set of an unchanged timing trains the link again, a sink whose link the replay fixed stops raising IRQ_HPD and no power cycle follows; a sink that keeps raising IRQ_HPD with a good link blanks at most twice per connection there too. H17P pipes and the T6030 external processors keep their own handling. The 30 s window follows from the blank sink's measured 18.9 to 19.5 s IRQ_HPD period; the cap of two bounds what a sink that raises IRQ_HPD with a good link can cost (two blanks per connection).
Testing
On the J775D (Mac Studio, M5 Ultra), on this PR's own base: integration/aurora 00cbc67 plus #1973, which the J775D's desktop needs for its GPU node, and nothing else. Kit
pr2604-4is that base with this PR at 24c9b1a; kitpr2604-4bis the same base without it. One read-only one-shot boot of each through the 27.0 firmware stub with Aura main dff1235d8bac, default command line, a dead-man armed at each boot and the temperature guard running. Both booted to the desktop on HDMI with no DCP crash or recovery and the same failed units (iwd.service and systemd-networkd-persistent-storage.service, as on every read-only test boot). ALARM has no SELinux, so there is no AVC count. The kernel error lines of this PR's boot are a subset of the base's: the base boot also loggedusb 3-1: device not accepting address 2, error -108, a Type-C USB start-up error outside anything this PR touches (it changes only drivers/gpu/drm/apple and its host test). The IRQ_HPD and power-cycle paths did not run: the DisplayPort monitor was on a USB-C port that this tree routes to no display coprocessor, so no DisplayPort sink came up. That row is listed under Still to run. Upstream host tests: 461 of 461 on the base and with #1973 and this PR, no result differs, the updated dcpext26 retrain test included. checkpatch--strict: clean on both commits.Extra evidence, not this PR's own row: the previous head, 4f921ee (one commit, counting a power cycle before the retrain), on integration/aurora b21dcc6 with #1973 (kit
pr2604-1): the same results in one boot, IRQ_HPD again not reached. An earlier form of these two commits, the same code with older comments, gave the same results on integration/aurora bb9f8ec with #1973.Extra evidence, not this PR's own row: on our integration test kit (integration/aurora e0ee46a plus #1650, an earlier #1973 and two local commits) with the previous head's change (the same power cycle, counted before the retrain rather than after it), through the 27.2 stub, a DisplayPort monitor on the routed USB-C port and HDMI on the other DCP, three boots; the first two ran with a firmware 27 check in place, which takes the same path on this firmware. In two, link training at boot reported errors; the sink's first IRQ_HPD (10.7 and 10.4 s) got the replay and the link stayed as it was; its second, 19.1 and 19.0 s later, power cycled the CRTC, the link trained and came up at 32.2 and 31.9 s, and no further IRQ_HPD came up to 72 and 123 s. In the other boot the link recovered through the existing relink, and a cable replug trained cleanly, the desktop back a few seconds after the plug. HDMI kept its desktop throughout, and neither DCP crashed or recovered. Kernel error lines not in a control boot without a DisplayPort monitor: the link-training faults this change answers, and in one boot one display-coprocessor log line during the relink.
Still to run
pr2604-4andpr2604-4bwith the DisplayPort monitor on the routed USB-C port and someone watching it, a boot each (replay, then a power cycle on a repeat) and a replug.Full description
IRQ_HPD does not always mean a lost link: HDCP, MCCS, test requests and dock or adapter state changes raise it too, and for those applying the mode again is enough. So a Type-C sink's IRQ_HPD still gets that replay first. Only when the sink raises IRQ_HPD again within 30 s of a replay does the hotplug worker turn the CRTC off and on, as it already does for a rebuilt T6020 tunnel (
dcp_retrain_active_crtc()withpower_cycle). That releases the DPTX link and connects it again before the mode is set, so the link is trained anew. The connector stays connected and userspace gets no hotplug event. The link status is not set to bad for a power cycle, so that userspace does not race it with a mode set of its own.Each power cycle needs a replay that did not help before it, and a display connection gets at most two (
DCP_SINK_IRQ_POWER_CYCLES); an unplug starts the count again. A sink that keeps raising IRQ_HPD while its link is good therefore blanks at most twice per connection, and is then only answered with the replay. The window is 30 s because the blank sink above repeats IRQ_HPD every 18.9 to 19.5 s: a window of a few seconds would never see its second request.The request reaches the worker as a hotplug reason of the connector,
DCP_HOTPLUG_SINK_IRQ, as Ryan Murray suggested in review: it is queued with READY in oneatomic_or(), after the mode was invalidated, and the worker takes it with the other reasons in its oneatomic_xchg(). A flag read apart from the reasons could be taken by a run already under way, and the run queued for that IRQ_HPD would then go without it. The apple-dcp selftests, which builddcp_typec_route_apply()on the host, get a stub for the newdcp_retrain_sink_irq()beside the one fordcp_retrain_oob().Unchanged:
dcp_dptx_recover_irq()(e19eb21);dcp_typec_sink_relink(), 5afc29b and a907f77);Full test results (extra evidence: our integration test kit on integration/aurora e0ee46a, not this PR's own row)
--strict: clean. The appledrm build has no new warning. Upstream host tests: 451 of 451, the apple-dcp suite included.Thanks to Ryan Murray for the hotplug-reason design in review.
Assisted-by: LLM (Claude:Opus 5.5)