Skip to content

drm/apple: let a docked M1 deep-sleep with its external display lit - #3655

Open
erikwb wants to merge 4 commits into
mainfrom
fix/dcpext-unplugged-sleep
Open

erikwb wants to merge 4 commits into
mainfrom
fix/dcpext-unplugged-sleep

Conversation

@erikwb

@erikwb erikwb commented Nov 29, 2026 •

Copy link
Copy Markdown
Contributor

What: On firmware-27 external display processors, a Type-C display unplugged under a lit CRTC is left powered off by the firmware. The power-off therefore no longer sends the clear swap and teardown, which the firmware swallows. On the M1 MacBook Air that swallowed clear swap held the IOMFB queue: every docked deep sleep with a lit external display was refused, and the dcpext was declared crashed, dark until a reboot. A second commit reports what an unsettled IOMFB queue is still waiting for.
Tested: At 5ce4ffaeb3fe (forward merge of origin/main 19ee1b5bc9d5 over be574d3b3b94, updating dcp_t6041_stop_one()'s non-v27 fallback to _dcp_poweroff(dcp, false)): make O=_build_w1 ARCH=arm64 LLVM=1 W=1 drivers/gpu/drm/apple/ (0 errors, 0 warnings), KUnit (topology.kunitconfig 231/232 with 1 skipped and apple-dcp-dropped-swap 28/28, display.kunitconfig 188/189 with 1 skipped, tests/.kunitconfig 117/117), dcpext26-queue-tests (+ --drop-v27-close negative control) 2/2, backlight-coldboot-tests (+ --negative-controls) 2/2, and apple-dcp (publication-hpd, stale-crtc-poweroff, connected-irq-hpd-to-firmware, dcp-sink-irq-fallback pass; 87/101 apple-dcp units pass on Clang 23.1.5, 14 unrelated fixtures hit Clang 23 -Wunused-but-set-global). J313 M1 Air at 4261e69d1e9a (same driver code prior to the 19ee1b5bc9d5 main merge): docked deep sleep with a lit 4K120 display 3/3, docked with the display DPMS-off, DPMS off/on, unplug while awake, undocked deep sleep, and replug while awake then a docked sleep. All pass (6/6 sleeps in one boot), with 0 failed units and no new kernel errors. The control at main d02c84abc8de refuses the docked sleep and the dcpext crashes. On each Mac's daily plus these two commits (4261e69d1e9a): J713 M4 Air (two docked 4K60 displays) passed 3 of 4 docked deep sleeps plus DPMS; one sleep reset the Mac 17 s after boot and did not reproduce at 16 s, while the daily alone passed 2/2. J716c M5 Max (two docked 4K240 paired displays) passed DPMS, docked s2idle and unplug while awake, the same as its default. Details in Evidence.
Risk: two-way door · Macs whose external DCP uses the firmware-27 / H17P IOMFB queue (M1 on firmware 27, M4 and M5 dcpexts); others unchanged
Not yet: Refreshed J313 row at 5ce4ffaeb3fe (driver logic unchanged since 4261e69d1e9a, prior to the 19ee1b5bc9d5 main merge); M4 and M5 rows on main itself (main cannot drive the M4's dock without #3273, and the M5 rows ran on its daily, which carries open DCP PRs; deep sleep on the M5 resets on every kernel, including the default).

Details

The failure. At PM_SUSPEND_PREPARE the USB4 port is torn down while userspace still runs. The firmware loses the DisplayPort sink, powers the external pipe off and reports the unplug. The Type-C mux announces the unplug too (dcp_dptx_disconnect_oob()), and the compositor turns the CRTC off with the mode still valid. The power-off sends the clear swap. The firmware accepts it but never completes it on a pipe it has powered off. The swap watchdog had been cancelled by the CRTC-off path, so the present stays in flight. abort_swaps and setPowerState(0) wait behind it in the queue, setPowerState(0) times out, the DCP suspend cannot settle the queue and refuses the sleep, and ten seconds later the queue timeout declares the coprocessor crashed.

The change.

  • The firmware's own hotplug reports are recorded in one word: the number of unplugs reported, plus whether the last report had a display. The reports that are not display changes are filtered out first, in dcpep_cb_hotplug(). The CRTC notes the count, with the mux's count, wherever it claims its display: at its power-on, and at a mode set that succeeds with the CRTC kept on (dcp_typec_claim()).
  • The display of the CRTC's session is gone, and its pipe with it, once both of these have happened since the claim: the mux announced an unplug and the firmware reported one. The order doesn't matter. On the M1 the firmware reports first, because the USB4 teardown removes the sink before the mux runs.
  • When the CRTC of a display the mux announced unplugged turns off before the firmware's report, the power-off waits for the report, bounded by DCP_TYPEC_FW_UNPLUG_MS. Without it, the power-off runs as before.
  • When the firmware has reported the unplug, iomfb_end_unplugged_session_h17p() sends nothing:
    • a reply still on its way lands first;
    • a present the firmware accepted for the display that went is retired, with the same bookkeeping as the swap watchdog: its framebuffers are kept until a later present completes. Each present notes the firmware's unplug count when it is begun, on the same receive path as the reports, so one begun for a display reported on the pipe since is left to complete;
    • its own commit's flip is finished as failed, through dcp_drm_crtc_flip_lost().
  • Queued presents are not sent, because the connector is disconnected (iomfb_atomic_start()).
  • Two cases still get the full power-off: a display the firmware reported on the pipe since, and an active pair, which stops through its own sequence.
  • A present that cannot be retired leaves the swap watchdog armed, and nothing is sent behind it.
  • The swap watchdog now also watches the clear swap on queued firmware. A clear swap the pipe swallows, for instance when the firmware's report came late, is retired instead of holding the power-off.
  • An unplug report also arms the watchdog for a present the pipe had accepted, in case the CRTC never turns off.
  • A system sleep cancels the watchdog. It ends an unplugged session the same way before settling the queue, after waiting for the firmware's report of an unplug the mux has announced.
  • The decision is passed to the power-off as an argument. Firmware without the IOMFB queue is unchanged.

Known limits.

  • An unplug report from the previous display that arrives only after the next display's claim counts for the new session, once that session's own mux unplug comes. Its display is physically gone by then, and its HPD low is sent or about to be. The pipe is sent nothing, and the framebuffers stay referenced.
  • A swap watchdog already running when the session ends could, in a very narrow window, retire the next present. It needs the watchdog to lose the queue lock across two firmware round trips.
  • A sleep after a mux unplug that the firmware never reports waits up to 500 ms for the report.

Overlap with #3273. #3273 (T8132 firmware-27 dock displays) also retires a present whose display went: it keys each present to the Type-C attachment it was begun for and lets the swap watchdog retire it. This PR retires such a present at once, from the power-off and the sleep paths, through the same retirement bookkeeping (iomfb_retire_present_locked(), shared with the watchdog). They touch the same functions. Whichever lands second folds the two into one mechanism. The M4 row below merges both and runs them together.

Diagnostic commit. When a queue settle times out, the IOMFB queue's state is reported, rate-limited: the active transaction, queued ones, the present in flight, plus channel depths, ACKs and callbacks sampled outside the lock. This names the cause of a refused sleep.

Host-test harness fix (be574d3b3b94). Updates the four host-test extractors that pull dcpep_cb_hotplug(), dcp_poweron(), dcp_poweroff(), dcp_crtc_atomic_modeset(), and iomfb_queue_atomic() out of the driver: stubs dcp_typec_fw_hotplug() in rate.py (publication-hpd), checks dcp_typec_claim() via dcp_crtc_atomic_modeset() and stubs dcp_typec_fw_unplug_wait() / _dcp_poweroff(..., pipe_unplugged) in lifecycle.py (stale-crtc-poweroff), stops the iomfb.c slice at iomfb_atomic_release() and appends iomfb_queue_atomic() in dcpext26-queue-tests.py, and stubs dcp_typec_claim() in backlight-coldboot-tests.py.

Evidence

J313 (M1 Air, T8103), DCP firmware 27.2.1, CalDigit TS5, external 3840x2160@120 on dcpext 271c00000. Kernel config: the J313 daily config. Default command line; rtcwake -d rtc1 -m mem -s 30 in a systemd unit.

Kernel Docked, external lit Docked, external DPMS-off Unplug while awake Undocked sleep
main d02c84a refused 1/1, 271c00000.dcp -16, then IOMFB transaction timed out ... present=1 accepted=1, connector broken — — —
4261e69 (built from 3dbe77d4be97, same tree) 3/3 deep, ~31 s each; DP-2 back at 3840x2160@120 every time 1/1, plus DPMS off/on new path, no errors, 0 failed units 1/1, panel back

Then a replug while awake on 4261e69d1e9a: DP-2 back at 3840x2160, followed by one more docked deep sleep on the new path, for 6/6 sleeps in that boot.

On 4261e69d1e9a, each docked sleep logs the new path, with the power-off message enabled through dynamic debug for the run:

apple-dcp 271c00000.dcp: CRTC off after its display was unplugged: leaving the current connection alone, and the pipe the unplug powered off

Kernel errors on that boot are the same Wi-Fi/Bluetooth resume lines (Unable to change power state from D3hot to D0) and PCIe of_irq_parse_pci lines that the J313 daily shows. None come from apple-dcp beyond the DCPDP2XService admission failed: -19 seen on main. No SELinux on this install.

J713 (M4 Air, T8132), at 4261e69d1e9a merged into its daily (main 219311530ef0 + #3273 and other open PRs; the conflicts were in the shared retirement helper and the older base's lack of channels_idle_wq). Two lit 3840x2160@60 displays on the TS5, with the dcpexts 286e00000 / 48ae00000 on firmware 27:

Kernel Docked deep sleep DPMS off/on After wake
J713 daily 2/2 (one at 16 s uptime) — dock displays do not return (Type-C DPTX reconnect failed after 1 retries: -116)
J713 daily + these commits 3/4, every pass on the new path; one reset during the sleep at 17 s uptime, not reproduced at 16 s pass identical to J713 daily

The trial boot has no kernel error lines that the J713 daily boot lacks. The one reset left nothing in the journal past the test marker. The displays not returning after a docked wake on the J713 daily is separate from this change.

J716c (M5 Max, T6050), at 4261e69d1e9a merged into its daily (base a812cfe477e2). That daily carries a third retirement variant, iomfb_retire_stalled_present_h17p(), which the merge keeps. Two lit 3840x2160@240 displays on the TS5, each on a paired DCP. The trial was one boot of a chained trial Stage 2 under the watchdog dead-man:

Kernel DPMS off/on Docked s2idle (woken by key) Unplug while awake Replug while awake
J716c daily (a812cfe477e2) pass pass — externals stay dark: both tunnels route and the peers are reserved, then DP tunnel clock N stopped 30 s later
J716c daily + these commits pass pass both dcpexts on the new path, no errors the same as the daily

No kernel error lines that the default boot lacks. Deep sleep can't be judged on this M5: it resets about 6 s in on every kernel, and an RTC alarm doesn't wake it from s2idle on either kernel.

KUnit at 5ce4ffaeb3fe (qemu arm64, LLVM=1, drivers/gpu/drm/apple/tests): topology.kunitconfig 231 passed / 1 skipped (apple_g17_rx_util_min_test, needs CONFIG_UCLAMP_TASK, 232 total; apple-dcp-dropped-swap 28/28 passed), display.kunitconfig 188 passed / 1 skipped (189 total), tests/.kunitconfig 117/117 passed. Prior KUnit at 4261e69d1e9a (343 run, 340 pass, 3 skipped) covered the 28 apple-dcp-dropped-swap cases:

  • the firmware-report bookkeeping in both orders, an unreported mux unplug, and a display swapped under a CRTC kept on;
  • a power-off that sends nothing, and an accepted present retired with its framebuffer kept;
  • the report arriving after the CRTC-off started, no report at all, and a late report after the clear swap was accepted;
  • the sleep path, including a report arriving while it waits;
  • a quick dock bounce: the old display's present retired and the new display's present kept;
  • a replacement display with an old present in flight, and a held present with and without a replacement;
  • firmware without the queue.

Mutations each fail at least one case: ignoring the firmware report, not retiring, not waiting for the report, not arming on the report, not watching the clear swap, and dropping the per-present display check.

Host builds & tests at 5ce4ffaeb3fe:

  • make O=_build_w1 ARCH=arm64 LLVM=1 W=1 drivers/gpu/drm/apple/ (defconfig + asahi.config, CONFIG_RUST=n, CONFIG_DRM_FBDEV_EMULATION=y): 0 errors, 0 warnings.
  • dcpext26-queue-tests and dcpext26-queue-tests --drop-v27-close (negative control killed): 2/2 pass.
  • backlight-coldboot-tests and backlight-coldboot-tests --negative-controls: 2/2 pass.
  • apple-dcp (publication-hpd, stale-crtc-poweroff, connected-irq-hpd-to-firmware, dcp-sink-irq-fallback pass; in the full apple-dcp run on Clang 23.1.5 with -Wno-unused-but-set-global host CC, 87/101 units pass; 14 unrelated fixtures hit Clang 23 -Wunused-but-set-global under -Wall -Werror).

checkpatch.pl --strict (d02c84abc8de..be574d3b3b94): 4261e69d1e9a and be574d3b3b94 clean (0 errors, 0 warnings); b934f2d087bb has 1 line-length warning (102 cols on the dev_info_ratelimited arguments). git diff --check origin/main...5ce4ffaeb3fe clean.

A DCP's system suspend settles its IOMFB queue first and refuses the sleep
when that times out ("display updates still pending, refusing sleep"). The
refusal does not say what the queue is waiting for: an active transaction,
queued ones, a present the firmware has not finished, or a call or an ACK
still outstanding on one of the channels.

Report that state, rate-limited, from the settle's last pass when it
times out. The queue state is read under the IOMFB lock. The channel
depths, ACK count and callback count change outside that lock, so the
report labels them as samples.

Signed-off-by: Erik Bourget <[email protected]>
On the J313 (M1, firmware 27.2.1 DCP), deep sleep with a lit external
display on a USB4 dock is refused every time. The display then stays dark
until a reboot:

  dcpext: setPowerState(0) timeout 1000 ms
  dcpext: display updates still pending, refusing sleep
  dcpext: PM: failed to suspend: error -16
  ...
  dcpext: IOMFB transaction timed out: ... present=1 accepted=1

The dock's port is torn down at PM_SUSPEND_PREPARE, while userspace is
still running. The firmware acts on the display's unplug by powering the
external pipe off, then reports the unplug through its hotplug callback.
The compositor then turns the CRTC off, with the mode still valid. The
power-off sends the clear swap. The firmware accepts it but never
completes it on a pipe it has powered off. The present stays in flight,
because the CRTC-off path cancelled the swap watchdog. The IOMFB queue
holds the abort_swaps and setPowerState(0) calls behind it, and they
never reach the firmware. setPowerState(0) times out, the DCP's suspend
cannot settle the queue and refuses the sleep, and ten seconds later the
queue's timeout declares the coprocessor crashed.

Record the firmware's own reports of a Type-C display, after the reports
that are not display changes have been filtered out. One word holds the
number of unplugs reported and whether the last report had a display, so
it is always read whole. The CRTC notes that number, with the mux's
count, wherever it claims its display: at its power-on, and at a mode
set that succeeds with the CRTC kept on. The display of the CRTC's
session is gone, and its pipe with it, once both of these have happened
since the claim: the Type-C mux has announced the unplug, and the
firmware has reported one. They come in either order. The USB4 port's
teardown at the sleep takes the display away, and the firmware reports
it, before the mux announces it. A display's unplug that the firmware
never reported does not stand in for the next display's.

The desktop hears of the unplug from the mux. When the CRTC of such a
display turns off before the firmware's report, the power-off waits for
the report, bounded by a named limit; firmware without the queue does
not wait. Without the report it powers the pipe off as before. On
firmware with the queue, the swap watchdog now also watches the clear
swap, so one the pipe swallows is retired a second later rather than
holding the power-off until the queue's timeout declares the coprocessor
crashed. That covers any panel-less output, such as a fixed HDMI port
whose display drops off at DPMS off, with the watchdog's usual retrain.
An unplug report also has the watchdog retire a present the pipe had
accepted, should the CRTC not turn off.

Once the firmware has reported the unplug, on firmware with the IOMFB
queue, the departing session's present ends. A reply still on its way
lands first: a reply now wakes the channel waiters once its callback has
run. A present the firmware accepted for a display that went is retired,
as the swap watchdog would retire it, with its framebuffers kept until a
later present completes, and only its own commit's flip is finished as
failed. Each present notes the firmware's unplug count when it is begun,
on the same receive path as the reports, so a present begun before the
last unplug report is the departed display's, while one begun for a
display reported on the pipe since is left to complete. Presents
still queued are not sent: the connector is disconnected. The pipe is
then sent nothing, since no scanout of ours is left to stop. Two cases
still get the full power-off, which the old present no longer holds up:
a display the firmware reported on the pipe since, and a pair, which
stops through its own sequence. A present that cannot be retired leaves
the swap watchdog armed, and nothing is sent behind it unless another
display needs its power-off.

A system sleep can come before the compositor turns the CRTC off. Its
suspend cancels the watchdog too, so it ends the unplugged session the
same way before settling the queue, waiting first for the firmware's
report of an unplug the mux has announced, as the power-off does.

The decision is passed to the power-off as an argument. Firmware without
the IOMFB queue powers the pipe off as before.

Signed-off-by: Erik Bourget <[email protected]>
@erikwb
erikwb requested review from a team as code owners November 29, 2026 20:42
@erikwb
erikwb requested review from LiamRay11 and maralcbr November 29, 2026 20:42
@github-actions github-actions Bot added area:display Area from CODEOWNERS (bot) blast:m1 Macs affected, from Merge risk (bot) blast:m4 Macs affected, from Merge risk (bot) blast:m5 Macs affected, from Merge risk (bot) door:two-way Revertible or not, from Merge risk (bot) needs-review No approving review from Core or Omarchy Mac yet (bot) labels Nov 29, 2026
@github-actions

github-actions Bot commented Nov 29, 2026 •

Copy link
Copy Markdown

Merge readiness at 5ce4ffae: not ready yet

Check Detail
CI at head no failing: host-tests
Review ok approved by DjDeveloperr
Requested changes ok none
Hardware row at head ok in the PR body at 5ce4ffae
Conflicts no merge conflicts with main: merge it in (no force push)
PR text ok Risk: two-way · Macs whose external DCP uses the firmware-27 / H17P IOMFB queue (M1 on firmware 27, M4 and M5 dcpexts); others unchanged

Areas: area:display, area:gpu

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

@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 4261e69d

Blockers: None (wait for the queued hosted CI checks at 4261e69d — apple-build, host-tests, readiness, and KUnit matrix jobs — to finish green; kunit and pr-text have already passed).

Checked:

  • Audited both commits (b934f2d0 and 4261e69d, DCO present on both) across all 5 files (dcp-internal.h, dcp.c, iomfb.c, iomfb_template.c, dcp_dropped_swap_test.c):
    • iomfb_queue_report_locked() (iomfb.c:912-924): asserts dcp->iomfb.lock, rate-limits reporting to the final expired pass of iomfb_queue_settle(), and reads lockless channel/ACK/callback counters with READ_ONCE()/atomic_read().
    • dcp_typec_fw_hotplug() / dcp_typec_claim() / dcp_typec_fw_display() (dcp.c:137-188, iomfb_template.c:3281): packs the 31-bit unplug counter and connected bit into a single u32 written only on the RTKit receive path after filtering out non-display-change hotplug callbacks (typec_crtc_off, t6040_relinking, dcp_typec_relink). Both dcp_poweron() and dcp_crtc_atomic_modeset() claim the session; either mux-first or firmware-first unplug order is handled without leaking an unreported unplug across sessions.
    • iomfb_end_unplugged_session_h17p() (iomfb.c:1092-1172): waits up to IOMFB_UNPLUG_REPLY_MS (500 ms) on channels_idle_wq (now woken after callback execution in dcpep_handle_ack()), re-verifies !iomfb_present_unanswered(dcp) under dcp->iomfb.lock, distinguishes departed vs replacement presents via present_fw_unplugs (recorded on the same RX path in dcp_present_begin()), retires accepted presents via shared iomfb_retire_present_locked() while retaining framebuffers, cancels swap_watchdog_wq without _sync under iomfb.lock before iomfb_queue_advance(), and finishes dcp_drm_crtc_flip_lost() + drm_crtc_commit_put() outside the lock (no ref leak or lock inversion). Paired DCPs (peer_frames.active) and replaced displays (DCP_TYPEC_FW_REPLACED) still perform full pipe power-off.
    • dcp_swap_cleared() (iomfb_template.c:2446-2454): else if attaches cleanly to if (status) so an accepted clear swap (status == 0) on queued H17P/V27 firmware arms dcp_swap_watchdog_arm(dcp).
    • dcp_s2r_ext_suspend() (dcp.c:10389): invokes dcp_typec_end_unplugged_for_sleep(dcp) after pausing presentation and before iomfb_queue_settle().
  • Verified hardware evidence across three generations: exact-head J313 (M1, T8103, DCP 27.2.1, TS5 dock) before/after (1/1 baseline refused -> 6/6 deep sleeps + awake unplug/replug PASS, 0 failed units), plus J713 (M4, T8132) and J716c (M5 Max, T6050 paired DCPs) regression rows; arm64 QEMU KUnit 340/340 (apple-dcp-dropped-swap 28/28, 15 new cases, 6/6 mutations killed) and checkpatch.pl --strict clean.
Evidence
  • drivers/gpu/drm/apple/dcp.c:5777-5889 (dcp_typec_fw_*, dcp_typec_end_unplugged_for_sleep), :5961-5972 (dcp_poweroff), :10389 (dcp_s2r_ext_suspend).
  • drivers/gpu/drm/apple/iomfb.c:912-949 (iomfb_queue_report_locked, iomfb_queue_settle), :2359-2363 (dcpep_handle_ack), :4506-4564 (iomfb_retire_present_locked), :4766-4917 (iomfb_end_unplugged_session_h17p, iomfb_watch_unplugged_present_h17p).
  • drivers/gpu/drm/apple/iomfb_template.c:2319-2332 (dcp_present_begin), :2434-2454 (dcp_swap_cleared), :3250-3282 (dcpep_cb_hotplug).
  • drivers/gpu/drm/apple/dcp_dropped_swap_test.c: 15 new KUnit cases covering all unplug/replace/sleep/late-report/held-present/unqueued branches.

@RyanTheTide

Copy link
Copy Markdown
Contributor

code-owner ping <@422957901716652033> / @DjDeveloperr: merge train at 4261e69d. App approved (NEON-PR-REVIEW2), J313 row matrix PASS. dcp.c/iomfb.c are shared by every DCP Mac (+333/-32), so one more family at this head is needed (J473 + external display, or J616s: Type-C display unplug while awake and while the panel is DPMS-off, one short s2idle, no flip timeouts or DART faults). Merges under the 6-point rule after that and green CI, unless you object.

@github-actions github-actions Bot added the ci-failing A check failed at the PR head (bot) label Nov 29, 2026
@erikwb

erikwb commented Nov 30, 2026 •

Copy link
Copy Markdown
Contributor Author

The two patches worked together on the J313 (T8103) daily build c78766a6b703, based on ee2c37398e47 with #3523 at a5af61d67c3e, #3655 at 4261e69d1e9a, and the IOMFB channel wait-queue prerequisite.

  • Docked deep sleep: 1/1 RTC wake with the CalDigit TS5 attached and its external display active. DP-2 returned at 3840×2160 at 120 Hz.
  • Awake reconnect: The display lit on all three observed reconnects. One restored 4K120 and two selected 1080p120. USB4, PCIe and 2.5 Gb/s Ethernet recovered. No DCP power-off or IOMFB transaction timeouts were observed.
  • Mode follow-up: A further reconnect selected 4K60 because DRM marked it preferred. An explicit 4K120 request worked on the same connection. On another reconnect DRM preferred 1080p120 and omitted 4K120 from its mode list, with the same USB4 link rate and lane count.

The combined run supports carrying both fixes in the J313 daily.

@github-actions github-actions Bot added ci-failing A check failed at the PR head (bot) and removed ci-failing A check failed at the PR head (bot) labels Nov 30, 2026
…g tracking

Tracking firmware Type-C unplug reports updated dcpep_cb_hotplug(),
dcp_poweron(), dcp_poweroff(), and dcp_crtc_atomic_modeset() to call
dcp_typec_fw_hotplug(), dcp_typec_claim(), and
dcp_typec_fw_unplug_wait(), added the pipe_unplugged argument to
_dcp_poweroff(), and placed iomfb_end_unplugged_session_h17p() ahead of
iomfb_queue_atomic().

Update the four host-test harnesses that extract those functions:
- rate.py (publication-hpd): stub dcp_typec_fw_hotplug().
- lifecycle.py (stale-crtc-poweroff): verify dcp_typec_claim() via
  dcp_crtc_atomic_modeset(), stub dcp_typec_fw_unplug_wait(), and accept
  pipe_unplugged in _dcp_poweroff().
- dcpext26-queue-tests.py: end the iomfb.c slice at
  iomfb_atomic_release() and append iomfb_queue_atomic() explicitly.
- backlight-coldboot-tests.py: stub dcp_typec_claim().

Signed-off-by: Erik Bourget <[email protected]>
@github-actions github-actions Bot added the merge-conflict Conflicts with the base branch (bot) label Dec 1, 2026
@erikwb
erikwb requested a review from DjDeveloperr as a code owner December 1, 2026 12:17
@erikwb

erikwb commented Dec 1, 2026

Copy link
Copy Markdown
Contributor Author

Fixed the host-tests CI failures in be574d3b3b94 and forward-merged origin/main (19ee1b5bc9d5) at 5ce4ffaeb3fe.

Changes (be574d3b3b94, test harnesses only): drivers/gpu/drm/apple/ is unchanged from 4261e69d1e9a; the commit updates only the four host-test scripts that extract the modified functions:

  • tools/testing/selftests/drivers/gpu/apple-dcp/rate.py (publication-hpd): stub dcp_typec_fw_hotplug().
  • tools/testing/selftests/drivers/gpu/apple-dcp/lifecycle.py (stale-crtc-poweroff): verify dcp->crtc_unplugs = dcp->typec_unplugs inside dcp_typec_claim() called from dcp_crtc_atomic_modeset(), stub dcp_typec_fw_unplug_wait(), and add pipe_unplugged to _dcp_poweroff().
  • tools/asahi/dcpext26-queue-tests.py: stop the iomfb.c extraction at iomfb_atomic_release() and append iomfb_queue_atomic() explicitly instead of slicing through to dcp_flush().
  • tools/asahi/backlight-coldboot-tests.py: stub dcp_typec_claim().

Forward merge of origin/main (5ce4ffaeb3fe, 19ee1b5bc9d5): Resolved the dcp_t6041_stop_one() conflict in drivers/gpu/drm/apple/dcp.c to keep main's firmware-27 iomfb_s2r_power_v27() path and pass false (_dcp_poweroff(dcp, false)) on the non-v27 branch.

Checks at 5ce4ffaeb3fe:

  • make O=_build_w1 ARCH=arm64 LLVM=1 W=1 drivers/gpu/drm/apple/ (defconfig + asahi.config, CONFIG_RUST=n): 0 errors, 0 warnings.
  • KUnit (ARCH=arm64, LLVM=1): topology.kunitconfig 231 passed / 1 skipped (232 total; apple-dcp-dropped-swap 28/28 passed), display.kunitconfig 188 passed / 1 skipped (189 total), tests/.kunitconfig 117/117 passed.
  • dcpext26-queue-tests and dcpext26-queue-tests --drop-v27-close (negative control killed): 2/2 pass.
  • backlight-coldboot-tests and backlight-coldboot-tests --negative-controls: 2/2 pass.
  • apple-dcp (publication-hpd, stale-crtc-poweroff, connected-irq-hpd-to-firmware, dcp-sink-irq-fallback pass; in run-host-tests.py --only apple-dcp, 87/101 units pass on Clang 23.1.5, with the remaining 14 unrelated fixtures failing locally on Clang 23's -Wunused-but-set-global under -Wall -Werror).
  • ./scripts/checkpatch.pl --strict --git d02c84abc8de..be574d3b3b94: 0 errors (b934f2d087bb has 1 line-length warning; 4261e69d1e9a and be574d3b3b94 0/0/0); git diff --check origin/main...5ce4ffaeb3fe clean.

Hardware rows / PR body: Scrubbed internal build names from the PR description and updated **Tested:** / **Not yet:** for 5ce4ffaeb3fe. #3273 is still open, and neither J473 nor J616s is available in our lab; J313, J713, and J716c rows were all run against the identical #3655 driver code at 4261e69d1e9a (before the 19ee1b5bc9d5 main merge).

@github-actions github-actions Bot added area:gpu Area from CODEOWNERS (bot) and removed merge-conflict Conflicts with the base branch (bot) labels Dec 1, 2026
@github-actions github-actions Bot removed the ci-failing A check failed at the PR head (bot) label Dec 1, 2026

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

Reviewed both unplug notification orders, replacement-display handling, and retiring a stale present while retaining its framebuffers. The refreshed docked J313 sleep/reconnect row and hosted Apple build and DCP KUnit are still needed.

@DjDeveloperr

Copy link
Copy Markdown
Contributor

The merge with main at 3330657b1deb conflicts in dcp-internal.h and iomfb.c. The conflict in iomfb.c overlaps #3305’s shared present-retirement helper. Please fold the unplug retirement into that helper while preserving the paired-stop admission checks, framebuffer lifetime, and watchdog ordering. The refreshed docked J313 sleep and reconnect row should cover the combined code.

@github-actions github-actions Bot added ci-failing A check failed at the PR head (bot) merge-conflict Conflicts with the base branch (bot) and removed needs-review No approving review from Core or Omarchy Mac yet (bot) labels Dec 1, 2026
@RyanTheTide

Copy link
Copy Markdown
Contributor

This needs a merge of main before it can go in a merge train. Since #3305 landed (3330657), main reworks the h17p present-retire path (iomfb_retire_stalled_present_h17p(), peer_paused, the deadline/channels-idle retire in iomfb.c). This branch changes the same lines for the queue and unplugged-session handling (iomfb_uses_queue(), iomfb_end_unplugged_session_h17p(), iomfb_queue_report_locked()). The conflicts are in dcp-internal.h and 2 hunks of iomfb.c. The two designs need combining by hand, not a mechanical resolution. Your approval and row at 5ce4ffa were in. After the merge-up it needs one re-approval at the new head, then it goes in the next train.

This branch has not been deployed

No deployments
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:m1 Macs affected, from Merge risk (bot) blast:m4 Macs affected, from Merge risk (bot) blast:m5 Macs affected, from Merge risk (bot) ci-failing A check failed at the PR head (bot) door:two-way Revertible or not, from Merge risk (bot) merge-conflict Conflicts with the base branch (bot)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants