Skip to content

drm/apple: hold the HDMI unplug of a powered-off display in standby - #4495

Merged
RyanTheTide merged 5 commits into
aurora-silicon:mainfrom
rolotrealanis98:pr/apple-dcp-hdmi-standby-hold-v2
Dec 5, 2026
Merged

RyanTheTide merged 5 commits into
aurora-silicon:mainfrom
rolotrealanis98:pr/apple-dcp-hdmi-standby-hold-v2

Conversation

@rolotrealanis98

@rolotrealanis98 rolotrealanis98 commented Dec 5, 2026 •

Copy link
Copy Markdown
Contributor

What: keep a powered-off fixed-HDMI display connected while it drops HPD going into standby, and report the unplug only if HPD is still low 3 s later. The hold ends on DPMS wake, on a new attachment, and at unbind.
Tested: host replay of the hold at e5d091e (7 cases, gcc and clang, each fix caught by a mutation), W=1 for drivers/gpu/drm/apple. The J716s HDMI standby row was taken at #4317's fdbba2c; a row at this head follows.
Risk: two-way door · every Mac with a fixed HDMI port (a DCP with an HDMI HPD line: MacBook Pro 14/16-inch M1 Pro and later, Mac mini, Mac Studio), and only while that output's CRTC is DPMS off; Type-C outputs and internal panels are unchanged.
Not yet: a J716s HDMI standby row at this head.

This replaces #4317 with the same change on a fresh branch (that branch's history isn't rewritten), plus the two fixes the review asked for, in the last commit:

  • A repeated disconnected callback no longer moves the 3 s deadline: the check is queued with queue_delayed_work(), which leaves a pending check alone, and a connected callback while held cancels it, so the next unplug gets its own deadline.
  • A failed HPD read in dcp_hdmi_off_unplug_work() is no longer taken as HPD high: the worker looks again after 500 ms (DCP_HDMI_OFF_RETRY_MS).

tools/asahi/dcp-hdmi-standby-hold-tests.py (registered in run-host-tests.py) compiles the hotplug branch and the worker unchanged and replays: one unplug, the unplug repeated every 2 s (reported at 3 s), a standby pulse (nothing), unplug-replug-unplug (reported 3 s after the second), a failed read then low (reported at the retry), a failed read then high (nothing), and DPMS wake before the deadline (nothing, no check left pending). Mutations mod-delayed-work, no-replug-cancel and error-is-high each fail a case.

@jcrowthe confirmed the same wake loop on a Mac Studio M2 Ultra (J475d) HDMI port on #4317; thanks.

A display on the fixed HDMI port that goes to standby after DPMS off can drop HPD for about a second. The firmware reports that as an unplug (unplug_gated), dcpep_cb_hotplug() disconnects the connector, and the replug a moment later makes the compositor re-add the output and light it. The lock screen turns it off again, and the cycle repeats about every 14 s, so an idle desktop never stays dark.

The Type-C path already ignores this while typec_crtc_off is set. This does the same for the fixed HDMI output:

  • dcp_poweroff() marks hdmi_crtc_off when the HDMI output has HPD and no Type-C route.
  • While it's set, an unplug in dcpep_cb_hotplug() keeps the connector connected and schedules a 3 s check. dcp_poweron() clears the flag and reconnects the link as it already does.
  • If HPD is still low after 3 s, the check reports the unplug (disconnected_hpd_event()), so a real removal while the display is off still disconnects.

satchlj's #2503 (closed) also suppressed this unplug; this is a narrower take on the same problem.

Testing

