How to enable DRM driver debug logging in Linux ?

If you are facing some issues with graphics or DRM , display etc.. sometime your may want to enable the DRM drivers all debugging messages so you can narrow down the problems. In Linux the drm kernel drivers source code can be found in drivers/gpu/drm.

Enabling verbose debug messages is done through the drm.debug parameter, each category being enabled by a bit:

  • drm.debug=0x1 will enable CORE messages
  • drm.debug=0x2 will enable DRIVER messages
  • drm.debug=0x3 will enable CORE and DRIVER messages
  • drm.debug=0x1ff will enable all messages

So, to enable the DRM logs, you simply need to echo following value to sysfs file from console,

$ echo 0xf > /sys/module/drm/parameters/debug 

By default permission to access this sysfs file is blocked as,

$ cat /sys/module/drm/parameters/debug
cat: /sys/module/drm/parameters/debug: Permission denied

Hence you need to change the permissions as,

$ sudo chmod 777 /sys/module/drm/parameters/debug 

If you read this debug file, by default its set to 0,

$ cat /sys/module/drm/parameters/debug
0

Now, you can enable the debug logs as mentioned earlier,

$ echo 0xf > /sys/module/drm/parameters/debug 

Now, once you are able to set the 0xf to debug parameter, you can see the kernel logs enabled by using “dmesg”

dmesg 
[ 1576.503157] [drm:drm_vblank_enable [drm]] enabling vblank on crtc 0, ret: 0
[ 1576.503198] [drm:drm_ioctl [drm]] pid=1600, dev=0xe200, auth=1, DRM_IOCTL_MODE_ADDFB2
[ 1576.503239] [drm:drm_mode_addfb2 [drm]] [FB:102]
[ 1576.503256] [drm:drm_ioctl [drm]] pid=1600, dev=0xe200, auth=1, DRM_IOCTL_MODE_PAGE_FLIP
[ 1576.503292] [drm:drm_mode_object_get [drm]] OBJ ID: 105 (1)

Reference : https://01.org/linuxgraphics/gfx-docs/drm/gpu/drm-internals.html

Leave a Comment