mbox series

[RFC,v3,0/3] drm/panic: Add a drm panic handler

Message ID 20230927172849.193996-1-jfalempe@redhat.com (mailing list archive)
Headers show
Series drm/panic: Add a drm panic handler | expand

Message

Jocelyn Falempe Sept. 27, 2023, 5:22 p.m. UTC
This introduces a new drm panic handler, which displays a message when a panic occurs.
So when fbcon is disabled, you can still see a kernel panic.

This is one of the missing feature, when disabling VT/fbcon in the kernel:
https://www.reddit.com/r/linux/comments/10eccv9/config_vtn_in_2023/
Fbcon can be replaced by a userspace kms console, but the panic screen must be done in the kernel.

This is a proof of concept, and works only with simpledrm, using a new get_scanout_buffer() api

To test it, make sure you're using the simpledrm driver, and trigger a panic:
echo c > /proc/sysrq-trigger

v2:
 * Use get_scanout_buffer() instead of the drm client API. (Thomas Zimmermann)
 * Add the panic reason to the panic message (Nerdopolis)
 * Add an exclamation mark (Nerdopolis)
 
v3:
 * Rework the drawing functions, to write the pixels line by line and
 to use the drm conversion helper to support other formats.
 (Thomas Zimmermann)

I only added RGB565 support to show how it would work.
Basically I have a buffer of 1 line in xrgb8888, and write the pixels to it.
Then I convert it to the destination format in-place (if needed), and finally 
copy it to the scanout-buffer.
So it's straigh forward, and reuse the drm conversion helpers.

A few more though:
 1) what about gpu with multiple monitor connected ?
maybe get_scanout_buffer() could return a list of scanout buffers ?
 2) I think for some GPU drivers, there might need a flush_scanout_buffer() function, that should be called after the scanout buffer has been filled ?

Best regards,


Jocelyn Falempe (3):
  drm/format-helper: Export drm_fb_xrgb8888_to_rgb565_line
  drm/panic: Add a drm panic handler
  drm/simpledrm: Add drm_panic support

 drivers/gpu/drm/Kconfig             |  11 +
 drivers/gpu/drm/Makefile            |   1 +
 drivers/gpu/drm/drm_drv.c           |   3 +
 drivers/gpu/drm/drm_format_helper.c |   3 +-
 drivers/gpu/drm/drm_panic.c         | 366 ++++++++++++++++++++++++++++
 drivers/gpu/drm/tiny/simpledrm.c    |  17 ++
 include/drm/drm_drv.h               |  14 ++
 include/drm/drm_format_helper.h     |   2 +
 include/drm/drm_panic.h             |  41 ++++
 9 files changed, 457 insertions(+), 1 deletion(-)
 create mode 100644 drivers/gpu/drm/drm_panic.c
 create mode 100644 include/drm/drm_panic.h


base-commit: 2dde18cd1d8fac735875f2e4987f11817cc0bc2c