[PATCH v5 5/6] drm/ast: Add drm_panic support
Jocelyn Falempe
jfalempe at redhat.com
Fri Nov 3 14:53:29 UTC 2023
Add support for the drm_panic module, which displays a message to
the screen when a kernel panic occurs.
Signed-off-by: Jocelyn Falempe <jfalempe at redhat.com>
---
drivers/gpu/drm/ast/ast_drv.c | 4 ++--
drivers/gpu/drm/ast/ast_drv.h | 3 +++
drivers/gpu/drm/ast/ast_mode.c | 26 ++++++++++++++++++++++++++
3 files changed, 31 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/ast/ast_drv.c b/drivers/gpu/drm/ast/ast_drv.c
index e1224ef4ad83..da60d2e237f5 100644
--- a/drivers/gpu/drm/ast/ast_drv.c
+++ b/drivers/gpu/drm/ast/ast_drv.c
@@ -62,8 +62,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 --git a/drivers/gpu/drm/ast/ast_drv.h b/drivers/gpu/drm/ast/ast_drv.h
index 848a9f1403e8..b9c62d18e14e 100644
--- a/drivers/gpu/drm/ast/ast_drv.h
+++ b/drivers/gpu/drm/ast/ast_drv.h
@@ -504,6 +504,9 @@ int ast_mode_config_init(struct ast_device *ast);
#define ASTDP_1366x768_60 0x1E
#define ASTDP_1152x864_75 0x1F
+int ast_get_scanout_buffer(struct drm_device *dev,
+ struct drm_scanout_buffer *sb);
+
int ast_mm_init(struct ast_device *ast);
/* ast post */
diff --git a/drivers/gpu/drm/ast/ast_mode.c b/drivers/gpu/drm/ast/ast_mode.c
index 32f04ec6c386..3653e65a135b 100644
--- a/drivers/gpu/drm/ast/ast_mode.c
+++ b/drivers/gpu/drm/ast/ast_mode.c
@@ -43,6 +43,7 @@
#include <drm/drm_gem_framebuffer_helper.h>
#include <drm/drm_gem_shmem_helper.h>
#include <drm/drm_managed.h>
+#include <drm/drm_panic.h>
#include <drm/drm_probe_helper.h>
#include <drm/drm_simple_kms_helper.h>
@@ -1930,3 +1931,28 @@ int ast_mode_config_init(struct ast_device *ast)
return 0;
}
+
+int ast_get_scanout_buffer(struct drm_device *dev,
+ struct drm_scanout_buffer *sb)
+{
+ struct drm_plane *plane;
+ struct ast_plane *ast_plane;
+ struct iosys_map map;
+
+ drm_for_each_plane(plane, dev) {
+ if (!plane->state || !plane->state->visible || !plane->state->fb ||
+ plane->type != DRM_PLANE_TYPE_PRIMARY)
+ continue;
+ 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;
+}
--
2.41.0
More information about the dri-devel
mailing list