dri-devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [RFC][PATCH v4 0/4] drm/panic: Add a drm panic handler
@ 2023-10-03 14:22 Jocelyn Falempe
  2023-10-03 14:22 ` [PATCH v4 1/4] drm/format-helper: Export line conversion helper for drm_panic Jocelyn Falempe
                   ` (3 more replies)
  0 siblings, 4 replies; 40+ messages in thread
From: Jocelyn Falempe @ 2023-10-03 14:22 UTC (permalink / raw)
  To: dri-devel, tzimmermann, airlied, maarten.lankhorst, mripard,
	daniel, javierm, bluescreen_avenger
  Cc: gpiccoli, Jocelyn Falempe

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 with simpledrm and mgag200, 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)
 
v4:
 * Fully support all simpledrm formats using drm conversion helpers
 * Rename dpanic_* to drm_panic_*, and have more coherent function name.
   (Thomas Zimmermann)
 * Use drm_fb_r1_to_32bit for fonts (Thomas Zimmermann)
 * Remove the default y to DRM_PANIC config option (Thomas Zimmermann)
 * Add foreground/background color config option
 * Fix the bottom lines not painted if the framebuffer height
   is not a multiple of the font height.
 * Automatically register the driver to drm_panic, if the function
   get_scanout_buffer() exists. (Thomas Zimmermann)
 * Add mgag200 support.
 
With mgag200 support, I was able to test that the xrgb8888 to rgb565 conversion is working.

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 (4):
  drm/format-helper: Export line conversion helper for drm_panic
  drm/panic: Add a drm panic handler
  drm/simpledrm: Add drm_panic support
  drm/mgag200: Add drm_panic support

 drivers/gpu/drm/Kconfig               |  22 ++
 drivers/gpu/drm/Makefile              |   1 +
 drivers/gpu/drm/drm_drv.c             |   8 +
 drivers/gpu/drm/drm_format_helper.c   |  88 +++++-
 drivers/gpu/drm/drm_panic.c           | 413 ++++++++++++++++++++++++++
 drivers/gpu/drm/mgag200/mgag200_drv.c |  24 ++
 drivers/gpu/drm/tiny/simpledrm.c      |  15 +
 include/drm/drm_drv.h                 |  14 +
 include/drm/drm_format_helper.h       |   9 +
 include/drm/drm_panic.h               |  41 +++
 10 files changed, 627 insertions(+), 8 deletions(-)
 create mode 100644 drivers/gpu/drm/drm_panic.c
 create mode 100644 include/drm/drm_panic.h


base-commit: 2dde18cd1d8fac735875f2e4987f11817cc0bc2c
-- 
2.41.0


^ permalink raw reply	[flat|nested] 40+ messages in thread

end of thread, other threads:[~2023-10-16 16:22 UTC | newest]

Thread overview: 40+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-10-03 14:22 [RFC][PATCH v4 0/4] drm/panic: Add a drm panic handler Jocelyn Falempe
2023-10-03 14:22 ` [PATCH v4 1/4] drm/format-helper: Export line conversion helper for drm_panic Jocelyn Falempe
2023-10-03 15:56   ` kernel test robot
2023-10-04  1:45   ` nerdopolis
2023-10-05  7:37     ` Jocelyn Falempe
2023-10-16 10:47   ` Thomas Zimmermann
2023-10-16 10:50     ` Thomas Zimmermann
2023-10-16 16:22     ` Jocelyn Falempe
2023-10-03 14:22 ` [PATCH v4 2/4] drm/panic: Add a drm panic handler Jocelyn Falempe
2023-10-05  3:39   ` kernel test robot
2023-10-05  8:18   ` Maxime Ripard
2023-10-05  9:16     ` Jocelyn Falempe
2023-10-06 14:35       ` Maxime Ripard
2023-10-06 16:54         ` Noralf Trønnes
2023-10-09  7:47           ` Jocelyn Falempe
2023-10-09  8:28             ` Maxime Ripard
2023-10-09  9:48               ` Jocelyn Falempe
2023-10-09 11:33                 ` Maxime Ripard
2023-10-09 14:05                   ` Jocelyn Falempe
2023-10-09 16:07                     ` Maxime Ripard
2023-10-10  7:55                       ` Jocelyn Falempe
2023-10-10  8:30                         ` Maxime Ripard
2023-10-10  9:04                       ` Thomas Zimmermann
2023-10-10  9:33                         ` Maxime Ripard
2023-10-10 13:05                           ` Thomas Zimmermann
2023-10-10 13:32                             ` Jocelyn Falempe
2023-10-10  8:55                   ` Thomas Zimmermann
2023-10-10  9:25                     ` Maxime Ripard
2023-10-10 11:29                       ` Noralf Trønnes
2023-10-10 12:15                         ` Maxime Ripard
2023-10-10 12:59                           ` Daniel Vetter
2023-10-10 13:24                             ` Thomas Zimmermann
2023-10-10 13:24                             ` Jocelyn Falempe
2023-10-07 12:38   ` Noralf Trønnes
2023-10-09  8:01     ` Jocelyn Falempe
2023-10-03 14:22 ` [PATCH v4 3/4] drm/simpledrm: Add drm_panic support Jocelyn Falempe
2023-10-03 14:22 ` [PATCH v4 4/4] drm/mgag200: " Jocelyn Falempe
2023-10-07 14:30   ` Noralf Trønnes
2023-10-09 10:01     ` Jocelyn Falempe
2023-10-10  9:23   ` Thomas Zimmermann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox