Repository navigation
drm/apple: m4: offer only external modes the host can scan out - #3961
Draft
themartiano wants to merge 1 commit into
Draft
themartiano wants to merge 1 commit into
themartiano wants to merge 1 commit into
Conversation
An external output scans out from its surfaces or direct-scanout windows, which hold one XRGB8888 frame of at most 5120x2880. The mode list does not know: a larger native mode, such as a 6K display's, is offered and preferred, the firmware sets it, and then the enable fails allocating its surfaces (-EINVAL) and every frame is refused. The display stays black, again at every hotplug. Make the limit part of whether a mode fits: a larger mode is not offered, not preferred, and refused by the atomic check with -ENOSPC, as one over the link is. Seen on a J713 (M4 MacBook Air) with a 5120x2880 display over Thunderbolt while the limit was 3840x2160, and reported on a J715 with a 3840x2400 display then. 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: An M4 external output scans out from surfaces or direct-scanout windows that hold one XRGB8888 frame of at most 5120x2880 (#3258 raised that from 3840x2160). The mode list does not know this: main's
dcp_m4_ext_fits()checks only the link. A larger native mode, such as a 6K display's, is offered and preferred, the firmware sets it, and then the enable fails allocating its surfaces (-EINVAL) and every frame is refused. The display stays black, again at every hotplug. This makes the size limit part of "fits": a larger mode is not offered, not preferred, and refused by the atomic check with -ENOSPC, as one over the link already is.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). The commit adds no test. Hardware: no row of the filter itself. The problem was seen on a J713 (M4 Air, 26.6.2) with a 5120x2880 display over Thunderbolt while the limit was 3840x2160, and reported on a J715 with a 3840x2400 display then (on #2807). 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 with external outputs on firmware 26.6: J713, J715, J604, J773g, J623, J624. Only modes larger than 5120x2880 go away, and those cannot be scanned out today.
Other Macs: Every T8132 external output builds its mode list in
iomfb_m4_ext_get_modes(), so all six M4 Macs above run this. It can only remove modes wider than 5120 or taller than 2880, which today stay black. A sink that also lists a smaller mode gets that one as preferred instead, and a sink that lists only larger modes gets none, where today it gets one that stays black. Modes within 5120x2880 are offered and preferred as before. Other SoCs do not run this code.Interaction with #3454 (dual-pipe for high-pixel-rate external displays, open):
git merge-treeof this branch with #3454's head (b21a5c5) has no conflict. #3454 splits the pixel rate across two pipes (for example 5120x2160 at 165 Hz), but its surfaces keep the same 5120x2880 limit (dcp_m4_ext_drm_buffers()anddcp_m4_frame_check_ext()still refuse larger). So with both, a high-rate mode within 5120x2880 is still offered and can use two pipes, and a mode above it is not offered, which matches what #3454 can scan out. The filter usesDCP_M4_EXT_MAX_WIDTHandDCP_M4_EXT_MAX_HEIGHT, so if a later change lets a wider mode scan out across two pipes by raising those, the filter follows. If it raises the limit some other way, the filter must follow it.Not yet: a J713 row at this head: a 5120x2880 display still offered and shown at 5K, a 4K display unchanged. A row with a sink above 5120x2880 (a 6K display), where the largest mode should not be offered and a smaller one is shown.
Details
dcp_m4_ext_size_ok()indcp-m4-frame.h, next toDCP_M4_EXT_MAX_WIDTH/HEIGHT, is called fromdcp_m4_ext_fits(). That one function decides whatiomfb_m4_ext_get_modes()offers, whatdcp_m4_ext_pick_preferred()may pick, and whatiomfb_m4_ext_mode_ids()refuses with -ENOSPC.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.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. At that headDCP_M4_EXT_MAX_WIDTH/HEIGHTare still 5120/2880, anddcp_m4_ext_drm_buffers()returns -EINVAL above them.