gbm.rs uses Cargo feature flags to make optional integrations opt-in, keeping compile times and dependency trees lean for projects that only need a subset of the library’s capabilities. Three features are enabled by default to cover the most common use cases, while additional features for serialization and runtime binding generation remain opt-in.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/Smithay/gbm.rs/llms.txt
Use this file to discover all available pages before exploring further.
Default Features
The following features are active unless you disable defaults withdefault-features = false.
import-wayland
Enables
Device::import_buffer_object_from_wayland, which imports a Wayland wl_buffer directly into a GBM buffer object. Pulls in the wayland-server 0.31 and wayland-backend 0.3 (with the server_system feature) crates.import-egl
Enables
Device::import_buffer_object_from_egl and the EGLImage type alias, allowing GBM buffer objects to be imported from EGL image handles. This feature adds no additional crate dependencies — it only gates the relevant API surface.drm-support
Implements
drm::Device and drm::control::Device on Device<T>, and drm::buffer::Buffer and drm::buffer::PlanarBuffer on BufferObject<T>. Requires the drm 0.14 crate.Optional Features
These features are not enabled by default and must be requested explicitly.use_bindgen
Regenerates the raw FFI bindings at build time by running
bindgen against the system gbm.h header. Useful when targeting a custom or newer version of libgbm that differs from the pre-generated bindings shipped with gbm-sys. See the Bindgen page for full details.serde
Derives
serde::Serialize and serde::Deserialize for BufferObjectFlags, making it possible to round-trip flags through any serde-compatible format (JSON, TOML, etc.). Adds serde 1.0.103 with the derive feature and also enables bitflags/serde.drm 0.14.0 is always present as a dev-dependency, regardless of feature flags, so that integration tests can exercise DRM functionality without requiring end-users to enable drm-support.Dependency Summary
| Feature | Crates Added | Enabled by Default |
|---|---|---|
import-wayland | wayland-server 0.31, wayland-backend 0.3 | ✅ |
import-egl | (none) | ✅ |
drm-support | drm 0.14 | ✅ |
use_bindgen | bindgen 0.69, proc-macro2, regex | ❌ |
serde | serde 1.0.103 | ❌ |
Configuration Examples
1. Default (Recommended)
Accept all three default features — nothing extra is required inCargo.toml.