From: Ryosuke Yasuoka Date: Mon, 26 May 2025 09:01:05 +0000 (+0900) Subject: drm/hyperv: Add support for drm_panic X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3671f37777589194c44bb9351568c13eee43da3c;p=thirdparty%2Fkernel%2Flinux.git drm/hyperv: Add support for drm_panic Add drm_panic module for hyperv drm so that panic screen can be displayed on panic. Signed-off-by: Ryosuke Yasuoka Reviewed-by: Jocelyn Falempe Link: https://lore.kernel.org/r/20250526090117.80593-2-ryasuoka@redhat.com Signed-off-by: Jocelyn Falempe --- diff --git a/drivers/gpu/drm/hyperv/hyperv_drm_modeset.c b/drivers/gpu/drm/hyperv/hyperv_drm_modeset.c index f7d2e973f79ee..945b9482bcb3a 100644 --- a/drivers/gpu/drm/hyperv/hyperv_drm_modeset.c +++ b/drivers/gpu/drm/hyperv/hyperv_drm_modeset.c @@ -17,6 +17,7 @@ #include #include #include +#include #include #include "hyperv_drm.h" @@ -181,10 +182,45 @@ static void hyperv_plane_atomic_update(struct drm_plane *plane, } } +static int hyperv_plane_get_scanout_buffer(struct drm_plane *plane, + struct drm_scanout_buffer *sb) +{ + struct hyperv_drm_device *hv = to_hv(plane->dev); + struct iosys_map map = IOSYS_MAP_INIT_VADDR_IOMEM(hv->vram); + + if (plane->state && plane->state->fb) { + sb->format = plane->state->fb->format; + sb->width = plane->state->fb->width; + sb->height = plane->state->fb->height; + sb->pitch[0] = plane->state->fb->pitches[0]; + sb->map[0] = map; + return 0; + } + return -ENODEV; +} + +static void hyperv_plane_panic_flush(struct drm_plane *plane) +{ + struct hyperv_drm_device *hv = to_hv(plane->dev); + struct drm_rect rect; + + if (!plane->state || !plane->state->fb) + return; + + rect.x1 = 0; + rect.y1 = 0; + rect.x2 = plane->state->fb->width; + rect.y2 = plane->state->fb->height; + + hyperv_update_dirt(hv->hdev, &rect); +} + static const struct drm_plane_helper_funcs hyperv_plane_helper_funcs = { DRM_GEM_SHADOW_PLANE_HELPER_FUNCS, .atomic_check = hyperv_plane_atomic_check, .atomic_update = hyperv_plane_atomic_update, + .get_scanout_buffer = hyperv_plane_get_scanout_buffer, + .panic_flush = hyperv_plane_panic_flush, }; static const struct drm_plane_funcs hyperv_plane_funcs = {