All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jocelyn Falempe <jfalempe@redhat.com>
To: dri-devel@lists.freedesktop.org, tzimmermann@suse.de,
	airlied@redhat.com, maarten.lankhorst@linux.intel.com,
	mripard@kernel.org, daniel@ffwll.ch, javierm@redhat.com,
	bluescreen_avenger@verizon.net, noralf@tronnes.org
Cc: gpiccoli@igalia.com, Jocelyn Falempe <jfalempe@redhat.com>
Subject: [RFC][PATCH v7 0/9] drm/panic: Add a drm panic handler
Date: Thu,  4 Jan 2024 17:00:44 +0100	[thread overview]
Message-ID: <20240104160301.185915-1-jfalempe@redhat.com> (raw)

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, mgag200, ast, and imx 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.
 
v5:
 * Change the drawing API, use drm_fb_blit_from_r1() to draw the font.
   (Thomas Zimmermann)
 * Also add drm_fb_fill() to fill area with background color.
 * Add draw_pixel_xy() API for drivers that can't provide a linear buffer.
 * Add a flush() callback for drivers that needs to synchronize the buffer.
 * Add a void *private field, so drivers can pass private data to
   draw_pixel_xy() and flush(). 
 * Add ast support.
 * Add experimental imx/ipuv3 support, to test on an ARM hw. (Maxime Ripard)

v6:
 * Fix sparse and __le32 warnings
 * Drop the IMX/IPUV3 experiment, it was just to show that it works also on
   ARM devices.

v7:
 * Add a check to see if the 4cc format is supported by drm_panic.
 * Add a drm/plane helper to loop over all visible primary buffer,
   simplifying the get_scanout_buffer implementations
 * Add a generic implementation for drivers that uses drm_fb_dma. (Maxime Ripard)
 * Add back the IMX/IPUV3 support, and use the generic implementation. (Maxime Ripard)


Best regards,

Jocelyn Falempe (9):
  drm/format-helper: Add drm_fb_blit_from_r1 and drm_fb_fill
  drm/panic: Add a drm panic handler
  drm/plane: Add drm_for_each_primary_visible_plane macro
  drm/panic: Add drm_panic_is_format_supported()
  drm/fb_dma: Add generic get_scanout_buffer() for drm_panic
  drm/simpledrm: Add drm_panic support
  drm/mgag200: Add drm_panic support
  drm/ast: Add drm_panic support
  drm/imx: Add drm_panic support

 drivers/gpu/drm/Kconfig                  |  23 ++
 drivers/gpu/drm/Makefile                 |   1 +
 drivers/gpu/drm/ast/ast_drv.c            |  26 +-
 drivers/gpu/drm/drm_drv.c                |   8 +
 drivers/gpu/drm/drm_fb_dma_helper.c      |  55 +++
 drivers/gpu/drm/drm_format_helper.c      | 432 ++++++++++++++++++-----
 drivers/gpu/drm/drm_panic.c              | 382 ++++++++++++++++++++
 drivers/gpu/drm/imx/ipuv3/imx-drm-core.c |   2 +
 drivers/gpu/drm/mgag200/mgag200_drv.c    |  22 ++
 drivers/gpu/drm/tiny/simpledrm.c         |  15 +
 include/drm/drm_drv.h                    |  21 ++
 include/drm/drm_fb_dma_helper.h          |   4 +
 include/drm/drm_format_helper.h          |   9 +
 include/drm/drm_panic.h                  | 101 ++++++
 include/drm/drm_plane.h                  |  15 +
 15 files changed, 1033 insertions(+), 83 deletions(-)
 create mode 100644 drivers/gpu/drm/drm_panic.c
 create mode 100644 include/drm/drm_panic.h


base-commit: 50a3c772bd927dd409c484832ddd9f6bf00b7389
-- 
2.43.0


             reply	other threads:[~2024-01-04 16:04 UTC|newest]

