[PATCH v4 4/4] drm/mgag200: Add drm_panic support
Thomas Zimmermann
tzimmermann at suse.de
Tue Oct 10 09:23:06 UTC 2023
Hi
Am 03.10.23 um 16:22 schrieb Jocelyn Falempe:
> 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/mgag200/mgag200_drv.c | 24 ++++++++++++++++++++++++
> 1 file changed, 24 insertions(+)
>
> diff --git a/drivers/gpu/drm/mgag200/mgag200_drv.c b/drivers/gpu/drm/mgag200/mgag200_drv.c
> index 976f0ab2006b..229d9c116b42 100644
> --- a/drivers/gpu/drm/mgag200/mgag200_drv.c
> +++ b/drivers/gpu/drm/mgag200/mgag200_drv.c
> @@ -12,10 +12,12 @@
> #include <drm/drm_aperture.h>
> #include <drm/drm_drv.h>
> #include <drm/drm_fbdev_generic.h>
> +#include <drm/drm_framebuffer.h>
> #include <drm/drm_file.h>
> #include <drm/drm_ioctl.h>
> #include <drm/drm_managed.h>
> #include <drm/drm_module.h>
> +#include <drm/drm_panic.h>
> #include <drm/drm_pciids.h>
>
> #include "mgag200_drv.h"
> @@ -83,6 +85,27 @@ resource_size_t mgag200_probe_vram(void __iomem *mem, resource_size_t size)
> return offset - 65536;
> }
>
> +static int mgag200_get_scanout_buffer(struct drm_device *dev,
> + struct drm_scanout_buffer *sb)
> +{
> + struct drm_plane *plane;
> + struct mga_device *mdev = to_mga_device(dev);
> + struct iosys_map map = IOSYS_MAP_INIT_VADDR_IOMEM(mdev->vram);
> +
> + /* mgag200 has only one plane */
> + drm_for_each_plane(plane, dev) {
> + if (!plane->state || !plane->state->fb)
Better test for plane->state->visible. You should also check if it's a
primary plane.
Best regards
Thomas
> + return -ENODEV;
> + 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];
> + sb->map = map;
> + return 0;
> + }
> + return -ENODEV;
> +}
> +
> /*
> * DRM driver
> */
> @@ -98,6 +121,7 @@ static const struct drm_driver mgag200_driver = {
> .major = DRIVER_MAJOR,
> .minor = DRIVER_MINOR,
> .patchlevel = DRIVER_PATCHLEVEL,
> + .get_scanout_buffer = mgag200_get_scanout_buffer,
> DRM_GEM_SHMEM_DRIVER_OPS,
> };
>
--
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Frankenstrasse 146, 90461 Nuernberg, Germany
GF: Ivo Totev, Andrew Myers, Andrew McDonald, Boudien Moerman
HRB 36809 (AG Nuernberg)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: OpenPGP_signature.asc
Type: application/pgp-signature
Size: 840 bytes
Desc: OpenPGP digital signature
URL: <https://lists.freedesktop.org/archives/dri-devel/attachments/20231010/52cefcb8/attachment.sig>
More information about the dri-devel
mailing list