Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm/mgag200: Add drm_panic support

Add support for the drm_panic module, which displays a message to
the screen when a kernel panic occurs.

v5:
* Also check that the plane is visible and primary. (Thomas Zimmermann)

v7:
* use drm_for_each_primary_visible_plane()

v8:
* Replace get_scanout_buffer() logic 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-8-jfalempe@redhat.com
Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>

+24 -1
+6 -1
drivers/gpu/drm/mgag200/mgag200_drv.h
··· 366 366 struct drm_display_mode; 367 367 struct drm_plane; 368 368 struct drm_atomic_state; 369 + struct drm_scanout_buffer; 369 370 370 371 extern const uint32_t mgag200_primary_plane_formats[]; 371 372 extern const size_t mgag200_primary_plane_formats_size; ··· 380 379 struct drm_atomic_state *state); 381 380 void mgag200_primary_plane_helper_atomic_disable(struct drm_plane *plane, 382 381 struct drm_atomic_state *old_state); 382 + int mgag200_primary_plane_helper_get_scanout_buffer(struct drm_plane *plane, 383 + struct drm_scanout_buffer *sb); 384 + 383 385 #define MGAG200_PRIMARY_PLANE_HELPER_FUNCS \ 384 386 DRM_GEM_SHADOW_PLANE_HELPER_FUNCS, \ 385 387 .atomic_check = mgag200_primary_plane_helper_atomic_check, \ 386 388 .atomic_update = mgag200_primary_plane_helper_atomic_update, \ 387 389 .atomic_enable = mgag200_primary_plane_helper_atomic_enable, \ 388 - .atomic_disable = mgag200_primary_plane_helper_atomic_disable 390 + .atomic_disable = mgag200_primary_plane_helper_atomic_disable, \ 391 + .get_scanout_buffer = mgag200_primary_plane_helper_get_scanout_buffer 389 392 390 393 #define MGAG200_PRIMARY_PLANE_FUNCS \ 391 394 .update_plane = drm_atomic_helper_update_plane, \
+18
drivers/gpu/drm/mgag200/mgag200_mode.c
··· 21 21 #include <drm/drm_framebuffer.h> 22 22 #include <drm/drm_gem_atomic_helper.h> 23 23 #include <drm/drm_gem_framebuffer_helper.h> 24 + #include <drm/drm_panic.h> 24 25 #include <drm/drm_print.h> 25 26 26 27 #include "mgag200_drv.h" ··· 545 544 seq1 |= MGAREG_SEQ1_SCROFF; 546 545 WREG_SEQ(0x01, seq1); 547 546 msleep(20); 547 + } 548 + 549 + int mgag200_primary_plane_helper_get_scanout_buffer(struct drm_plane *plane, 550 + struct drm_scanout_buffer *sb) 551 + { 552 + struct mga_device *mdev = to_mga_device(plane->dev); 553 + struct iosys_map map = IOSYS_MAP_INIT_VADDR_IOMEM(mdev->vram); 554 + 555 + if (plane->state && plane->state->fb) { 556 + sb->format = plane->state->fb->format; 557 + sb->width = plane->state->fb->width; 558 + sb->height = plane->state->fb->height; 559 + sb->pitch[0] = plane->state->fb->pitches[0]; 560 + sb->map[0] = map; 561 + return 0; 562 + } 563 + return -ENODEV; 548 564 } 549 565 550 566 /*