Repository navigation
drm/apple: hold the HDMI unplug after the converter's power-up HPD blink - #3667
RyanTheTide wants to merge 5 commits into
Conversation
When dcp_poweron() lights the HDMI display of a built-in HDMI port, the DP-to-HDMI converter powers up and drops HPD for one to two seconds. The HPD handler only logs the low edge and debounces the rising one, so the kernel reports nothing. The DCP firmware, however, loses its link to the converter: about ten seconds after HPD fell it reports the display unplugged, and half a second later plugged again. On a J473 (Mac mini M2) with macOS 27.2 firmware that happens on every DPMS on, with HDMI on either DCP. The pair reaches the compositor as a disconnect and a reconnect; Mutter sometimes answers with a configuration that has every CRTC off, and the displays stay dark until the next DPMS cycle. Track the blink per HDMI port: a HPD fall within DCP_HDMI_HOLD_MS of dcp_poweron() starts it, the rise that holds for the debounce interval ends it and opens a window of DCP_HDMI_HOLD_MS. An unplug the firmware reports in that window is held: the display's mode is invalidated, as for a Type-C relink, but the connector stays connected. The firmware's replug ends the hold and retrains the active mode through the hotplug worker, as any replug with no valid mode does. The unplug is still reported when HPD is low (or cannot be read) one debounce interval later, checked again every interval, or when the firmware has not plugged the display again within DCP_HDMI_HOLD_MS. Unplugs outside the window are reported at once, as before. The state is part of the HDMI port object, which exists only for a DCP with a fixed HDMI-A connector and an HDMI HPD GPIO in its device tree. The 500 ms HPD debounce gets a name, DCP_HDMI_HPD_DEBOUNCE_MS, next to the HDMI executor that applies it; DCP_HDMI_HOLD_MS moves to dcp-hdmi.h. The apple-dcp host harness that builds dcpep_cb_hotplug() gets stubs for the two new calls. Link: #3658 Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
There was a problem hiding this comment.
The HPD hold is admitted on the fixed HDMI connector, but the deferred report resolves the mutable DCP connector again. If HDMI yields and Type-C binds that DCP during the hold, the worker can report the unplug against the new sink, or a firmware replug can retire the old hold. Bind the deferred action to the held attachment and invalidate it on yield or rebind. Please cover the route handover in a regression. The J473 relight run is useful evidence for the blink case. Genuine unplug and peer-family regressions remain.
|
Code-owner ping (6-point merge rule, point 6): @aurora-silicon/core @aurora-silicon/omarchy-mac @aurora-silicon/aurora-maintainers, this touches |
A held HDMI unplug was admitted on the fixed HDMI connector, but its deferred report and the replug that ends it looked up dcp->connector again. The hybrid DCP can change hands during the hold: the HDMI display yields, and a Type-C display takes the pipeline. The deferred check could then report the unplug against the Type-C sink, and that sink's own plug could retire the HDMI hold. Record what the hold was taken on: the fixed HDMI connector and the DCP's attachment generation (modes_generation, which every route activation and attachment change already advances). The deferred check, the replug and a repeated unplug act only while the DCP still drives that same attachment; otherwise the hold and its window are dropped without a report. A DCP that yields its HDMI display or drives a Type-C route has no HDMI attachment at all. The yield and the Type-C route activation also drop the hold explicitly, before the connector changes. The yield already reports the HDMI display gone, so dropping the hold there matches it. Cover the route handover in KUnit: a hold across a yield and a Type-C bind, a replug after the handover, the HDMI display back on a new attachment, and the explicit drop. Link: #3658 Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
|
Thanks, addressed in 7ad8a08 (a new commit on top of 106a783). Held attachment: when the hold starts it now records what it was taken on: the fixed HDMI connector and the DCP's attachment generation ( Deferred report and replug: the delayed check, the firmware replug that ends a hold, and a repeated unplug all compare the DCP's current attachment with the recorded one, under the hold's lock. If they differ, the hold and its window are dropped without a report. The deferred report then reports against the recorded HDMI connector, not Yield and rebind: Regression: the new KUnit case |
There was a problem hiding this comment.
The generation and sink checks plus the handover regression address the stale held event after a completed rebind. Please confirm serialization for a concurrent handover: route activation drops unplug_lock before publishing the new generation and connector, while the worker holds unplug_lock while sampling and reporting. The test covers a completed route change, so it does not establish that an event cannot be admitted or reported during publication. Keep on hold for that check and current-head J473, genuine unplug, HDMI peer and hosted evidence.
There was a problem hiding this comment.
The fabric lock prevents a fresh hold window from opening across Type-C publication. The drop clears the existing hold under the same mutex as the worker before the generation and connector change. This addresses my route-publication concern. Keep current-head J473, genuine unplug, HDMI peer and hosted validation before landing.
The cold-boot backlight harness builds the production dcp_poweron(), which now notes the HDMI converter's power-up for the unplug hold. Give the harness a no-op stub for it, like its other power helpers. Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
|
Pushed b7f8c7b (test-only, no force push): |
There was a problem hiding this comment.
Verdict: MERGE at b7f8c7b7 after the remaining hosted and hardware gates.
Checked: The sole delta from the reviewed and J473-tested head is the no-op callback stub in the extracted host fixture. It does not replace a backlight assertion. Both independent host invocations passed and all five negative controls still rejected the injected errors. Retain the J473 receipt at its tested Image and the outstanding physical disconnect and HDMI peer checks.
|
Merge readiness at
Areas: Updated by pr-readiness on pushes, edits, reviews and comments, and on a schedule. Rules: merge policy · labels. |
|
Re-ran the full Linux host suite locally from a detached checkout of this exact head, The GitHub-hosted rerun is still queued. The hardware evidence remains tied to the previously tested |
|
The hosted run tested merge An isolated merge preview of the same PR head on main |
|
CI note: |
|
Pushed 6eec2b7 (merge of main 42169a0, no rebase/force). The host-tests failure at b7f8c7b was not from this PR: CI tested it merged onto main 94104a6, where #3587 had broken the apple-dcp |
DjDeveloperr
left a comment
There was a problem hiding this comment.
No blocking findings. I checked lock order (iomfb.lock, then the hold lock, then modes_lock, with only short steps under the hold lock), the delayed check against the firmware unplug and replug, drop and yield, teardown (every unbind path goes through dcp_hdmi_disable), and the real-unplug paths: HPD low after the debounce, a failed HPD read, and the 10 s cap. Macs without a fixed HDMI port have dcp->hdmi == NULL, so nothing changes for them.
Non-blocking, take what's useful:
dcp_hdmi_disable()(dcp-hdmi.c ~505). It stops the check, then clears the hold without the hold lock. An unplug that lands in between is held and then wiped without a report. Suspend's HPD-low check covers a real unplug there. A one-line guard closes it: havedcp_hdmi_hold_unplug()refuse a hold whenhdmi->enabledis false.- The replug that ends a hold (iomfb_template.c ~3316) keeps the cached EDID. A monitor swapped inside the window keeps the old EDID.
apple_connector_invalidate_edid()there covers it. - The Risk line overstates scope. Desktop 26.x firmware (
dcp_desktop_dp2hdmi_hpd), T6030 (dcp_v14_external_hotplug) and the M4 mini's iomfb_m4.c path never take a hold. Saying which firmware lines are covered helps the next reader.
Left before merge: a merge-up (it conflicts with main again), green CI at the merged head (the KUnit failures shown are other drivers' cancelled jobs), and the row still owed: a real cable pull 3-8 s after a DPMS on, with the disconnect reaching userspace within about half a second (J473), at the merged head or with the PR's files unchanged.
Signed-off-by: DjDeveloperr <hey@djdev.me>
|
Merged main into the branch as
The merge's diff against main matches this PR's own diff in all 9 files. Local checks in the CI-pinned host-test container ( |
DjDeveloperr
left a comment
There was a problem hiding this comment.
Approve at 218e24f0800b.
The main merge differs from a clean git merge-tree of its parents only in the three conflicted files, and each is resolved right:
iomfb_template.c: the HDMI hold returns before main'sdcp_typec_fw_hotplug(), like the relink, powered-off Type-C and T6040 holds above it. That record is only read by Type-C paths and byiomfb_watch_unplugged_present_h17p(), which checksdcp_is_typec_output(), so skipping it for the fixed HDMI port changes nothing. A replug still reaches it.backlight-coldboot-tests.pyandapple-dcp/rate.py: both sides' stubs are kept.
Checked on pc at this head:
make W=1 drivers/gpu/drm/apple/plusdcp-fabric-test.oanddcp-fabric-core.o(with the fabric KUnit test enabled): 0 warnings.- KUnit
dcp-fabricon UML (no QEMU): 121/121, including the fourhdmi_blink_*cases. run-host-tests.py --only apple-dcpand--only backlight-coldboot(2/2 with the negative controls) in the pinned host-test container: pass.- Merges cleanly with current main.
My non-blocking notes from 12-02 still apply: refuse a hold once hdmi->enabled is false, re-read the EDID on the replug that ends a hold, and narrow the Risk line to the firmware lines that take a hold.
Before merge: hosted CI, and the J473 row: a real HDMI cable pull 3 to 8 s after a DPMS on, with the disconnect reaching userspace within about 0.5 s. The merge was pushed from this account, so it needs another approver or an admin merge.
|
J473 row at exact head Mac mini M2 (J473), Acer 1920x1080 on the built-in HDMI port (
So no false disconnect was introduced and nothing regressed. A software-only real unplug isn't possible on this J473: the Acer is on the built-in HDMI port, and the only Type-C partner is a USB hub. I armed the Mac on B for 45 minutes with a logger and a 10-second hands step for Ryan (pull the HDMI cable 3-5 s after a relight); it wasn't used, so "a genuine unplug 3-8 s after DPMS on is still reported" remains untested. The kit and logger are ready to re-arm. Restored afterwards: saved fleet94, test kernel removed, SELinux Enforcing, HDMI connected. (The only failed unit on B was |
What
When
dcp_poweron()lights a display on a built-in HDMI port, the DP-to-HDMI converter powers up and drops HPD for 1-2 s. About 10 s after HPD fell, the DCP firmware reports the display unplugged and, half a second later, plugged again. The compositor sees a real disconnect/reconnect; Mutter 51.1 sometimes answers with every CRTC off, and the monitors stay dark until the next DPMS cycle (#3658).This holds a firmware unplug that arrives in a window after that power-up blink: the mode is invalidated (as for a Type-C relink) but the connector stays connected, and the firmware's replug retrains the mode. A real unplug is still reported: if HPD is low (or unreadable) one debounce interval later, or if the firmware hasn't replugged within the window. Outside the window nothing changes. Scope: only DCPs with a fixed HDMI-A connector and
hdmi-hpd-gpiosin the device tree. The 500 ms debounce gets a name (DCP_HDMI_HPD_DEBOUNCE_MS); the window reusesDCP_HDMI_HOLD_MS.Tested
hdmi_blink_handover_test; display 180/181, topology 210/211 (1 skip each). Host--only dcp69/69,--only apple-dcp1/1. checkpatch --strict clean.--only dcp69/69,--only apple-dcp1/1. checkpatch --strict clean.Risk
Risk: two-way · every Mac with a built-in HDMI port (fixed HDMI-A + hdmi-hpd-gpios: M1/M2/M3/M4 Pro/Max laptops, Mac mini M2/M2 Pro/M4, Studio): a real HDMI unplug within ~10 s of a DPMS on is reported up to one debounce interval later.
Not yet