Skip to content

drm/apple: m4: offer only external modes the host can scan out - #3961

Draft
themartiano wants to merge 1 commit into
aurora-silicon:mainfrom
themartiano:fix/m4-ext-modes-scanout
Draft

themartiano wants to merge 1 commit into
aurora-silicon:mainfrom
themartiano:fix/m4-ext-modes-scanout

Conversation

@themartiano

Copy link
Copy Markdown
Contributor

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 our 7.3.0 next4 test 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-tree of 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() and dcp_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 uses DCP_M4_EXT_MAX_WIDTH and DCP_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
Evidence
  • Head 9f617d0, parent 30c1870 (main). Cherry-picked without conflict from our branch on ba12094 (the base of the test kernel); the files it touches are unchanged on main since then.
  • Build: make O=<dir> LLVM=/usr/lib/llvm20/bin/ ARCH=arm64 olddefconfig from our J713 test kernel's config (7.3.0-0.next3), then W=1 drivers/gpu/drm/apple/ (clang 20.1.8). 0 warnings; iomfb_m4.o built.
  • scripts/checkpatch.pl --strict -g main..HEAD: 0 errors, 0 warnings, 0 checks.
  • KUnit, scripts/ci/apple-kunit.py plan picks dcp-fabric dcp-topology dcp-display; run on arm64 QEMU (LLVM=1, clang 23.1.5): dcp-fabric 117/117, dcp-topology 235 passed + 1 skipped of 236, dcp-display 211 passed + 1 skipped of 212. The skip is apple_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-global in pm-ownership). No new failure.
  • git merge-tree with iommu/apple-dart, drm/apple: t8132: dual-pipe peer bonding for high-pixel-rate external displays #3454's head b21a5c5: no conflict. At that head DCP_M4_EXT_MAX_WIDTH/HEIGHT are still 5120/2880, and dcp_m4_ext_drm_buffers() returns -EINVAL above them.

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

No deployments
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.

1 participant