Repository navigation
drm/apple: turn framebuffer damage into a commit - #2797
Conversation
DCP shows only what a swap hands it. A client that draws into the scanout buffer without flipping is never seen once the firmware stops refreshing from that buffer, and on the M4 internal panel it does stop: after idle_cache_ms (1000 ms by default) without a flip, the DCP presents a cached copy of the last frame until the next swap. fbcon is such a client. The fbdev emulation only generates damage when the framebuffer has a dirty hook, and appledrm's framebuffers had none (drm_gem_fb_create), so the console wrote straight into the scanout buffer and never caused a swap. On a J713 with a text greeter on tty1 the panel froze about a second after KMS took over, while input and writes to /dev/tty1 kept working; blanking and unblanking fb0, which does commit, brought it back. The same holds for any DIRTYFB caller. Create framebuffers with drm_gem_fb_create_with_dirty, as the dcpext shadow driver already does. drm_fbdev_dma then runs the console through its shadowed, deferred-I/O path, and each damage batch reaches drm_atomic_helper_dirtyfb(), a plane commit of the same framebuffer. On M4 that is an ordinary iomfb_m4_present(), which also leaves the idle cache and re-arms it, so a static console still gets cached. The hook applies to every DCP generation: none of them shows drawing it was not given a swap for, and compositors that flip are unaffected because they do not call DIRTYFB. This removes the need for appledrm.idle_cache_ms=0 on console-only systems. Fixes: a150a02 ("drm/apple: m4: Cache a static frame while nothing is flipping") Closes: #1185 Signed-off-by: Ryan Murray <[email protected]>
|
Review at d4001bd (non-author, draft). No blocker; the change does what it says for the frozen console. It also moves the console of every Mac onto the shadowed, deferred path, which the message should say.
Points to consider:
Small points, not blocking:
Assisted-by: LLM (Claude:Opus 5.5) |
|
J713 console row at
Still to do before undraft:
EvidenceLab store |
|
Second-family row (J413, M2 Air) at
I updated the PR body to cover the review point about the commit message. Its sentence "none of them shows drawing it was not given a swap for" is wrong for M1/M2; the body now says this is a behaviour change there. The commit is not reworded because that would need a force push. If this is merged with a merge commit, the merge message can carry the corrected paragraph. Ready for review: rows on T8132 (J713) and T8112 (J413), CI pending. Not run: M1 Pro (ours has no panel), M4 Pro, and a forced panic from a VT. @aurora-silicon/core, this is code-owner review for Row details
|
|
KUnit at |
There was a problem hiding this comment.
Verdict: FINISH, then merge.
Blocker: In drivers/gpu/drm/apple/apple_drv.c, the unconditional fb_create change forces fbdev shadow allocation, copies and atomic commits on backends that already show in-place writes. Please select the dirty helper using a display-backend capability for cached scanout, preserving the existing framebuffer helper when that capability is absent. This should be a backend decision shared across boards.
Checked: The standard GEM helper adds the atomic DIRTYFB callback, and the M4 row shows that damage reaches idle cached scanout. The J413 control confirms that the new commits on a backend without the cache are a behavior change, including after suspend.
Evidence
The PR reports 8/8 commits on J413 with the change against 0/8 on its control. The existing scanout already displays those writes, so the additional framebuffer allocation and recurring cursor-blink commits apply even though that path needs no refresh fix.
The previous change gave every appledrm framebuffer the dirty hook. On the firmware interfaces that scan the framebuffer out, drawing into it already shows without a swap, so there it only added a shadow copy per fbdev client and a blit plus an atomic commit for every console update (an idle text VT keeps committing for the cursor blink). Its commit message also said that no DCP generation shows such drawing, which is wrong for those interfaces. Ask the backend instead. dcp_caches_scanout() is true for an interface that may keep presenting a cached copy of the last swapped frame: the M4 IOMFB backend with its idle cache. appledrm's fb_create hands out framebuffers with the dirty hook when one of its CRTCs is driven by such a backend, and plain ones otherwise, as before the previous change. The T8132 external CRTCs are not apple_crtcs and their presents never enter the idle cache, so they do not count. Signed-off-by: Ryan Murray <[email protected]>
|
Addressed the App review in e4594e2 (one new commit, no force push).
Next: rows at e4594e2 with the same scripts. On the J713 I expect 8/8, because dcp_caches_scanout() should be true there. On the J413 I expect plain framebuffers again: 0 commits and no shadow. I'll post both here. |
There was a problem hiding this comment.
Verdict: HOLD at e4594e2b pending exact-head CI and hardware evidence. The new scope addresses my previous code finding.
Checked: Framebuffer creation queries the actual IOMFB backend of the already constructed CRTCs. The T8132 external CRTC check guards the Apple CRTC conversion. A DRM device without a caching backend keeps plain framebuffers, preserving its fbdev path. The capability is shared across boards.
Blockers: Attach the current-head cached-panel row and a plain-scanout control together with hosted checks. The prior rows used the globally enabled callback and cannot qualify the restored plain path at this head.
|
Rows at Correction: our J713 runs the H17P (firmware-27 stub, 26B123) interface, both on its saved fleet85 and on the test kernels. It does not run the M4 IOMFB backend, and the idle cache from #1185 exists only in that backend (it is on the 26.6.2 firmware path). So the J713 numbers I posted at At
That means this PR is a no-op at runtime on every Mac we have. The path it changes (a T8132 on the 26.6.2 firmware, where #1185 was found) needs a row on such a Mac, for example the J715 from #2319. If someone sees an H17P console freeze, adding Evidence (our own measurements; nothing here comes from Apple binaries): fbconrow/smoke/kernel-error logs for both Macs at both heads. |
|
Merge readiness at
Areas: Updated by pr-readiness on pushes, edits, reviews and comments, and on a schedule. Rules: merge policy · labels. |
|
The hosted checks at |
|
code-owner ping @DjDeveloperr: closeout merge at |
|
Merging under the 6-point rule (Ryan 09:29, permanent), at |
Replaces #2319 (same changes, commit trailers fixed).
Fixes #1185
Problem
On the J713 internal panel, a console-only screen (a text greeter on tty1, a VT, a session that fell back to fbcon) freezes about a second after KMS takes over.
idle_cache_ms(default 1000) has the DCP present a cached copy of the last frame once nothing has flipped, and leave it only at the next swap. fbcon draws straight into the scanout buffer and never causes a swap: appledrm's framebuffers are created withdrm_gem_fb_create, which has no dirty hook, sodrm_fbdev_dmasets up its unshadowed path and no damage is ever generated. The only ways back were a commit from somewhere else (fb0 blank/unblank) orappledrm.idle_cache_ms=0on the command line.Change
appledrm's
fb_createnow asks the display backend.dcp_caches_scanout()is true for a firmware interface that may keep presenting a cached copy of the last swapped frame instead of scanning out the framebuffer. Today that is the M4 IOMFB backend with its idle cache. When one of the device's CRTCs is driven by such a backend,apple_fb_create()returns framebuffers with the dirty hook (drm_gem_fb_create_with_dirty, which the dcpext shadow driver already uses). Otherwise it returns plain ones (drm_gem_fb_create), as before.With the dirty hook:
drm_fbdev_dma_driver_fbdev_probe()takes its shadowed, deferred-I/O path. Each damage batch goes throughdrm_fbdev_dma_helper_fb_dirty()todrm_atomic_helper_dirtyfb(), which is a plane commit of the same framebuffer.dcp_flush()->iomfb_m4_present(). That leaves the idle cache (any swap does) and re-arms it throughiomfb_m4_idle_cache_kick(). A console that stays static is still cached afteridle_cache_ms; one that changes is shown.DRM_IOCTL_MODE_DIRTYFBcallers on those devices get the same behaviour instead of-ENOSYS.Interfaces that scan the buffer out (M1/M2/M3, and the T8132 firmware-27 path) already show drawing without a swap, so they keep plain framebuffers: no shadow copy and no commit per console update. The T8132 external CRTCs are not
apple_crtcs, and their presents never enter the idle cache, so they are skipped.History: the first commit (d4001bd) gave every board the dirty hook. Its message says "none of them shows drawing it was not given a swap for", which is wrong for the scanout interfaces. The second commit (e4594e2) narrows the hook after the App review and says so. Neither is reworded, because that would need a force push.
Testing
0abc2f385e+ this change: every touched file built for arm64 (gcc, kernel warning flags,-Werror) with no warnings. KUnit atae19de35(arm64 QEMU, LLVM=1, the CI's kunitconfigs):drivers/gpu/drm/apple/tests/display.kunitconfig167 passed, 1 skipped (apple_g17_rx_util_min_test, needs CONFIG_UCLAMP_TASK);topology.kunitconfig208 passed, 1 skipped. No failures. Hosted CI is still queued.idle_cache_ms): a VT console idle for over 2 s then typing follows every key (frozen without the change), a 3000-line flood scrolls, VT switches to and from Hyprland work, every swap finishes within one 60 Hz frame, no apple-dcp errors.ae19de35(every board dirty) 8 of 8 console writes reach the DCP; the saved fleet85 gives 0 of 8. That shows the commits work on H17P; nobody checked whether the panel was frozen before. Ate4594e2bit gets plain framebuffers (0 of 8, as designed), smoke PASS.e4594e2b: plain framebuffers, 0 of 8 (the same as fleet89). One 15 s s2idle from the text VT: no new DCP errors. Smoke PASS.e4594e2b. Also open: whether an H17P text console freezes, which needs someone to look at the screen.ae19de35(before the narrowing): 8 of 8 writes commit (0 of 8 on the saved fleet89, expected: M2 has no idle cache and needs no swap). One 15 s s2idle from the text VT with console output written during the suspend: resumes, 4 of 4 writes commit after resume, no new DCP errors. Smoke row PASS, no error-level kernel lines, the reboot back to the saved kernel took 30 s.get_scanout_buffer, unchanged by this PR).