DE/compositor development notes - DRM operations - capabilites
What can compositor do with DRM devices once it has found them?
These devices respond to a number of
ioctls. All DRM devices respond to a set
ioctls that cover display controller functionality, and there are
ioctls used chiefly by Mesa for rendering operations. In addition,
kernel writes data to open DRM file descriptors whenever an
event happened and userspace has requested to know about it.
The list of
ioctls is pretty large, so this post covers only a small subset.
DRM_IOCTL_VERSION returns human-readable version, name, description
and (release?) date of DRM device.
DRM_IOCTL_GET_CAP returns capabilities of a DRM device.
Many of these capabilities refer to specific DRM
ioctls, so they may not
make much sense yet.
DRM_CAP_ADDFB2_MODIFIERS. boolean. Framebuffers support pixel format modifiers.
DRM_CAP_DUMB_BUFFER. boolean. The device can create dumb framebuffers (
DRM_CAP_DUMB_PREFERRED_DEPTH. integer. The preferred pixel depth of dumb framebuffers.
DRM_CAP_DUMB_PREFER_SHADOW. boolean. Non-sequential writes or reading from dumb framebuffer is slow.
DRM_CAP_SYNCOBJ. boolean. The device supports DRM sync objects.
DRM_CAP_SYNCOBJ_TIMELINE. boolean. The device supports DRM timeline sync objects (they can signal at specific points in their lifetimes).
Page flipping capabilities
DRM_CAP_ASYNC_PAGE_FLIP. boolean. The device can pageflip without delay (tearing pageflip).
DRM_CAP_PAGE_FLIP_TARGET. boolean. The device can pageflip with a specified target (
DRM_CAP_CURSOR_WIDTHinteger. return valid (not necessary the maximum) hardware cursor size.
DRM_CAP_PRIME. bitfield. The device can export buffers to other GPUs and/or import buffers from them.
DRM_CAP_CRTC_IN_VBLANK_EVENT. boolean. Always true since Linux 4.12.
DRM_CAP_TIMESTAP_MONOTONIC. boolean. Always true since Linux 4.15.
DRM_CAP_VBLANK_HIGH_CRTC. boolean. Always true since Linux 2.6.39
DRM client may indicate it has certain capabilites. This is necessary to activate backward-incompatible functionality that would otherwise break old clients.
Client capabilities are set using
DRM_CLIENT_CAP_STEREO_3D. boolean. Client can handle stereo 3D, so show it the corresponding modes in the list of modes.
DRM_CLIENT_CAP_UNIVERSAL_PLANES. integer1. If > 0 then client can handle multiple planes, show it planes beyond primary and cursor ones in the list of planes.
DRM_CLIENT_CAP_ATOMIC. boolean. Client can use atomic modesetting
ioctls. Also enables universal planes and aspect ratio.
DRM_CLIENT_CAP_ASPECT_RATIO. boolean. Client can handle aspect ratio in modes, so provide it.
DRM_CLIENT_CAP_WRITEBACK_CONNECTORS. boolean. Client can handle writeback connectors (connectors that capture output and save it into a framebuffer).
- DRM uAPI