[PATCH v9 0/9] drm/panic: Add a drm panic handler

Jocelyn Falempe jfalempe at redhat.com
Wed Mar 13 13:18:27 UTC 2024



On 12/03/2024 16:16, Sui Jingfeng wrote:
> Hi,
> 
> 
> On 2024/3/7 17:14, Jocelyn Falempe wrote:
>> This introduces a new drm panic handler, which displays a message when 
>> a panic occurs.
>> So when fbcon is disabled, you can still see a kernel panic.
>>
>> This is one of the missing feature, when disabling VT/fbcon in the 
>> kernel:
>> https://www.reddit.com/r/linux/comments/10eccv9/config_vtn_in_2023/
>> Fbcon can be replaced by a userspace kms console, but the panic screen 
>> must be done in the kernel.
>>
>> This is a proof of concept, and works with simpledrm, mgag200, ast, 
>> and imx.
>>
>> To test it, make sure you're using one of the supported driver, and 
>> trigger a panic:
>> echo c > /proc/sysrq-trigger
>>
>> or you can enable CONFIG_DRM_PANIC_DEBUG and echo 1 > 
>> /sys/kernel/debug/dri/0/drm_panic_plane_0
> 
> Yes, the whole series works for me! I have tested with drm/loongson,
> Are you willing to add a implement for drm/loongson driver?
> If you do please add the fallowing code snippet info 
> drm/loongson/lsdc_plane.c.
> Thanks you.
> 
Thanks for testing, and for enabling drm_panic on loongson.

My plan is to have a first version of drm_panic merged before adding 
more drivers. You will be able to send this patch when drm_panic is 
merged in drm-misc-next, and I will review it.

Best regards,

-- 

Jocelyn

> 
> static int
> lsdc_primary_plane_get_scanout_buffer(struct drm_plane *plane,
>                        struct drm_scanout_buffer *scanout)
> {
>      struct drm_framebuffer *fb;
> 
>      if (!plane->state || !plane->state->fb)
>          return -ENODEV;
> 
>      fb = plane->state->fb;
>      if (fb->modifier != DRM_FORMAT_MOD_LINEAR)
>          return -ENODEV;
> 
>      scanout->format = fb->format;
>      scanout->width = fb->width;
>      scanout->height = fb->height;
>      scanout->pitch = fb->pitches[0];
> 
>      return drm_gem_vmap_unlocked(fb->obj[0], &scanout->map);
> }
> 
> hook this lsdc_primary_plane_get_scanout_buffer() up to the 
> .get_scanout_buffer
> member of lsdc_primary_helper_funcs, and include the #include 
> <drm/drm_panic.h>
> Thanks you in advance!
> 



More information about the dri-devel mailing list