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.
A DRM connector represents a physical display output socket on a GPU — the port you plug a monitor into. Examples include HDMI-A, DisplayPort, VGA, DVI-D, and the embedded panel connector (eDP) found in laptops. Each connector tracks whether a display is physically attached, what display modes the connected panel supports, and which encoders can drive it.
Connectors are enumerated through Device::resource_handles() and inspected with Device::get_connector(). A connector in the Connected state has a populated mode list and physical size; a Disconnected connector has neither.
connector::Handle
An opaque, copy-cheap handle to a connector resource. Internally a NonZeroU32 wrapped with repr(transparent). All handles implement ResourceHandle, meaning they carry a compile-time FFI object type tag.
// Obtain handles from the resource set
let res = card.resource_handles().unwrap();
let handles: &[connector::Handle] = res.connectors();
connector::Info
Returned by Device::get_connector(). Contains the full state of a connector at the time of the call.
| Method | Return type | Description |
|---|
handle() | Handle | The connector’s own handle |
interface() | Interface | Physical connector type (HDMI-A, DP, eDP, …) |
interface_id() | u32 | Disambiguates multiple connectors of the same type (e.g. HDMI-A-1, HDMI-A-2) |
state() | State | Connection state: Connected, Disconnected, or Unknown |
size() | Option<(u32, u32)> | Physical display size in millimetres (width, height), or None if disconnected or unknown |
modes() | &[Mode] | Supported display timing modes (empty when disconnected) |
encoders() | &[encoder::Handle] | Encoders that this connector is compatible with |
current_encoder() | Option<encoder::Handle> | The encoder currently driving this connector |
subpixel() | SubPixel | Subpixel geometry of the connected panel |
Info also implements Display, formatting as "<Interface>-<interface_id>" (e.g. "HDMI-A-1").
Mode lists and physical size are only populated for Connected connectors. After a hotplug event, call get_connector with force_probe: true to refresh the data from hardware.
connector::Interface
The physical connector type. Variants map directly to the Linux kernel’s DRM_MODE_CONNECTOR_* constants.
| Variant | String representation | Description |
|---|
Unknown | "Unknown" | Unrecognised connector type |
VGA | "VGA" | Analog VGA |
DVII | "DVI-I" | DVI Integrated (analog + digital) |
DVID | "DVI-D" | DVI Digital |
DVIA | "DVI-A" | DVI Analog |
Composite | "Composite" | Composite video |
SVideo | "SVIDEO" | S-Video |
LVDS | "LVDS" | Low-Voltage Differential Signalling (internal panels) |
Component | "Component" | Component video (YPbPr) |
NinePinDIN | "DIN" | 9-pin DIN |
DisplayPort | "DP" | DisplayPort |
HDMIA | "HDMI-A" | HDMI Type A |
HDMIB | "HDMI-B" | HDMI Type B |
TV | "TV" | Generic TV output |
EmbeddedDisplayPort | "eDP" | Embedded DisplayPort (laptop panels) |
Virtual | "Virtual" | Virtual/software connector |
DSI | "DSI" | Display Serial Interface (mobile) |
DPI | "DPI" | Display Parallel Interface |
Writeback | "Writeback" | Writeback connector (renders to a buffer) |
SPI | "SPI" | SPI-connected display |
USB | "USB" | USB-attached display |
Interface implements as_str() -> &'static str returning the human-readable name, and From<u32> / From<Interface> for u32 for FFI conversion.
connector::State
Whether a physical display is present on the connector.
| Variant | Description |
|---|
Connected | A display is detected and the mode list is valid |
Disconnected | No display is detected |
Unknown | The kernel cannot determine connection status |
Unknown is common on connectors that do not support hot-plug detection (HPD), such as some VGA and DVI-A outputs. Treat it conservatively as potentially connected.
connector::SubPixel
The physical arrangement of RGB sub-elements in each pixel of the connected display. Useful for subpixel rendering (e.g. ClearType-style font hinting).
| Variant | Description |
|---|
Unknown | Sub-pixel geometry not reported |
HorizontalRgb | Red–Green–Blue left to right |
HorizontalBgr | Blue–Green–Red left to right |
VerticalRgb | Red–Green–Blue top to bottom |
VerticalBgr | Blue–Green–Red top to bottom |
None | No sub-pixel structure (e.g. OLED or monochrome) |
NotImplemented | Kernel-reported value not yet mapped by drm-rs |
Enumerating Connected Outputs
use drm::control::{connector, Device as ControlDevice};
let res = card.resource_handles().unwrap();
for &handle in res.connectors() {
let info = card.get_connector(handle, false).unwrap();
if info.state() == connector::State::Connected {
println!(
"{:?} connected, {} modes, size {:?}mm",
info.interface(),
info.modes().len(),
info.size(),
);
// Print preferred mode (if any)
if let Some(mode) = info.modes().first() {
println!(
" preferred: {}x{} @ {}Hz",
mode.size().0,
mode.size().1,
mode.vrefresh(),
);
}
}
}
At startup, iterate with force_probe: true on at least the first call per connector so the kernel returns up-to-date EDID and mode data. During steady-state rendering, use force_probe: false to avoid the latency and flicker risk of a kernel-side probe.