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

drm/ast: Add drm_panic support

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()

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

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>
Acked-by: Sui Jingfeng <sui.jingfeng@linux.dev>
Tested-by: Sui Jingfeng <sui.jingfeng@linux.dev>
Reviewed-by: Thomas Zimmermann <tzimmermann@suse.de>
Link: https://patchwork.freedesktop.org/patch/msgid/20240409163432.352518-10-jfalempe@redhat.com
Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>

+18
+18
drivers/gpu/drm/ast/ast_mode.c
··· 43 43 #include <drm/drm_gem_framebuffer_helper.h> 44 44 #include <drm/drm_gem_shmem_helper.h> 45 45 #include <drm/drm_managed.h> 46 + #include <drm/drm_panic.h> 46 47 #include <drm/drm_probe_helper.h> 47 48 #include <drm/drm_simple_kms_helper.h> 48 49 ··· 702 701 ast_set_index_reg_mask(ast, AST_IO_VGASRI, 0x1, 0xdf, 0x20); 703 702 } 704 703 704 + static int ast_primary_plane_helper_get_scanout_buffer(struct drm_plane *plane, 705 + struct drm_scanout_buffer *sb) 706 + { 707 + struct ast_plane *ast_plane = to_ast_plane(plane); 708 + 709 + if (plane->state && plane->state->fb && ast_plane->vaddr) { 710 + sb->format = plane->state->fb->format; 711 + sb->width = plane->state->fb->width; 712 + sb->height = plane->state->fb->height; 713 + sb->pitch[0] = plane->state->fb->pitches[0]; 714 + iosys_map_set_vaddr_iomem(&sb->map[0], ast_plane->vaddr); 715 + return 0; 716 + } 717 + return -ENODEV; 718 + } 719 + 705 720 static const struct drm_plane_helper_funcs ast_primary_plane_helper_funcs = { 706 721 DRM_GEM_SHADOW_PLANE_HELPER_FUNCS, 707 722 .atomic_check = ast_primary_plane_helper_atomic_check, 708 723 .atomic_update = ast_primary_plane_helper_atomic_update, 709 724 .atomic_enable = ast_primary_plane_helper_atomic_enable, 710 725 .atomic_disable = ast_primary_plane_helper_atomic_disable, 726 + .get_scanout_buffer = ast_primary_plane_helper_get_scanout_buffer, 711 727 }; 712 728 713 729 static const struct drm_plane_funcs ast_primary_plane_funcs = {