Debugging Direct Rendering Manager (DRM) drivers in Linux can be essential for resolving graphical issues and improving performance. Enabling DRM driver debug logging helps developers and system administrators track and diagnose problems by providing detailed logging information. This guide walks you through the process of enabling DRM driver debug logging in Linux, complete with examples and practical tips.
What is DRM Driver Debug Logging?
DRM driver debug logging provides detailed logs related to the Direct Rendering Manager (DRM), which is responsible for managing graphics processing units (GPUs) and display outputs in Linux. By enabling debug logging, you can capture low-level messages and errors that help diagnose issues with the GPU or display system.
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”
[bash]
[ 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)