Repository navigation
drm/apple: hold the HDMI unplug after the converter's power-up HPD blink - #3667
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 |
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 |
dcp_typec_route_activate(), which the fixture builds from dcp-fabric.c, now drops a held HDMI unplug first. Give the fixture an empty dcp_hdmi_drop_hold(), so that it builds again: a route it activates never has a hold to drop. Signed-off-by: DjDeveloperr <hey@djdev.me>
DjDeveloperr
left a comment
There was a problem hiding this comment.
Verdict: FINISH, then merge at b9adc53d3b82. The code is fine; the real cable pull on the J473 is what is left, plus an approver other than this account.
Blockers: one, found and fixed on the branch. tools/asahi/dcp-tunnel-prepare-tests.py builds dcp_typec_route_activate() from the source and had no stub for the new dcp_hdmi_drop_hold() call, so 18 of its cases did not compile. That is the whole hosted host-tests failure at 218e24f0 (980 of 998). b9adc53d adds the one-line stub. No kernel file changes, so the J473 row at 218e24f0 still counts.
Checked: this head on main 00c7aaf971fd, since #3952 and #3911 changed the same paths after the last review. It merges clean. dcpep_cb_hotplug() on main is unchanged, so dcp_hdmi_report_unplug() still matches it. A held unplug leaves mode_state.valid false, which is what #3952 looks at to send the SDR step before PQ, so a replug that ends a hold takes that path too.
Still owed: J473, a kernel with this head, HDMI cable pulled 3 to 8 s after a DPMS on. Pass: the disconnect reaches userspace within about 0.5 s of the firmware's unplug, and the replug brings the picture back. If the monitor does not make the converter blink (it did not in the row at 218e24f0), a pull without a hold still shows that nothing is lost, and the dsc8-a row covers the holds.
Evidence
- Host tests in the pinned image, on the merged tree:
dcp-tunnel-prepare18/18 with the stub, 0/18 without;--only dcpbefore the stub 84/103, the 19 failures being those 18 and one case that reads an old commit (no history in this checkout);--only backlight4/4;--only hdmi13/13. - arm64 LLVM
W=1ofdrivers/gpu/drm/apple/on the merged tree (DRM_APPLE=m, all but the T8132 backend): no compiler warnings. - My earlier non-blocking notes (refuse a hold once
hdmi->enabledis false, re-read the EDID on the replug that ends a hold, name the firmware lines in Risk) are unchanged.
satchlj
left a comment
There was a problem hiding this comment.
Reviewed b9adc53d3b82:
dcp-hdmi.hstate machine (dcp_hdmi_blink+dcp_hdmi_attachment) is wraparound-safe (time_before, non-zero stamp) and properly scopes held unplugs to(sink, generation)so yield/Type-C handover cannot leak a held unplug or replug across attachments.- Locking order in
dcp-hdmi.c(unplug_lock->modes_lock/hdmi->lock) is consistent across work, hotplug callbacks, anddcp_hdmi_drop_hold(), withunplug_workcleanly gated viadisable_delayed_work/enable_delayed_work/disable_delayed_work_sync. - Top commit
b9adc53d3b82adds the matching no-opdcp_hdmi_drop_hold()stub totools/asahi/dcp-tunnel-prepare-tests.py.
|
J473 (Mac mini M2, T8112, 27.2) genuine HDMI unplug/replug at
Unplug (monotonic seconds):
Replug:
Kernel err lines in the boot: only the two Afterwards the Mac went back to its production default (fleet94, Enforcing, 0 failed units, test kernel removed). Full log: our own capture, available on request. |
|
Merge check: Hardware.
The DPMS rows from 12-02 also hold: 6/6 and 68/68 with no false disconnect, 0 WARN/Oops. So this is better than Local checks on the merge with
Merging. |
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