Skip to content

Commit

Permalink
drm/simpledrm: Add drm_panic support
Browse files Browse the repository at this point in the history
Add support for the drm_panic module, which displays a user-friendly
message to the screen when a kernel panic occurs.

v8:
 * Replace get_scanout_buffer() with drm_panic_set_buffer()
   (Thomas Zimmermann)

v9:
 * Revert to using get_scanout_buffer() (Sima)
 * move get_scanout_buffer() to plane helper functions (Thomas Zimmermann)

v12:
 * Use array for map and pitch in struct drm_scanout_buffer
   to support multi-planar format later. (Thomas Zimmermann)

Signed-off-by: Jocelyn Falempe <jfalempe@redhat.com>
Reviewed-by: Thomas Zimmermann <tzimmermann@suse.de>
Link: https://patchwork.freedesktop.org/patch/msgid/20240409163432.352518-7-jfalempe@redhat.com
Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
  • Loading branch information
Jocelyn Falempe committed Apr 15, 2024
1 parent 879b3b6 commit 41e5485
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions drivers/gpu/drm/tiny/simpledrm.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
#include <drm/drm_gem_shmem_helper.h>
#include <drm/drm_managed.h>
#include <drm/drm_modeset_helper_vtables.h>
#include <drm/drm_panic.h>
#include <drm/drm_probe_helper.h>

#define DRIVER_NAME "simpledrm"
Expand Down Expand Up @@ -671,11 +672,26 @@ static void simpledrm_primary_plane_helper_atomic_disable(struct drm_plane *plan
drm_dev_exit(idx);
}

static int simpledrm_primary_plane_helper_get_scanout_buffer(struct drm_plane *plane,
struct drm_scanout_buffer *sb)
{
struct simpledrm_device *sdev = simpledrm_device_of_dev(plane->dev);

sb->width = sdev->mode.hdisplay;
sb->height = sdev->mode.vdisplay;
sb->format = sdev->format;
sb->pitch[0] = sdev->pitch;
sb->map[0] = sdev->screen_base;

return 0;
}

static const struct drm_plane_helper_funcs simpledrm_primary_plane_helper_funcs = {
DRM_GEM_SHADOW_PLANE_HELPER_FUNCS,
.atomic_check = simpledrm_primary_plane_helper_atomic_check,
.atomic_update = simpledrm_primary_plane_helper_atomic_update,
.atomic_disable = simpledrm_primary_plane_helper_atomic_disable,
.get_scanout_buffer = simpledrm_primary_plane_helper_get_scanout_buffer,
};

static const struct drm_plane_funcs simpledrm_primary_plane_funcs = {
Expand Down

0 comments on commit 41e5485

Please sign in to comment.