aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/drivers/gpu/drm/drm_panic.c
diff options
context:
space:
mode:
authorJocelyn Falempe <jfalempe@redhat.com>2024-07-17 10:48:39 +0200
committerJocelyn Falempe <jfalempe@redhat.com>2024-07-19 11:38:23 +0200
commit9f774c42a908affba615bbed7463dd4f904dd5f1 (patch)
tree536dc19f360b828feff7aa2a6d5ae220e4c7fdc2 /drivers/gpu/drm/drm_panic.c
parentdrm/stm: ltdc: remove reload interrupt (diff)
downloadwireguard-linux-9f774c42a908affba615bbed7463dd4f904dd5f1.tar.xz
wireguard-linux-9f774c42a908affba615bbed7463dd4f904dd5f1.zip
drm/panic: Add drm_panic_is_enabled()
It allows to check if the drm device supports drm_panic. Prepare the work to have better integration with fbcon and vtconsole. Signed-off-by: Jocelyn Falempe <jfalempe@redhat.com> Reviewed-by: Javier Martinez Canillas <javierm@redhat.com> Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch> Link: https://patchwork.freedesktop.org/patch/msgid/20240717090102.968152-2-jfalempe@redhat.com
Diffstat (limited to 'drivers/gpu/drm/drm_panic.c')
-rw-r--r--drivers/gpu/drm/drm_panic.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/drivers/gpu/drm/drm_panic.c b/drivers/gpu/drm/drm_panic.c
index 8794c7f6c0ee..9f1a3568e62d 100644
--- a/drivers/gpu/drm/drm_panic.c
+++ b/drivers/gpu/drm/drm_panic.c
@@ -704,6 +704,26 @@ static void debugfs_register_plane(struct drm_plane *plane, int index) {}
#endif /* CONFIG_DRM_PANIC_DEBUG */
/**
+ * drm_panic_is_enabled
+ * @dev: the drm device that may supports drm_panic
+ *
+ * returns true if the drm device supports drm_panic
+ */
+bool drm_panic_is_enabled(struct drm_device *dev)
+{
+ struct drm_plane *plane;
+
+ if (!dev->mode_config.num_total_plane)
+ return false;
+
+ drm_for_each_plane(plane, dev)
+ if (plane->helper_private && plane->helper_private->get_scanout_buffer)
+ return true;
+ return false;
+}
+EXPORT_SYMBOL(drm_panic_is_enabled);
+
+/**
* drm_panic_register() - Initialize DRM panic for a device
* @dev: the drm device on which the panic screen will be displayed.
*/