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
71
72
73
74
75
76
77
78
79
80
81
82
83
// SPDX-FileCopyrightText: (c) 2026 Joel Winarske
// SPDX-License-Identifier: MIT
//! Format-modifier and hardware-compression support for drmkit's plane
//! allocator.
//!
//! Port of `src/fmt/` from drm-cxx @ `dc2915b`.
//!
//! # Design contract
//!
//! Carried verbatim from the C++, because the allocator depends on all three:
//!
//! - **`IN_FORMATS` prunes the bipartite graph — necessary, not sufficient.**
//! - **The atomic `TEST_ONLY` commit is ground truth** for what a plane can
//! scan out.
//! - **[`BandwidthClass`] is a cost input to placement scoring, never a
//! correctness gate.**
//!
//! This keeps every vendor on one code path — AFBC (Arm/Rockchip/MediaTek),
//! AMD DCC, Qualcomm UBWC, NVIDIA block-linear, Broadcom tiling: a
//! `(fourcc, modifier)` pair flows from the producer's allocation, through
//! `IN_FORMATS` eligibility, to a probed-and-memoized test commit.
//!
//! # Scope
//!
//! This crate is `no_std + alloc` and device-free. Two pieces of the C++
//! `fmt/` header live elsewhere in the port:
//!
//! - `FormatTable::from_plane(fd, plane_id)` — blob fetching belongs to
//! `drmkit-core`'s property layer, which hands the bytes to
//! [`FormatTable::from_blob`]. The C++ had already split the parser out for
//! testability; this makes the split structural.
//! - `ScanoutBuffer` — not ported as one type: GBM allocation is
//! `drmkit-gbm`'s `GbmBuffer`, and the framebuffer modifier rule is
//! `drmkit-core`'s `framebuffer_modifier`.
//!
//! # Example
//!
//! ```
//! use drmkit_fmt::{
//! BandwidthClass, FormatTable, Modifier, classify, fourcc, layer_fits_plane,
//! };
//!
//! let plane = FormatTable::from_pairs([
//! (fourcc::XRGB8888, Modifier::LINEAR),
//! (fourcc::NV12, Modifier::LINEAR),
//! ]);
//!
//! assert!(layer_fits_plane(&plane, fourcc::XRGB8888, Modifier::LINEAR));
//! assert!(!layer_fits_plane(&plane, fourcc::ARGB8888, Modifier::LINEAR));
//!
//! // The INVALID sentinel is interchangeable with LINEAR.
//! assert!(layer_fits_plane(&plane, fourcc::NV12, Modifier::INVALID));
//!
//! assert_eq!(classify(Modifier::LINEAR), BandwidthClass::Linear);
//! ```
extern crate alloc;
pub use ;
pub use describe;
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;