Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/Smithay/drm-rs/llms.txt

Use this file to discover all available pages before exploring further.

drm-rs gives Rust programs direct, safe access to the Linux kernel’s Direct Rendering Manager (DRM) subsystem. It wraps the raw ioctl interface in idiomatic Rust traits, letting you enumerate displays, set video modes, manage GPU buffers, and synchronise rendering — all without depending on libdrm.

Quickstart

Open a DRM device and query the driver in under five minutes.

Installation

Add drm-rs to your Cargo.toml and enable the features you need.

Core Concepts

Understand DRM, KMS, GEM, and how they fit together.

API Reference

Full reference for every trait, type, and function in drm-rs.

What drm-rs provides

drm-rs is structured around two core traits that mirror the DRM kernel interface:
  • drm::Device — Basic device operations: query the driver, manage the DRM master lock, check capabilities, and wait for vblank events.
  • drm::control::Device — Full Kernel Modesetting (KMS): enumerate connectors, CRTCs, planes, and encoders; create and attach framebuffers; perform legacy or atomic modesetting; manage GPU sync objects.

Atomic Modesetting

Use the modern atomic KMS API for flicker-free display configuration.

Legacy Modesetting

Set display modes with the classic set_crtc interface.

Dumb Buffers

Allocate and map simple CPU-accessible framebuffers.

Device Nodes

Understand primary, control, and render node types.

GEM Buffers

Manage GPU memory with GEM handles and PRIME sharing.

SyncObj & Fences

Synchronise GPU work with DRM sync objects and timeline fences.

Crate layout

drm-rs is published as three crates on crates.io:
CratePurpose
drmHigh-level safe API — start here
drm-ffiLow-level safe ioctl wrappers
drm-sysRaw C bindings (generated via bindgen)
Most applications only need the drm crate. The lower-level crates are available for code that needs direct ioctl access.
drm-rs does not open device files for you. Your application must provide an AsFd implementation — typically a std::fs::File opened on a /dev/dri/cardN or /dev/dri/renderDN node.

Build docs developers (and LLMs) love