Skip to main content

Crate drmkit_core

Crate drmkit_core 

Source
Expand description

Core DRM/KMS device access for drmkit.

Port of src/core/ plus src/modeset/atomic.{hpp,cpp} from drm-cxx @ dc2915b.

The main pieces:

  • Device — an open DRM node, owning or borrowing its descriptor.
  • PropertyStore — a per-object property cache, so building a frame’s atomic request is hash-map lookups rather than an ioctl per property.
  • AtomicRequest — accumulated property writes, testable and committable.

§Relationship to the drm crate

Per DR-2 drmkit wraps the Smithay drm crate and never re-binds the ioctls. Device implements drm::Device and drm::control::Device, so the whole KMS surface those traits expose is available directly. What this crate adds is the parts the C++ gives a different contract: descriptor ownership, the property cache, and the atomic request’s export seam.

§Example

use drmkit_core::{AtomicRequest, Device, ObjectType, PropertyStore};
use drm::control::AtomicCommitFlags;

let device = Device::open("/dev/dri/card0")?;
device.enable_universal_planes()?;
device.enable_atomic()?;

let mut props = PropertyStore::new();
props.cache_properties(&device, 31, ObjectType::Plane)?;

let mut request = AtomicRequest::new();
request.add_property(31, props.property_id(31, "FB_ID")?, 42)?;

request.test(&device, AtomicCommitFlags::empty())?;

Structs§

AtomicCommitFlags
Commit flags for atomic mode setting
AtomicRequest
An atomic modeset request under construction.
Device
An open DRM device.
Mode
Resolution and timing information for a display mode.
PropertyBlob
A kernel property blob, freed when it is dropped.
PropertyInfo
One cached property.
PropertyStore
Per-object property cache.
PropertyWrite
One accumulated (object, property, value) write.

Enums§

ClientCapability
Used to enable/disable capabilities for the process.
CoreError
Errors from device, property, and atomic-request operations.
ObjectType
A DRM object kind, for property queries.

Functions§

commit_with_out_fence
Commit build’s request and collect the CRTC’s out-fence.
crtc_sequence
The CRTC’s current vblank sequence.
event_pending
Whether an event – a page-flip completion, a vblank – is queued on the device, without reading it.
framebuffer_modifier
The modifier to declare when registering a framebuffer, or None to take the legacy path, which leaves the layout to the driver.
supports_framebuffer_modifiers
Whether the driver accepts DRM_MODE_FB_MODIFIERS (DRM_CAP_ADDFB2_MODIFIERS).

Type Aliases§

Result
Convenience alias.