1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
// SPDX-FileCopyrightText: (c) 2026 Joel Winarske
// SPDX-License-Identifier: MIT
//! GBM buffer allocation.
//!
//! A thin layer over libgbm, in the shape the rest of drmkit expects: errors
//! as a typed enum, formats as drmkit `FourCC`s, and a buffer that hands out
//! the descriptor a scanout path needs.
//!
//! GBM is how a GPU-rendered surface becomes something KMS can scan out. Where
//! `drmkit-dumb` allocates plain linear memory the CPU writes,
//! this asks the driver for memory its renderer can target — which on real
//! hardware means tiled or compressed layouts, and a modifier saying which.
//!
//! On a driver with no render engine the `drm` backend falls back to dumb
//! allocation, so this still works against vkms: linear, one plane, and a
//! dma-buf that exports. That is what makes it testable without a GPU.
//!
//! # libgbm is opened, not linked
//!
//! The library is loaded on the first [`GbmDevice`], so building needs no
//! libgbm at all and a machine without one gets [`GbmError::NotGbmCapable`]
//! rather than a binary that will not start. Which modifier entry points it
//! has is read there too, so one build runs against Mesa and against a
//! vendor libgbm that predates `gbm_bo_create_with_modifiers2`.
//!
//! [`GbmDevice::from_fd`] takes any DRM descriptor. With the default
//! `drmkit-core` feature off, that is the only way in, and this crate needs
//! nothing of drmkit's.
pub use ;
pub use GbmDevice;
pub use HIDE_ENV;
pub use GbmSurface;
/// What went wrong allocating or exporting.