Skip to content

drm/vc4: Wire up the panic scanout buffer - #7636

Merged
popcornmix merged 1 commit into
raspberrypi:rpi-6.18.yfrom
popcornmix:drmpanic
Sep 21, 2026
Merged

popcornmix merged 1 commit into
raspberrypi:rpi-6.18.yfrom
popcornmix:drmpanic

Conversation

@popcornmix

Copy link
Copy Markdown
Collaborator

vc4 provided no get_scanout_buffer(), so drm_panic_register() skipped every plane and nothing was drawn when the kernel panicked - and with CONFIG_DRM_PANIC_DEBUG the dri/N/drm_panic_plane_x files never appeared either.

Framebuffers are drm_gem_dma objects, so the generic DMA helper does the job: it hands the panic handler the already mapped CPU address, without vmapping in panic context. Imported dmabufs and non-linear modifiers are rejected by the helper, so a compositor's buffers are still skipped, but the fbdev console - the case that matters when the machine dies - works.

Tested on a Pi 500: 56 planes register, and a panic (as well as the debugfs trigger) paints the panic screen, including the full backtrace with drm.panic_screen=kmsg.

@popcornmix

Copy link
Copy Markdown
Collaborator Author

@6by9 I wanted to test CONFIG_DRM_PANIC but it's not usable without this patch.

@6by9

6by9 commented Sep 21, 2026

Copy link
Copy Markdown
Contributor

Comparing against b558053 that added drm_panic support for rcar-du, that only adds get_scanout_buffer for the primary plane, not overlays or cursors.
Same for 8ae5bfb adding it for renesas/shmobile, 99b6251 for imx, and b2cb601 for tidss.

Seeing as that is all 4 users of drm_fb_dma_get_scanout_buffer, that would appear to be the de facto correct thing to do. It is slightly annoying as it requires duplicating the drm_plane_helper_funcs struct, but it's not huge.

vc4 provided no get_scanout_buffer(), so drm_panic_register() skipped
every plane and nothing was drawn when the kernel panicked - and with
CONFIG_DRM_PANIC_DEBUG the dri/N/drm_panic_plane_x files never appeared
either.

Framebuffers are drm_gem_dma objects, so the generic DMA helper does the
job: it hands the panic handler the already mapped CPU address, without
vmapping in panic context. Imported dmabufs and non-linear modifiers are
rejected by the helper, so a compositor's buffers are still skipped, but
the fbdev console - the case that matters when the machine dies - works.

Only the primary planes get it, as every other user of
drm_fb_dma_get_scanout_buffer() does, which costs a second copy of the
helper funcs per generation.

Tested on a Pi 500: one plane per CRTC registers, and a panic (as well
as the debugfs trigger) paints the panic screen, including the full
backtrace with drm.panic_screen=kmsg.

Signed-off-by: Dom Cobley <popcornmix@gmail.com>
@popcornmix

Copy link
Copy Markdown
Collaborator Author

Updated to match other drivers.

@popcornmix
popcornmix merged commit c1a5fac into raspberrypi:rpi-6.18.y Sep 21, 2026
12 checks passed
@popcornmix
popcornmix deleted the drmpanic branch September 21, 2026 17:14
popcornmix added a commit to raspberrypi/rpi-firmware that referenced this pull request Sep 22, 2026
kernel: drm/vc4: Wire up the panic scanout buffer
See: raspberrypi/linux#7636
popcornmix added a commit to raspberrypi/firmware that referenced this pull request Sep 29, 2026
kernel: drm/vc4: Wire up the panic scanout buffer
See: raspberrypi/linux#7636
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.

3 participants