Crate drm

source · []
Expand description

A safe interface to the Direct Rendering Manager subsystem found in various operating systems.


The Direct Rendering Manager (DRM) is subsystem found in various operating systems that exposes graphical functionality to userspace processes. It can be used to send data and commands to a GPU driver that implements the interface.

Userspace processes can access the DRM by opening a ‘device node’ (usually found in /dev/dri/*) and using various ioctl commands on the open file descriptor. Most processes use the libdrm library (part of the mesa project) to execute these commands. This crate takes a more direct approach, bypassing libdrm and executing the commands directly and doing minimal abstraction to keep the interface safe.

While the DRM subsystem exposes many powerful GPU interfaces, it is not recommended for rendering or GPGPU operations. There are many standards made for these use cases, and they are far more fitting for those sort of tasks.


To begin using this crate, the Device trait must be implemented. See the trait’s example section for details on how to implement it.


Memory management and buffer functionality that the DRM subsystem exposes.

Modesetting operations that the DRM subsystem exposes.


An authentication token, unique to the file descriptor of the device.

Bus ID of a device.

Driver version of a device.


Used to enable/disable capabilities for the process.

Used to check which capabilities your graphics driver has.

A general system error that can be returned by any DRM command.


This trait should be implemented by any object that acts as a DRM device. It is a prerequisite for using any DRM functionality.