Repository navigation
drm/apple: m4: hold a Thunderbolt display across a deep sleep too - #3958
Draft
themartiano wants to merge 1 commit into
Draft
themartiano wants to merge 1 commit into
themartiano wants to merge 1 commit into
Conversation
A display released for a deep sleep is held: its connector stays as it was, and the replay at PM_POST_SUSPEND waits until it is connected again. A display on a Thunderbolt tunnel gets neither. The connection manager takes the tunnel down in the prepare phase, so the display is released before the DCP's suspend, which then finds nothing connected to hold. The replay runs at once: the enable fails on a link that is not up (-ENOLINK), the link status goes BAD, and the display comes back on the compositor's own modeset once the sink is reported. Take the hold for such a display at PM_SUSPEND_PREPARE, where its tunnel is still up. After the wake its cable comes with the tunnel, so a cable that is not there yet does not end the wait; one that comes back and then goes does. Wait 3 s at most as for any display, and 10 s if its tunnel is back by then: the sink reports later than on a direct link. A sleep that leaves the tunnel up, or one refused, finds the display still connected and waits for nothing. Measured on a J713 with an Apple Studio Display and an earlier tree: the replay ran 24 ms after the DCP's restart and failed with -67, and the sink was reported 5.9 to 6.0 s after the restart. Signed-off-by: Eduardo <git@martiano.me>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What: Builds on the hold from #2200. #2200 holds a display that the DCP's suspend releases, and replays its mode once the display is connected again. A Thunderbolt display is released earlier: the connection manager takes its tunnel down in the prepare phase, so the DCP's suspend finds nothing to hold. The replay then runs at once, the enable fails with -ENOLINK (-67), the link status goes BAD, and the picture comes back only on the compositor's own modeset. This takes the hold for a display on a tunnel at PM_SUSPEND_PREPARE, while the tunnel is still up. After the wake it waits #2200's 3 s, and up to 10 s from the same start only if the tunnel's cable is back by then.
Tested: Host side at the head, on main 30c1870. arm64 W=1 LLVM 20 build of
drivers/gpu/drm/apple/: 0 warnings. checkpatch --strict: clean. The KUnit suites CI picks (dcp-fabric,dcp-topology,dcp-display) pass on arm64 QEMU, with one skip that needs CONFIG_UCLAMP_TASK. apple-dcp host suite: no new failure against main (the same 14 compile errors from this container's newer host compiler). Hardware: measured on a J713 (M4 Air, 26.6.2) with an Apple Studio Display on an earlier tree, before this was redone on #2200: the replay ran 24 ms after the DCP's restart and failed with -67, and the sink was reported 5.9 to 6.0 s after the restart. This commit is in our7.3.0 next4test kernel (main ba12094 plus this and other open branches; the files it touches are the same on today's main). A row at this head is not yet run.Risk: two-way · M4 (T8132) Macs whose external output can be a Thunderbolt tunnel on main: J713 and J715. A Thunderbolt display unplugged during the sleep now costs 3 s at resume, as an alt-mode display whose sink never reports already does. The hold is also taken before an s2idle, since the target state is not known at PREPARE; there the display is still connected at the end, so nothing is waited for (code reading).
Other Macs: The code is in
iomfb_m4.candt8132_ext_drm.c, which only T8132 Macs on firmware 26.6 run. The new part only acts for an output whose route is a tunnel (dcp_is_usb4_output()), and only the J713 and J715 enable USB4 in their trees on main. On the J604, J773g, J623 and J624 the external outputs are direct: they keep #2200's 3 s wait unchanged (same deadline, computed from the same start). Other SoCs do not run this code. On a J715 with a Thunderbolt display it should help the same way, but there are no rows from one.Not yet: a J713 row at this head with a Thunderbolt display: three deep sleeps with no
-67and the picture back once; DPMS off before the sleep; unplug during the sleep (expect 3 s); an HDMI or alt-mode display alone (unchanged); s2idle if the port allows it. Rows from a J715.Details
iomfb_m4_ext_relink_own()(PM_SUSPEND_PREPARE) now also callsiomfb_m4_ext_relink_expect()for an external output on a tunnel with a sink, andext_relink_tunnelrecords that.completeondp_wq. A cable that comes back and then goes does end it.iomfb_m4_ext_relink_wait()takes two deadlines: drm: apple: t8132: keep an external display across a deep sleep #2200's 3 s, then 10 s from the same start if the display is on a tunnel and its Type-C cable is connected again. The 10 s is a bound on an event wait, not a delay. The sink was reported about 6 s after the DCP's restart in both logged sleeps.dp_wqinapple_nhi_cio_complete()(symmetrical with prepare) to end an unplugged tunnel's wait earlier. Not done: it would touch every CIO sleep.git merge-treeagainst iommu/apple-dart, drm/apple: t8132: dual-pipe peer bonding for high-pixel-rate external displays #3454 (dual-pipe, also iniomfb_m4.c/iomfb_m4.h): no conflict.Evidence
make O=<dir> LLVM=/usr/lib/llvm20/bin/ ARCH=arm64 olddefconfigfrom our J713 test kernel's config (7.3.0-0.next3), thenW=1 drivers/gpu/drm/apple/(clang 20.1.8). 0 warnings;iomfb_m4.oandt8132_ext_drm.obuilt.scripts/checkpatch.pl --strict -g main..HEAD: 0 errors, 0 warnings, 0 checks.scripts/ci/apple-kunit.py planpicksdcp-fabric dcp-topology dcp-display;runon arm64 QEMU (LLVM=1, clang 23.1.5):dcp-fabric117/117,dcp-topology235 passed + 1 skipped of 236,dcp-display211 passed + 1 skipped of 212. The skip isapple_g17_rx_util_min_test(needs CONFIG_UCLAMP_TASK, which the suites' configs do not set).tools/testing/selftests/drivers/gpu/apple-dcp/run.sh: 87 ok, 14 not ok; main at 30c1870 gives the same 14 (compile errors of this container's newer host compiler, for example-Wunused-but-set-globalinpm-ownership). No new failure.git merge-treewith iommu/apple-dart, drm/apple: t8132: dual-pipe peer bonding for high-pixel-rate external displays #3454's head b21a5c5: no conflict.