From: Thomas Zimmermann <tzimmermann@suse.de>
To: jfalempe@redhat.com, javierm@redhat.com, airlied@gmail.com,
simona@ffwll.ch, maarten.lankhorst@linux.intel.com,
mripard@kernel.org
Cc: dri-devel@lists.freedesktop.org, linux-doc@vger.kernel.org,
amd-gfx@lists.freedesktop.org, rust-for-linux@vger.kernel.org,
linux-hyperv@vger.kernel.org, intel-gfx@lists.freedesktop.org,
intel-xe@lists.freedesktop.org, imx@lists.linux.dev,
linux-arm-kernel@lists.infradead.org,
nouveau@lists.freedesktop.org, linux-renesas-soc@vger.kernel.org,
virtualization@lists.linux.dev, sashiko-reviews@lists.linux.dev,
Thomas Zimmermann <tzimmermann@suse.de>
Subject: [PATCH 08/12] drm/panic: Split draw_panic_plane()
Date: Tue, 18 Aug 2026 14:28:06 +0200 [thread overview]
Message-ID: <20260818125012.468092-9-tzimmermann@suse.de> (raw)
In-Reply-To: <20260818125012.468092-1-tzimmermann@suse.de>
Move locking and parameters from draw_panic_plane() into the new
helper drm_panic_display_panic_screen(). Call draw_panic_plane() from
there.
The new helper drm_panic_display_panic_screen() is now the DRM core's
interface for displaying a panic screen. The code remaining in
draw_panic_plane() still does all the heavy lifting. It will become a
plane helper for DRM drivers.
Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
---
drivers/gpu/drm/drm_panic.c | 60 ++++++++++++++++++++-----------------
1 file changed, 33 insertions(+), 27 deletions(-)
diff --git a/drivers/gpu/drm/drm_panic.c b/drivers/gpu/drm/drm_panic.c
index 0960750bfce2..2263a11efdf6 100644
--- a/drivers/gpu/drm/drm_panic.c
+++ b/drivers/gpu/drm/drm_panic.c
@@ -940,38 +940,21 @@ static void drm_panic_clear_description(void)
desc_line->txt = NULL;
}
-static void draw_panic_plane(struct drm_plane *plane, const char *description)
+static void draw_panic_plane(struct drm_plane *plane, const char *description,
+ enum drm_panic_type panic_type, u32 fg_color, u32 bg_color,
+ unsigned int qr_version)
{
struct drm_scanout_buffer sb = { };
int ret;
- unsigned long flags;
-#if defined(CONFIG_DRM_PANIC_FOREGROUND_COLOR)
- u32 fg_color = CONFIG_DRM_PANIC_FOREGROUND_COLOR;
-#else
- u32 fg_color = 0x00ffffff;
-#endif
-#if defined(CONFIG_DRM_PANIC_BACKGROUND_COLOR)
- u32 bg_color = CONFIG_DRM_PANIC_BACKGROUND_COLOR;
-#else
- u32 bg_color = 0x00000000;
-#endif
-#if IS_ENABLED(CONFIG_DRM_PANIC_SCREEN_QR_CODE)
- unsigned int qr_version = panic_qr_version;
-#else
- unsigned int qr_version = 0;
-#endif
-
- if (!drm_panic_trylock(plane->dev, flags))
- return;
ret = plane->helper_private->get_scanout_buffer(plane, &sb);
if (ret || !drm_panic_is_format_supported(sb.format))
- goto unlock;
+ return;
/* One of these should be set, or it can't draw pixels */
if (!sb.set_pixel && !sb.pages && iosys_map_is_null(&sb.map[0]))
- goto unlock;
+ return;
drm_panic_set_description(description);
@@ -986,9 +969,33 @@ static void draw_panic_plane(struct drm_plane *plane, const char *description)
}
drm_panic_clear_description();
+}
-unlock:
- drm_panic_unlock(plane->dev, flags);
+static void drm_panic_display_panic_screen(struct drm_plane *plane, const char *description)
+{
+#if defined(CONFIG_DRM_PANIC_FOREGROUND_COLOR)
+ u32 fg_color = CONFIG_DRM_PANIC_FOREGROUND_COLOR;
+#else
+ u32 fg_color = 0x00ffffff;
+#endif
+#if defined(CONFIG_DRM_PANIC_BACKGROUND_COLOR)
+ u32 bg_color = CONFIG_DRM_PANIC_BACKGROUND_COLOR;
+#else
+ u32 bg_color = 0x00000000;
+#endif
+#if IS_ENABLED(CONFIG_DRM_PANIC_SCREEN_QR_CODE)
+ unsigned int qr_version = panic_qr_version;
+#else
+ unsigned int qr_version = 0;
+#endif
+ struct drm_device *dev = plane->dev;
+ unsigned long flags;
+
+ if (drm_panic_trylock(dev, flags)) {
+ draw_panic_plane(plane, description, drm_panic_type,
+ fg_color, bg_color, qr_version);
+ drm_panic_unlock(dev, flags);
+ }
}
static struct drm_plane *to_drm_plane(struct kmsg_dumper *kd)
@@ -1001,10 +1008,9 @@ static void drm_panic(struct kmsg_dumper *dumper, struct kmsg_dump_detail *detai
struct drm_plane *plane = to_drm_plane(dumper);
if (detail->reason == KMSG_DUMP_PANIC)
- draw_panic_plane(plane, detail->description);
+ drm_panic_display_panic_screen(plane, detail->description);
}
-
/*
* DEBUG FS, This is currently unsafe.
* Create one file per plane, so it's possible to debug one plane at a time.
@@ -1021,7 +1027,7 @@ static ssize_t debugfs_trigger_write(struct file *file, const char __user *user_
if (kstrtobool_from_user(user_buf, count, &run) == 0 && run) {
struct drm_plane *plane = file->private_data;
- draw_panic_plane(plane, "Test from debugfs");
+ drm_panic_display_panic_screen(plane, "Test from debugfs");
}
return count;
}
--
2.55.0
next prev parent reply other threads:[~2026-08-18 12:55 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-18 12:27 [PATCH 00/12] drm/panic: Split into core and helpers Thomas Zimmermann
2026-08-18 12:27 ` [PATCH 01/12] drm/panic: Allocate QR-code buffers statically Thomas Zimmermann
2026-08-18 13:09 ` sashiko-bot
2026-08-18 12:28 ` [PATCH 02/12] drm/panic: Make allocation of zlib workspace more robust Thomas Zimmermann
2026-08-18 12:28 ` [PATCH 03/12] drm/panic: Return -EINVAL if font is not available Thomas Zimmermann
2026-08-18 13:04 ` sashiko-bot
2026-08-18 12:28 ` [PATCH 04/12] drm/panic: Return errno codes if panic output fails Thomas Zimmermann
2026-08-18 13:03 ` sashiko-bot
2026-08-18 12:28 ` [PATCH 05/12] drm/panic: Pass colors to draw_panic_dispatch() Thomas Zimmermann
2026-08-18 12:28 ` [PATCH 06/12] drm/panic: Pass global module parameters to drm_panic_dispatch() Thomas Zimmermann
2026-08-18 13:09 ` sashiko-bot
2026-08-18 12:28 ` [PATCH 07/12] drm/panic: Retry in dispatch function if panic output fails Thomas Zimmermann
2026-08-18 13:05 ` sashiko-bot
2026-08-18 12:28 ` Thomas Zimmermann [this message]
2026-08-18 13:14 ` [PATCH 08/12] drm/panic: Split draw_panic_plane() sashiko-bot
2026-08-18 12:28 ` [PATCH 09/12] drm/panic: Display panic screen via per-plane callback Thomas Zimmermann
2026-08-18 13:19 ` sashiko-bot
2026-08-18 12:28 ` [PATCH 10/12] drm/panic: Internalize panic locking in DRM core and helpers Thomas Zimmermann
2026-08-18 12:28 ` [PATCH 11/12] drm/panic: Move panic display code into helper library Thomas Zimmermann
2026-08-18 13:13 ` sashiko-bot
2026-08-18 15:55 ` Randy Dunlap
2026-08-18 12:28 ` [PATCH 12/12] drm/panic: Compile KUnit tests as module Thomas Zimmermann
2026-08-18 13:18 ` sashiko-bot
2026-08-18 14:23 ` ✗ CI.checkpatch: warning for drm/panic: Split into core and helpers Patchwork
2026-08-18 14:24 ` ✗ CI.KUnit: failure " Patchwork
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=20260818125012.468092-9-tzimmermann@suse.de \
--to=tzimmermann@suse.de \
--cc=airlied@gmail.com \
--cc=amd-gfx@lists.freedesktop.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=imx@lists.linux.dev \
--cc=intel-gfx@lists.freedesktop.org \
--cc=intel-xe@lists.freedesktop.org \
--cc=javierm@redhat.com \
--cc=jfalempe@redhat.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-hyperv@vger.kernel.org \
--cc=linux-renesas-soc@vger.kernel.org \
--cc=maarten.lankhorst@linux.intel.com \
--cc=mripard@kernel.org \
--cc=nouveau@lists.freedesktop.org \
--cc=rust-for-linux@vger.kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=simona@ffwll.ch \
--cc=virtualization@lists.linux.dev \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox