diff mbox series

[v7,8/9] drm/ast: Add drm_panic support

Message ID 20240104160301.185915-9-jfalempe@redhat.com (mailing list archive)
State New, archived
Headers show
Series drm/panic: Add a drm panic handler | expand

Commit Message

Jocelyn Falempe Jan. 4, 2024, 4 p.m. UTC
Add support for the drm_panic module, which displays a message to
the screen when a kernel panic occurs.

v7
 * Use drm_for_each_primary_visible_plane()

Signed-off-by: Jocelyn Falempe <jfalempe@redhat.com>
---
 drivers/gpu/drm/ast/ast_drv.c | 26 ++++++++++++++++++++++++--
 1 file changed, 24 insertions(+), 2 deletions(-)

Comments

Thomas Zimmermann Jan. 17, 2024, 3:16 p.m. UTC | #1
Hi

Am 04.01.24 um 17:00 schrieb Jocelyn Falempe:
> Add support for the drm_panic module, which displays a message to
> the screen when a kernel panic occurs.
> 
> v7
>   * Use drm_for_each_primary_visible_plane()
> 
> Signed-off-by: Jocelyn Falempe <jfalempe@redhat.com>

Reviewed-by: Thomas Zimmermann <tzimmermann@suse.de>

> ---
>   drivers/gpu/drm/ast/ast_drv.c | 26 ++++++++++++++++++++++++--
>   1 file changed, 24 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/ast/ast_drv.c b/drivers/gpu/drm/ast/ast_drv.c
> index 90bcb1eb9cd9..8ddce3d7fda9 100644
> --- a/drivers/gpu/drm/ast/ast_drv.c
> +++ b/drivers/gpu/drm/ast/ast_drv.c
> @@ -35,6 +35,7 @@
>   #include <drm/drm_fbdev_generic.h>
>   #include <drm/drm_gem_shmem_helper.h>
>   #include <drm/drm_module.h>
> +#include <drm/drm_panic.h>
>   #include <drm/drm_probe_helper.h>
>   
>   #include "ast_drv.h"
> @@ -48,6 +49,27 @@ module_param_named(modeset, ast_modeset, int, 0400);
>    * DRM driver
>    */
>   
> +static int ast_get_scanout_buffer(struct drm_device *dev,
> +				  struct drm_scanout_buffer *sb)
> +{
> +	struct drm_plane *plane;
> +	struct ast_plane *ast_plane;
> +
> +	drm_for_each_primary_visible_plane(plane, dev) {
> +		ast_plane = to_ast_plane(plane);
> +		if (!ast_plane->vaddr)
> +			continue;
> +
> +		sb->format = plane->state->fb->format;
> +		sb->width = plane->state->fb->width;
> +		sb->height = plane->state->fb->height;
> +		sb->pitch = plane->state->fb->pitches[0];
> +		iosys_map_set_vaddr_iomem(&sb->map, ast_plane->vaddr);
> +		return 0;
> +	}
> +	return -ENODEV;
> +}
> +
>   DEFINE_DRM_GEM_FOPS(ast_fops);
>   
>   static const struct drm_driver ast_driver = {
> @@ -62,8 +84,8 @@ static const struct drm_driver ast_driver = {
>   	.major = DRIVER_MAJOR,
>   	.minor = DRIVER_MINOR,
>   	.patchlevel = DRIVER_PATCHLEVEL,
> -
> -	DRM_GEM_SHMEM_DRIVER_OPS
> +	.get_scanout_buffer = ast_get_scanout_buffer,
> +	DRM_GEM_SHMEM_DRIVER_OPS,
>   };
>   
>   /*
diff mbox series

Patch

diff --git a/drivers/gpu/drm/ast/ast_drv.c b/drivers/gpu/drm/ast/ast_drv.c
index 90bcb1eb9cd9..8ddce3d7fda9 100644
--- a/drivers/gpu/drm/ast/ast_drv.c
+++ b/drivers/gpu/drm/ast/ast_drv.c
@@ -35,6 +35,7 @@ 
 #include <drm/drm_fbdev_generic.h>
 #include <drm/drm_gem_shmem_helper.h>
 #include <drm/drm_module.h>
+#include <drm/drm_panic.h>
 #include <drm/drm_probe_helper.h>
 
 #include "ast_drv.h"
@@ -48,6 +49,27 @@  module_param_named(modeset, ast_modeset, int, 0400);
  * DRM driver
  */
 
+static int ast_get_scanout_buffer(struct drm_device *dev,
+				  struct drm_scanout_buffer *sb)
+{
+	struct drm_plane *plane;
+	struct ast_plane *ast_plane;
+
+	drm_for_each_primary_visible_plane(plane, dev) {
+		ast_plane = to_ast_plane(plane);
+		if (!ast_plane->vaddr)
+			continue;
+
+		sb->format = plane->state->fb->format;
+		sb->width = plane->state->fb->width;
+		sb->height = plane->state->fb->height;
+		sb->pitch = plane->state->fb->pitches[0];
+		iosys_map_set_vaddr_iomem(&sb->map, ast_plane->vaddr);
+		return 0;
+	}
+	return -ENODEV;
+}
+
 DEFINE_DRM_GEM_FOPS(ast_fops);
 
 static const struct drm_driver ast_driver = {
@@ -62,8 +84,8 @@  static const struct drm_driver ast_driver = {
 	.major = DRIVER_MAJOR,
 	.minor = DRIVER_MINOR,
 	.patchlevel = DRIVER_PATCHLEVEL,
-
-	DRM_GEM_SHMEM_DRIVER_OPS
+	.get_scanout_buffer = ast_get_scanout_buffer,
+	DRM_GEM_SHMEM_DRIVER_OPS,
 };
 
 /*