Skip to content

Commit

Permalink
drm/panic: Add drm_panic_is_enabled()
Browse files Browse the repository at this point in the history
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
  • Loading branch information
Jocelyn Falempe committed Jul 19, 2024
1 parent ef82428 commit 9f774c4
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
7 changes: 7 additions & 0 deletions drivers/gpu/drm/drm_crtc_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -317,4 +317,11 @@ drm_edid_load_firmware(struct drm_connector *connector)
}
#endif

/* drm_panic.c */
#ifdef CONFIG_DRM_PANIC
bool drm_panic_is_enabled(struct drm_device *dev);
#else
bool drm_panic_is_enabled(struct drm_device *dev) {return false; }
#endif

#endif /* __DRM_CRTC_INTERNAL_H__ */
20 changes: 20 additions & 0 deletions drivers/gpu/drm/drm_panic.c
Original file line number Diff line number Diff line change
Expand Up @@ -703,6 +703,26 @@ static void debugfs_register_plane(struct drm_plane *plane, int index)
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.
Expand Down

0 comments on commit 9f774c4

Please sign in to comment.