Thread overview: 51+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-04 16:00 Jocelyn Falempe [this message]
2024-01-04 16:00 ` [PATCH v7 1/9] drm/format-helper: Add drm_fb_blit_from_r1 and drm_fb_fill Jocelyn Falempe
2024-01-17 15:06   ` Thomas Zimmermann
2024-01-17 16:40     ` Jocelyn Falempe
2024-01-19 10:58       ` Thomas Zimmermann
2024-01-19 12:25         ` Pekka Paalanen
2024-01-19 13:31           ` Thomas Zimmermann
2024-01-23 12:56         ` Thomas Zimmermann
2024-01-23 14:56           ` Jocelyn Falempe
2024-01-30 11:20             ` Thomas Zimmermann
2024-01-17 15:26   ` Jani Nikula
2024-01-17 16:43     ` Jocelyn Falempe
2024-01-04 16:00 ` [PATCH v7 2/9] drm/panic: Add a drm panic handler Jocelyn Falempe
2024-01-12 13:31   ` Daniel Vetter
2024-01-16 10:54     ` Jocelyn Falempe
2024-01-18 13:36       ` Daniel Vetter
2024-01-12 13:50   ` Daniel Vetter
2024-01-19 17:20     ` Jocelyn Falempe
2024-01-17 15:49   ` Thomas Zimmermann
2024-01-18 10:17     ` Jocelyn Falempe
2024-01-19  9:46       ` Thomas Zimmermann
2024-01-04 16:00 ` [PATCH v7 3/9] drm/plane: Add drm_for_each_primary_visible_plane macro Jocelyn Falempe
2024-01-08 10:24   ` Jocelyn Falempe
2024-01-08 10:30     ` Joe Perches
2024-01-04 16:00 ` [PATCH v7 4/9] drm/panic: Add drm_panic_is_format_supported() Jocelyn Falempe
2024-01-05  5:45   ` kernel test robot
2024-01-05  5:45     ` kernel test robot
2024-01-04 16:00 ` [PATCH v7 5/9] drm/fb_dma: Add generic get_scanout_buffer() for drm_panic Jocelyn Falempe
2024-01-06  2:54   ` kernel test robot
2024-01-06  2:54     ` kernel test robot
2024-01-08 10:20   ` Maxime Ripard
2024-01-12 12:29     ` Jocelyn Falempe
2024-01-12 13:41   ` Daniel Vetter
2024-01-12 13:56     ` Maxime Ripard
2024-01-18 13:38       ` Daniel Vetter
2024-01-26 12:39         ` Maxime Ripard
2024-01-17 14:28     ` Jocelyn Falempe
2024-01-18 13:51       ` Daniel Vetter
2024-01-04 16:00 ` [PATCH v7 6/9] drm/simpledrm: Add drm_panic support Jocelyn Falempe
2024-01-12 13:44   ` Daniel Vetter
2024-01-12 13:58     ` Maxime Ripard
2024-01-17 15:22       ` Thomas Zimmermann
2024-01-18 10:33         ` Maxime Ripard
2024-01-17 15:17   ` Thomas Zimmermann
2024-01-04 16:00 ` [PATCH v7 7/9] drm/mgag200: " Jocelyn Falempe
2024-01-17 15:15   ` Thomas Zimmermann
2024-01-04 16:00 ` [PATCH v7 8/9] drm/ast: " Jocelyn Falempe
2024-01-17 15:16   ` Thomas Zimmermann
2024-01-04 16:00 ` [PATCH v7 9/9] drm/imx: " Jocelyn Falempe
2024-01-12 14:00 ` [RFC][PATCH v7 0/9] drm/panic: Add a drm panic handler Daniel Vetter
2024-01-12 14:36   ` Jocelyn Falempe

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240104160301.185915-1-jfalempe@redhat.com \
    --to=jfalempe@redhat.com \
    --cc=airlied@redhat.com \
    --cc=bluescreen_avenger@verizon.net \
    --cc=daniel@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=gpiccoli@igalia.com \
    --cc=javierm@redhat.com \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=mripard@kernel.org \
    --cc=noralf@tronnes.org \
    --cc=tzimmermann@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.