From 519feff53032b15c09b590d8c5008aa5cc7391c8 Mon Sep 17 00:00:00 2001 From: Ryan Murray Date: Thu, 26 Nov 2026 00:30:42 +1100 Subject: [PATCH 1/2] drm/apple: stop an external firmware-27 pipe on DPMS off On firmware-27 interfaces iomfb_poweroff() returned before the clear swap and setPowerState(0) unless the pipe uses the H17G method profile, because H17P has no known safe pipe-off for its panel. Every other firmware-27 pipe that reaches it is external: a panel pipe takes the soft DPMS path in dcp_poweroff() and a retained external pipe has its own stop. Those pipes then kept scanning out the last frame after DPMS off. On a Mac mini (M2, 27.2 firmware) the HDMI monitor kept showing the last desktop frame with both CRTCs disabled, and the USB-C monitor only went dark because its synthetic HPD was dropped. Keep the early return for panel pipes only, and give an external pipe the clear swap and power-off sequence the H17G pipe already uses. The choice follows whether the DCP drives a panel (dcp_has_panel()), not the SoC or firmware version. Signed-off-by: Ryan Murray --- drivers/gpu/drm/apple/iomfb_template.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/apple/iomfb_template.c b/drivers/gpu/drm/apple/iomfb_template.c index 88c303630aae0..fd23281c4b6bb 100644 --- a/drivers/gpu/drm/apple/iomfb_template.c +++ b/drivers/gpu/drm/apple/iomfb_template.c @@ -2902,8 +2902,13 @@ void DCP_FW_NAME(iomfb_poweroff)(struct apple_dcp *dcp) #endif #if DCP_FW_H17(DCP_FW_VER) - /* H17P has no known safe pipe-off or surface-free transition. */ - if (dcp->hw.iomfb_method_profile != DCP_IOMFB_METHODS_H17G) + /* + * H17P has no known safe pipe-off or surface-free transition for + * its panel. An external pipe stops like the H17G one: otherwise + * DPMS off leaves it scanning out the last frame. + */ + if (dcp->hw.iomfb_method_profile != DCP_IOMFB_METHODS_H17G && + dcp_has_panel(dcp)) return; #endif @@ -2925,7 +2930,8 @@ void DCP_FW_NAME(iomfb_poweroff)(struct apple_dcp *dcp) kref_get(&cookie->refcount); #if DCP_FW_H17(DCP_FW_VER) - if (dcp->hw.iomfb_method_profile == DCP_IOMFB_METHODS_H17G) + if (dcp->hw.iomfb_method_profile == DCP_IOMFB_METHODS_H17G || + !dcp_has_panel(dcp)) dcp_prepare_clear_swap(dcp, swap); #else #if DCP_FW_DESKTOP_26(DCP_FW_VER) From ad937dcfb227ed4ee394cb73fafdbc964d72fa8b Mon Sep 17 00:00:00 2001 From: Ryan Murray Date: Thu, 26 Nov 2026 04:53:30 +1100 Subject: [PATCH 2/2] drm/apple: leave an external pipe without a valid mode to the firmware The external pipe-off on firmware-27 interfaces ran whenever a CRTC was disabled. On a Mac mini (M2, 27.2 firmware) the desktop's CRTC disable at the login hand-over can land while the firmware describes the HDMI display again after a hotplug. The firmware then answers neither the clear swap nor setPowerState(0); both time out, the next power-on waits for power in vain, and the display stays dark. A firmware re-describe withdraws the mode first (mode_state.valid is false until a mode set completes), and nothing of ours scans out then. Leave such a pipe to the firmware and only stop a pipe that runs a mode we set. Signed-off-by: Ryan Murray --- drivers/gpu/drm/apple/iomfb_template.c | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/apple/iomfb_template.c b/drivers/gpu/drm/apple/iomfb_template.c index fd23281c4b6bb..a8e995f3f4126 100644 --- a/drivers/gpu/drm/apple/iomfb_template.c +++ b/drivers/gpu/drm/apple/iomfb_template.c @@ -2907,9 +2907,22 @@ void DCP_FW_NAME(iomfb_poweroff)(struct apple_dcp *dcp) * its panel. An external pipe stops like the H17G one: otherwise * DPMS off leaves it scanning out the last frame. */ - if (dcp->hw.iomfb_method_profile != DCP_IOMFB_METHODS_H17G && - dcp_has_panel(dcp)) - return; + if (dcp->hw.iomfb_method_profile != DCP_IOMFB_METHODS_H17G) { + if (dcp_has_panel(dcp)) + return; + /* + * The firmware withdrew the mode (it is describing the display + * again after a hotplug, see dcp_mode_withdraw()): no scanout of + * ours is left to stop, and while it republishes the display it + * answers neither the clear swap nor setPowerState(0). Both then + * time out and leave the pipe unable to power on again. + */ + if (!READ_ONCE(dcp->mode_state.valid)) { + dev_dbg(dcp->dev, "%s: no valid mode, pipe left to the firmware\n", + __func__); + return; + } + } #endif #if DCP_FW_DESKTOP_26(DCP_FW_VER)