J716s (M5 Pro 16"), dcpext1 HDMI, firmware 27.3, 2560x1600@165 monitor, Omarchy 4.6:

Case Before After
DPMS off, monitor enters standby (HPD low ~0.8 s) hotplug connected:0 → re-add → display back on, every ~14 s only hotplug connected:1, no dcp_poweron; display stays off
Idle cycle: screensaver 150 s → lock 300 s → lock-screen DPMS off wakes repeatedly stays off until unlock
Unlock after ~30 min off — 2560x1600@165 restored, no kernel warnings
  • KUnit (drivers/gpu/drm/apple/display.kunitconfig): 344 tests, 343 passed, 1 skipped
  • W=1 for dcp.o, iomfb_v27.o and iomfb_v14_7.o: 0 warnings
  • checkpatch: clean

A display whose HDMI CRTC is off goes to standby, and some drop HPD for
about a second as they do. The firmware reports that as an unplug, and
the replug after it makes the desktop light the returning display; the
lock screen turns it off again and the cycle repeats every ~14 s.

As for a powered-off Type-C output, keep the connector connected and let
dcp_poweron() connect the link again. HPD still low 3 s later is reported
as the unplug.

Signed-off-by: Rolando Trevino <122947376+rolotrealanis98@users.noreply.github.com>
…und DCP

The held unplug of a powered-off HDMI output could outlive its reason:

- Unbind and remove only cancelled the timeout before firmware callbacks
  stopped, so a late cb_hotplug(0) could queue it again and run it after
  the DCP was released. Disable it first thing in dcp_comp_unbind() and
  in remove; dcp_comp_bind_pipe() enables it again.
- DPMS wake cleared the flag and cancelled without waiting, so a worker
  already past its check could report the unplug after the link came
  back. hdmi_off_lock now covers the worker's check and report, and the
  wake ends the hold under it.
- A Type-C display taking the pipeline (dcp_hdmi_drop_hold()) left the
  hold armed, and the worker reported against dcp->connector, by then the
  Type-C one. The hold now ends with the attachment, the worker gives up
  on an active Type-C route, and it reports the HDMI connector.

The apple-dcp and backlight host fixtures learn the new fields and helper.

Signed-off-by: Rolando Trevino <122947376+rolotrealanis98@users.noreply.github.com>
system_wq is deprecated; the J716s run warned on the first hold
("work func dcp_hdmi_off_unplug_work enqueued on deprecated workqueue").
The check reads a GPIO and reports a hotplug: any CPU will do.

Signed-off-by: Rolando Trevino <122947376+rolotrealanis98@users.noreply.github.com>
… a failed HPD read

Two ways the held unplug of a powered-off HDMI display could be lost:

- Every disconnected callback requeued the check with mod_delayed_work(),
  so a display that repeated the unplug every two seconds moved the 3 s
  deadline each time and was never reported. Queue it with
  queue_delayed_work(), which leaves a pending check's deadline alone, and
  cancel the check when HPD comes back (a connected callback while held),
  so the next unplug starts a deadline of its own.

- dcp_hdmi_off_unplug_work() took a negative gpiod_get_value_cansleep()
  result as HPD high and returned with nothing pending. An unknown level
  is not a display: look again after DCP_HDMI_OFF_RETRY_MS (500 ms).

tools/asahi/dcp-hdmi-standby-hold-tests.py compiles the hotplug branch and
the worker unchanged against a millisecond model of delayed work and a
scripted HPD line, and replays one unplug, a repeated unplug, a standby
pulse, unplug-replug-unplug, a failed read followed by low and by high,
and a hold ended by DPMS wake. Each fix has a mutation it catches.

Signed-off-by: Rolando Trevino <122947376+rolotrealanis98@users.noreply.github.com>

@aurora-silicon-review aurora-silicon-review Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Verdict: MERGE at e5d091e

Checked: Replayed all seven HDMI standby cases on this replacement using GCC and Clang ASan/UBSan. Duplicate unplug callbacks leave the original deadline in place, a replug cancels it, and a failed HPD read queues a retry. The three mutations reproduced their respective failures with both compilers. Traced the fixed connector, DPMS wake and unbind cleanup, and checked the four replacement commits’ sign-off trailers. The J716s receipt describes the earlier #4317 build.

@github-actions github-actions Bot added area:display Area from CODEOWNERS (bot) area:gpu Area from CODEOWNERS (bot) blast:all 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 5, 2026
@github-actions

github-actions Bot commented Dec 5, 2026 •

Copy link
Copy Markdown

Merge readiness at 24c71cb0: ready to merge

Check Detail
CI at head ok 9 checks passed
Review ok approved by RyanTheTide, aurora-silicon-review
Requested changes ok none
Hardware row at head ok comment at 24c71cb0
Conflicts ok none
PR text ok Risk: two-way · every Mac with a fixed HDMI port (a DCP with an HDMI HPD line: MacBook Pro 14/16-inch M1 Pro and later, Mac mini, Mac Studio), and only while that output's CRTC is DPMS off; Type-C outputs and internal panels are unchanged.

Areas: area:display, area:gpu
Merge: gh pr merge 4495 --merge (Owners and Core through the bypass: add --admin).

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

satchlj
satchlj previously approved these changes Dec 5, 2026

@satchlj satchlj left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Reviewed at e5d091ebc881 (code review only; J716s hardware re-row at this head pending as noted in Not yet).

  • Scoping hdmi_crtc_off in dcp_poweroff() strictly to fixed HDMI outputs (hdmi_off_ready && !dcp_is_typec_output && hdmi_hpd && !active_typec_route) keeps Type-C and internal panels untouched.
  • Using queue_delayed_work() on held unplugs in dcpep_cb_hotplug() prevents repeated firmware disconnect callbacks from postponing the 3 s deadline, while cancelling hdmi_off_unplug_wq on a connected callback cleanly absorbs transient standby HPD pulses and resets the deadline for any later unplug.
  • Retrying after DCP_HDMI_OFF_RETRY_MS when gpiod_get_value_cansleep() fails avoids mistaking an I/O error for HPD high, and hdmi_off_lock + disable_delayed_work_sync()/enable_delayed_work() across unbind/bind/remove keep the worker lifecycle race-free.
  • Replay host test (dcp-hdmi-standby-hold-tests.py) and its three mutations cover all timing and error branches cleanly.

Verdict: APPROVE.

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

Copy link
Copy Markdown
Contributor

Hardware row at exact head e5d091ebc881 — PASS (2-SoC-family DCP/HDMI/DP regression: K114s M5 Pro T6050 + J713 M4 T8132, Aura 1.0.0b19, sysfw 27.2).

  • K114s (T6050, F44) — guarded one-shot 7.3.0-trb-b7 (boot_id=051e072d, SELinux=Enforcing, failed=0, 0 oops/DCP faults): dcp_fixed_hdmi_reconnect probed cleanly, all 4 displays (eDP-1 3024x1986, DP-2 1920x1080, DP-6 2560x1440, HDMI-A-2 1920x1080) active, gpubench-vk compute.edge CRC 27c79e6d valid; restored (boot_id=eee3aac5).
  • J713 (T8132, F45) — guarded one-shot 7.3.0-trb-b7 (boot_id=19b043bb, SELinux=Enforcing, failed=0, 0 faults): eDP-1 2560x1664 survived 2/2 rtc1 s2idle cycles (POST-WAKE card1-eDP-1: status=connected enabled=enabled) + post-wake GPU 9,455 submits; restored (boot_id=cdbc67e8).
  • Trace: /Volumes/AuroraS500/traces/kernel/20261205-test-rows-b-batch7/{k114s,j713}-targeted.log (tainted: no).

@github-actions github-actions Bot added ci-failing A check failed at the PR head (bot) and removed needs-hw-row No hardware row at the PR head (bot) labels Dec 5, 2026
The publication HPD fixture exercises Type-C only. Make it fail if the HDMI standby callback queues or cancels work, matching the helpers used by the callback.

Signed-off-by: DjDeveloperr <hey@djdev.me>
@DjDeveloperr

DjDeveloperr commented Dec 5, 2026 •

Copy link
Copy Markdown
Contributor

Pushed 24c71cb082c7 as a fast-forward fixture fix. The production files are unchanged. The Type-C publication/HPD fixture still stubbed mod_delayed_work() after the HDMI callback switched to queue_delayed_work() and cancel_delayed_work(). The fixture now fails if either HDMI helper runs in its Type-C scenarios.

On e5d091ebc881 merged onto 94a92ce8b446 (tree eeccbb5c894e), the full local Host Tests replay passed 1291/1292. The only failure was the same publication-hpd compile error as the hosted run. At 24c71cb082c7, the Apple DCP rate group passed 5/5, including publication-hpd, and the HDMI standby replay passed 4/4, including all three negative controls. The updated head merges cleanly onto that main tip (tree 724f9a188ca2).

Rolot's J716s receipt verifies that the display stays dark in standby and wakes at its original mode on the production code at this head. The remaining case is a physical removal while the fixed HDMI output is off. On the same build, leave the HDMI cable out for more than three seconds, check that HDMI-A-1 reports disconnected, then reattach and verify the original mode returns.

Refreshed the integration onto main 8f4ed47 (tree cda38e9300ed). Its only difference from integrating e5d091e onto the same base is the rate fixture. The five DCP rate cases passed, including publication-hpd. The HDMI standby replay passed all seven cases under GCC and Clang, and all three negative controls failed as intended under both compilers. The subsequent #4512 merge on main only changes G17 files and its test.

@github-actions github-actions Bot added needs-hw-row No hardware row at the PR head (bot) needs-review No approving review from Core or Omarchy Mac yet (bot) and removed ci-failing A check failed at the PR head (bot) labels Dec 5, 2026

@aurora-silicon-review aurora-silicon-review Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Verdict: MERGE at 24c71cb082c7e313ba3d382d9defb4362d95b920

Checked: The fast-forward changes only the publication-HPD host fixture. I re-ran the fixture with the exact updated source and Clang ASan/UBSan. It now compiles and passes. The new queue and cancellation stubs still assert if Type-C enters the fixed-HDMI standby path. The production HDMI and DCP sources match the previously reviewed commit.

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

Verdict: APPROVE at 24c71cb082c7e313ba3d382d9defb4362d95b920

Blockers: none on code (CI runs queued on 24c71cb082c7).

Checked:

  • Verified e5d091ebc881..24c71cb082c7 touches only tools/testing/selftests/drivers/gpu/apple-dcp/rate.py (+2/-1 lines replacing the mod_delayed_work stub with queue_delayed_work and cancel_delayed_work guards); all production drivers/gpu/drm/apple/ files are byte-identical to e5d091ebc881, which already passed 2-family K114s (T6050) + J713 (T8132) bare-metal verification.
  • Audited dcp-hdmi.c, dcp-hdmi.h, dcp-internal.h, and dcp.c: hdmi_crtc_off hold is gated strictly on hardware/route properties (hdmi_off_ready && !dcp_is_typec_output && hdmi_hpd && !active_typec_route), serialized under hdmi_off_lock, cleared on DPMS wake / hold drop, and torn down cleanly with disable_delayed_work_sync() on unbind/remove.

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

Copy link
Copy Markdown
Contributor Author

Hardware row at head 24c71cb082c7: PASS on J716s (MacBook Pro 16" M5 Pro, T6050), Aura stage 2 next10-hdmi-silent-nh, Omarchy.

  • Kernel 7.3.0-ge54644a0f6ef: aurora main 2cfb530a3050 + the J716s daily, with all drm/apple: hold the HDMI unplug of a powered-off display in standby #4495 production hunks (2cfb530a3050..e5d091ebc881 -- drivers/, 5 files, +127) applied. e5d091ebc881..24c71cb082c7 changes only tools/testing/selftests/drivers/gpu/apple-dcp/rate.py, so the driver code under test is the same as at head.
  • Boot: primary slot, up in 55 s, 0 failed units, 0 WARN/Oops/SError.
  • Fixed HDMI: dcp_fixed_hdmi_reconnect HPD connected, HDMI-A-1 2560x1600@165 (DSC=NO) with eDP-2 3456x2234.
  • Standby (owner at the machine): the HDMI display went to DPMS off and stayed dark, with no unplug, no "no signal" and no re-light. On wake the picture came back at 2560x1600.
  • No regressions seen on the same boot: USB-C display 2560x1600, Wi-Fi, speakers, Touch ID, trackpad.

@github-actions github-actions Bot added ready-to-merge Meets the merge policy: merge it (bot) and removed needs-hw-row No hardware row at the PR head (bot) labels Dec 5, 2026
@RyanTheTide

Copy link
Copy Markdown
Contributor

Hardware row at exact head 24c71cb082c7 — PASS (3 SoC families: K114s M5 Pro T6050 + J616s M4 Pro T6040 + J713 M4 T8132, Aura 1.0.0b19):

  • K114s (T6050, Fedora 44) — guarded one-shot 7.3.0-trb-b11 (baa37303aa7b, containing exact 24c71cb082c7), boot_id=1c97d31a, trial=m1n1/trbtry.bin, SELinux=Enforcing, failed_units=0:
    • card1-eDP-1 (3024x1986), card1-DP-2 (1920x1080), card1-DP-6 (2560x1440), card1-HDMI-A-1 + card2-HDMI-A-2 (1920x1080); external 302e00000.dcp dcp_poweroff() + VideoInterfaceIOAV::unplug cleanly completed with 0 Oops/BUG/WARNING/AVC; clean restore 3f7d61c3.
  • J616s (T6040, Fedora 45) — boot_id=552309a6: card2-eDP-1 (3456x2234) + card2-HDMI-A-1, 2/2 rtc1 s2idle PASS + post-wake compute.edge 13,055 Mpix/s CRC 27c79e6d valid, 0 Oops/WARN/AVC; clean restore 8bca7967.
  • J713 (T8132, Fedora 45) — boot_id=716a8b14: card1-eDP-1 (2560x1664), v27 idle cache active, 2/2 rtc1 s2idle PASS, 0 Oops/WARN/AVC; clean restore 81a94ab5.
  • Evidence: aurora-silicon/hardware-validation@ba06ee1 (evidence/{k114s,j616s,j713}/20261205-test-rows-b-batch11.log, non-tainted).

@RyanTheTide
RyanTheTide merged commit f517e92 into aurora-silicon:main Dec 5, 2026
10 checks passed
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:all Macs affected, from Merge risk (bot) door:two-way Revertible or not, from Merge risk (bot) ready-to-merge Meets the merge policy: merge it (bot)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants