Skip to content

drm/apple: keep a Type-C display connected while its CRTC is off - #44

Merged
DjDeveloperr merged 1 commit into
aurora-silicon:aurora-wipfrom
maralcbr:drm-apple-typec-dpms-off
Sep 27, 2026
Merged

DjDeveloperr merged 1 commit into
aurora-silicon:aurora-wipfrom
maralcbr:drm-apple-typec-dpms-off

Conversation

@maralcbr

Copy link
Copy Markdown
Contributor

On an M2 Max with a USB-C DP-alt monitor on dcpext, DPMS off never sticks: about 1.3 s later the display is on again. dcp_poweroff() drops the synthetic HPD, the firmware reports hotplug_gated(0) (plus DPTX call 20, inactive sink), and dcpep_cb_hotplug() marks the connector disconnected. The reconnect worker scheduled by dcp_poweroff() then brings the display back, and compositors (Hyprland here) enable a display that appears. Every blank also bounces workspaces and focus to the other output.

This patch ignores that unplug while the CRTC is off and the Type-C mux still reports the cable, as the driver already does for integrated panels, and leaves re-establishing the session to dcp_poweron(). Cable removal still goes through dcp_dptx_disconnect_oob().

Tested: M2 Max (J416c), Aurora 7.1.12 (aurora2-10) + this patch: DPMS off on a USB-C DP-alt display stays off (12/12 samples over ~7 s, no disconnect/reconnect; previously relit after ~1.3 s); lock/idle blank keeps both panels dark and a key wakes both; unplug while blanked still removes the connector.

Kernel log of one cycle before the patch (DPMS off on the USB-C display at 20:00:51.67)
Sep 26 20:00:51.669856 omarchy-m2-max kernel: apple-dcp 289c00000.dcp: dcp_poweroff() done
Sep 26 20:00:51.671182 omarchy-m2-max kernel: apple-dcp 289c00000.dcp: cb_hotplug() connected:0, valid_mode:1
Sep 26 20:00:51.676745 omarchy-m2-max kernel: apple-dcp 289c00000.dcp: dcp_hotplug() connected:0 valid_mode:0 nr_modes:32
Sep 26 20:00:51.683749 omarchy-m2-max kernel: apple-dcp 289c00000.dcp: DPTXPort: acking unhandled call 20
Sep 26 20:00:51.684002 omarchy-m2-max kernel: apple-dcp 289c00000.dcp: dcp_dptx_disconnect(port=0)
Sep 26 20:00:52.695742 omarchy-m2-max kernel: apple-dcp 289c00000.dcp: dcp_dptx_connect(port=0) target=0:1 typec=1 route=borrowed conn_type=20 connected=0
Sep 26 20:00:52.708733 omarchy-m2-max kernel: apple-dcp 289c00000.dcp: AFK[ep:28]: too many enabled services!
Sep 26 20:00:52.712737 omarchy-m2-max kernel: apple-dcp 289c00000.dcp: AFK[ep:28]: too many enabled services!
Sep 26 20:00:52.767749 omarchy-m2-max kernel: apple-dcp 289c00000.dcp: set_drive_settings: 4:0:374:0:0:0:0
Sep 26 20:00:52.773765 omarchy-m2-max kernel: apple-dcp 289c00000.dcp: set_drive_settings: 4:0:376:0:0:0:0
Sep 26 20:00:52.929195 omarchy-m2-max kernel: apple-dcp 289c00000.dcp: cb_hotplug() connected:1, valid_mode:0
Sep 26 20:00:52.929411 omarchy-m2-max kernel: apple-dcp 289c00000.dcp: dcp_hotplug() connected:1 valid_mode:0 nr_modes:32
Sep 26 20:00:52.945870 omarchy-m2-max kernel: apple-dcp 289c00000.dcp: dcp_dptx_connect(port=0) target=0:1 typec=1 route=borrowed conn_type=20 connected=1
Sep 26 20:00:52.946238 omarchy-m2-max kernel: apple-dcp 289c00000.dcp: dcp_poweron() starting
Sep 26 20:00:52.946742 omarchy-m2-max kernel: apple-dcp 289c00000.dcp: dcp_set_power_state_req returned, 9999 ms remaining
Sep 26 20:00:52.946993 omarchy-m2-max kernel: apple-dcp 289c00000.dcp: set_digital_out_mode(color:82 timing:55) "3440x1440": 60 319750 3440 3488 3520 3600 1440 1443 1453 1481 0x48 0x0
Sep 26 20:00:52.947236 omarchy-m2-max kernel: apple-dcp 289c00000.dcp: set_digital_out_mode() color mode depth:8 format:0 colorimetry:16 eotf:0 range:0 vrr:0
Sep 26 20:00:53.169988 omarchy-m2-max kernel: apple-dcp 289c00000.dcp: set_digital_out_mode finished:8277

Powering a Type-C CRTC off drops DCP's synthetic HPD, and the firmware
answers with a hotplug_gated(0) that dcpep_cb_hotplug() passes on as an
unplug. dcp_poweroff() then recreates the DPTX session a second later and
the firmware reports the display back. Userspace sees the connector go
away and return, and compositors enable a display that appears, so DPMS
off on a Type-C display is undone about 1.3 s later. Each blank also moves
the display's workspaces and focus to another output and back.

Ignore that unplug while the CRTC is off and the Type-C mux still reports
the cable, as is already done for the unplug integrated panels report after
SetPowerState(). Cable removal reaches DRM through
dcp_dptx_disconnect_oob() regardless. Drop the reconnect from
dcp_poweroff(): with the connector still connected, userspace enables the
CRTC again and dcp_poweron() re-establishes the DPTX session synchronously,
as it already does.

Fixes: 5c29016 ("drm: apple: recover Type-C displays across link interruptions")
Signed-off-by: Marcelo Alcantara <[email protected]>
@DjDeveloperr
DjDeveloperr merged commit d4a2966 into aurora-silicon:aurora-wip Sep 27, 2026
cb2206 added a commit to cb2206/linux that referenced this pull request Oct 9, 2026
…d sink

The previous change puts every second DP IN of a port on DPTX port 1
of the first one's pipeline. Two separate monitors behind a dock must
keep their own pipelines instead.

DCP tells the host the sink's tile topology through the DPTX
SetTiledDisplayHints call, which the driver acknowledged without
reading. For the LG UltraFine 5K it carries the tile location at 0x08/
0x0c, the tile counts at 0x30/0x34 (2x1) and the whole display's size
at 0x38/0x3c (5120x2880). Keep the counts and location per DPTX port,
clear them whenever the port connects or disconnects, and take DP IN 1
as a tile only once DPTX port 0 reports a display of more than one
tile. DCP sends the hint about 100 ms after DP IN 0's link comes up,
so DP IN 1 waits for it for up to 2 s (the Thunderbolt side retries on
-ENODEV) before it is routed the usual way.

Tested on a MacBook Pro 14" M1 Pro (j314s) on 11.38 with its j314s
device tree, an LG UltraFine 5K on the left Thunderbolt port and an
HDMI monitor on dcpext0: at boot, after unplug/replug, across DPMS
off/on and across two s2idle cycles (one of about 40 minutes):

  DPTXPort: port 0 carries tile (0,0) of a 2x1 tiled 5120x2880 display
  tiled: dpin1 joins dpin0 on DPTX port 1 (crossbar state 3)
  DPTXPort: port 1 carries tile (1,0) of a 2x1 tiled 5120x2880 display

Rebased onto 12.2 and tested again on the j314s with 12.2's device
tree, together with the Thunderbolt route-follows-CRTC series (aurora-silicon#44)
and the tile-follow commit on top: the LG alone at login, LG and HDMI,
DPMS off/on, s2idle and replug as above. 12.3 and 12.4 change only M3
display code, and the two commits apply to 12.4 as they are.

Signed-off-by: Christian Bartels <[email protected]>
DjDeveloperr pushed a commit that referenced this pull request Oct 15, 2026
…d sink

The previous change puts every second DP IN of a port on DPTX port 1
of the first one's pipeline. Two separate monitors behind a dock must
keep their own pipelines instead.

DCP tells the host the sink's tile topology through the DPTX
SetTiledDisplayHints call, which the driver acknowledged without
reading. For the LG UltraFine 5K it carries the tile location at 0x08/
0x0c, the tile counts at 0x30/0x34 (2x1) and the whole display's size
at 0x38/0x3c (5120x2880). Keep the counts and location per DPTX port,
clear them whenever the port connects or disconnects, and take DP IN 1
as a tile only once DPTX port 0 reports a display of more than one
tile. DCP sends the hint about 100 ms after DP IN 0's link comes up,
so DP IN 1 waits for it for up to 2 s (the Thunderbolt side retries on
-ENODEV) before it is routed the usual way.

Tested on a MacBook Pro 14" M1 Pro (j314s) on 11.38 with its j314s
device tree, an LG UltraFine 5K on the left Thunderbolt port and an
HDMI monitor on dcpext0: at boot, after unplug/replug, across DPMS
off/on and across two s2idle cycles (one of about 40 minutes):

  DPTXPort: port 0 carries tile (0,0) of a 2x1 tiled 5120x2880 display
  tiled: dpin1 joins dpin0 on DPTX port 1 (crossbar state 3)
  DPTXPort: port 1 carries tile (1,0) of a 2x1 tiled 5120x2880 display

Rebased onto 12.2 and tested again on the j314s with 12.2's device
tree, together with the Thunderbolt route-follows-CRTC series (#44)
and the tile-follow commit on top: the LG alone at login, LG and HDMI,
DPMS off/on, s2idle and replug as above. 12.3 and 12.4 change only M3
display code, and the two commits apply to 12.4 as they are.

Signed-off-by: Christian Bartels <[email protected]>
Signed-off-by: Chris Kearney <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants