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
// SPDX-FileCopyrightText: (c) 2026 Joel Winarske
// SPDX-License-Identifier: MIT
//! DRM dumb buffers: GPU-free, CPU-mappable scanout surfaces.
//!
//! Port of `src/dumb/` plus `src/buffer_mapping.hpp` from drm-cxx @ `dc2915b`.
//!
//! Dumb buffers are KMS's allocation path that needs no accelerator: any driver
//! implementing `DRM_CAP_DUMB_BUFFER` — every modern KMS driver — can hand back
//! a linear, CPU-mappable pixel buffer. They are the right tool for cursors,
//! client-side decorations, software-rendered UI, and test harnesses.
//!
//! # Invariant 6
//!
//! [`Buffer::map`] is a zero-cost view of a mapping established once and held
//! for the buffer's whole life. [`Mapping`] has no [`Drop`] implementation, so
//! "the guard's destructor is a no-op" is structural rather than documented,
//! and the borrow makes outliving the buffer a compile error.
//!
//! This is load-bearing beyond convenience: `DumbScanoutSink`'s pacing depends
//! on `map()` costing nothing per frame.
//!
//! # Example
//!
//! ```no_run
//! use drmkit_core::Device;
//! use drmkit_dumb::{Buffer, Config, MapAccess};
//! use drmkit_fmt::fourcc;
//!
//! let device = Device::open("/dev/dri/card0")?;
//! let mut buffer = Buffer::create(
//! &device,
//! &Config { width: 64, height: 64, fourcc: fourcc::XRGB8888, ..Config::default() },
//! )?;
//!
//! // Free to acquire, free to drop -- once per frame is fine.
//! let mut view = buffer.map(MapAccess::Write);
//! if let Some(row) = view.row_mut(0) {
//! row.fill(0xff);
//! }
//! # Ok::<(), Box<dyn std::error::Error>>(())
//! ```
pub use ;
pub use ;
pub use ;