diff mbox series

[2/2] drm/panic: Allows to run with fbcon

Message ID 20240422155811.83648-3-jfalempe@redhat.com (mailing list archive)
State New, archived
Headers show
Series drm/panic: Allows to run with fbcon | expand

Commit Message

Jocelyn Falempe April 22, 2024, 3:57 p.m. UTC
Disable the framebuffer emulation when a panic occurs, to avoid fbcon
to overwrite the panic screen.
So it's now safe to enable DRM_PANIC and FRAMEBUFFER_CONSOLE.

Signed-off-by: Jocelyn Falempe <jfalempe@redhat.com>
---
 drivers/gpu/drm/Kconfig     | 2 +-
 drivers/gpu/drm/drm_panic.c | 4 ++++
 2 files changed, 5 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/drivers/gpu/drm/Kconfig b/drivers/gpu/drm/Kconfig
index 959b19a041018..7a8b1ef4c6bcf 100644
--- a/drivers/gpu/drm/Kconfig
+++ b/drivers/gpu/drm/Kconfig
@@ -106,7 +106,7 @@  config DRM_KMS_HELPER
 
 config DRM_PANIC
 	bool "Display a user-friendly message when a kernel panic occurs"
-	depends on DRM && !FRAMEBUFFER_CONSOLE
+	depends on DRM
 	select DRM_KMS_HELPER
 	select FONT_SUPPORT
 	help
diff --git a/drivers/gpu/drm/drm_panic.c b/drivers/gpu/drm/drm_panic.c
index 7ece67086cecb..c46a2b878e759 100644
--- a/drivers/gpu/drm/drm_panic.c
+++ b/drivers/gpu/drm/drm_panic.c
@@ -15,6 +15,7 @@ 
 #include <linux/types.h>
 
 #include <drm/drm_drv.h>
+#include <drm/drm_fb_helper.h>
 #include <drm/drm_format_helper.h>
 #include <drm/drm_fourcc.h>
 #include <drm/drm_framebuffer.h>
@@ -470,6 +471,9 @@  static void draw_panic_plane(struct drm_plane *plane)
 	int ret;
 	unsigned long flags;
 
+	/* Prevent fbcon from overwriting the panic screen */
+	drm_fb_helper_emergency_disable(plane->dev->fb_helper);
+
 	if (!drm_panic_trylock(plane->dev, flags))
 		return;