Repository navigation
drm: apple: t8132: a cursor plane on external outputs (KWin on the M4 mini's HDMI) - #2296
Open
DjDeveloperr wants to merge 3 commits into
Open
DjDeveloperr wants to merge 3 commits into
DjDeveloperr wants to merge 3 commits into
Conversation
An external display DART's SID0 arena holds the two retained copy surfaces (four slices) and the host windows of directly scanned-out framebuffers, one 32 MiB slice each. Ten slices leave six windows. A compositor that also puts its cursor on a plane of its own (the next commit) uses three windows for its frames and up to three for its cursor buffers, besides the console's, and the windows ran out: the frame fell back to the copy path and the cursor was not shown. Take sixteen slices, which leaves twelve windows. The arena is fixed at admission from the slices nothing else uses; generic DMA keeps the rest of the 2048. Signed-off-by: Diljit Singh <hey@djdev.me>
The T8132 external outputs (the J713's USB-C displays, and the J773g Mac
mini's HDMI with the main DCP) offered one plane, the primary. KWin 6.8 then
puts its cursor on that plane and every modeset fails with EINVAL ("Plane
must cover entire CRTC", a 64x64 buffer as a 32x32 destination), so the
desktop never lights the output unless KWIN_FORCE_SW_CURSOR=1 is set.
Add a cursor plane to each output and present it as the swap's upper surface
1, the way the swap record already describes upper surfaces:
- ARGB8888, linear, pre-multiplied (is_premultiplied set), zpos 1, under
surface ID 2;
- the check takes what the DCP takes as an upper surface: unscaled, 32x32 to
256x256 on screen, from the buffer's first byte, the pitch a multiple of
64 bytes. A cursor partly off the right or bottom edge is shown as its
on-screen part; one off the top or left edge, or with less than 32 pixels
left on screen, is refused, so that the compositor draws it itself;
- every swap carries the cursor with the frame, the copied frames included:
a commit of the cursor alone presents the frame on screen again with it;
- the cursor's framebuffer is mapped in a SID0 window of its own, tracked
as the frame's is (the swap going out, the swaps in flight, given-up
swaps, what a confirmed swap put on screen), so that a window is never
unmapped while a swap may still show it. Twelve windows instead of eight.
Tested on a J773g (Mac mini M4) with a G81SF monitor on HDMI at 1920x1080,
60 and 120 Hz (kernel 7.3.0 with #1192):
- a raw atomic client: a 64x64 cursor with the modeset, then mid screen, in
the bottom-right corner, 40 px visible at the right and bottom edges and a
32x32 crop are accepted and committed; 20 px visible at the right, off the
left or top edge, and a 16x16 crop are refused; 240 cursor-only commits in
a row, none failed (16.6 ms each at 60 Hz);
- KWin 6.8 drives the output with the cursor on the cursor plane, which
follows a uinput pointer; no swap errors.
Signed-off-by: Diljit Singh <hey@djdev.me>
With both slots for direct swaps in flight, iomfb_m4_ext_present_direct() returned -EBUSY and the frame was dropped; and a frame that fell back to the copy path while a direct swap was in flight was refused with -EBUSY too. On the J773g Mac mini this showed as "frame not shown: -16", about ten in a row after every 120 Hz modeset (fbcon, then KWin) while the display took its first frames, and more whenever the host windows ran out. A dropped frame's flip event is still sent, so a compositor that then goes idle leaves the screen on the frame before. Let the frame wait instead, with the session lock dropped: a direct one for the oldest swap in flight to complete or be given up, a copied one for all of them, 1 s at most each, then go out (-EBUSY only after that). Tested on a J773g with KWin at 1920x1080@120 over HDMI: no "frame not shown" in the boot or across three suspend-to-idle cycles (with the previous commits). Signed-off-by: Diljit Singh <hey@djdev.me>
This was referenced Nov 19, 2026
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.
The T8132 (M4) external outputs (
t8132_ext_drm.c: the J713's USB-C displays, and the J773g Mac mini's HDMI with #1192) offer only a primary plane. KWin 6.8 then puts its cursor on that plane and every modeset fails with EINVAL (Plane must cover entire CRTC), so the desktop never lights the output unlessKWIN_FORCE_SW_CURSOR=1is set. This series adds a cursor plane and stops frames from being dropped while swaps are in flight.Commits
dcp_m4_upper): ARGB8888, pre-multiplied, surface ID 2.frame not shown: -16after every 120 Hz modeset.Testing
On a J773g (Mac mini M4) with a G81SF on HDMI, kernel 7.3.0 = this series + #1192 + #2166 on the M4 mini GPU stack:
Modeset failed: Invalid argumentat start: its own trial of the cursor on the primary plane, before it settles. Harmless.frame not shownin boots or across five suspend-to-idle cycles. The only cursor misses are ~0.3 s while KWin starts, when every window is busy.tools/asahi/run-host-tests.py --only apple-dcp(m4-wire-golden included) gives the same 15 failures on this branch as on integration/aurora 0abc2f3. All 15 are new-clang-Werrorwarnings in other units.The J713 external path is the same code; it is untested there.
🤖 Generated with Claude Code