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
84
85
86
87
88
89
// SPDX-FileCopyrightText: (c) 2026 Joel Winarske
// SPDX-License-Identifier: MIT
//! Display-plane capabilities, the layer model, and the plane allocator.
//!
//! Port of `src/planes/` from drm-cxx @ `dc2915b`.
//!
//! Three pieces, bottom-up:
//!
//! - [`PlaneCapabilities`] and [`PlaneRegistry`] — what each plane on a device
//! can do: which CRTCs it feeds, which formats and modifiers it scans out,
//! whether it rotates, where its zpos may sit. Built from a device behind
//! the `device` feature, or from fixtures a caller supplies, which is what
//! lets the allocator be tested against hardware nobody has.
//! - [`Layer`] — one thing to put on screen, as a bag of KMS properties plus
//! the hints that inform placement.
//! - [`Allocator`] — which layer goes on which plane.
//!
//! # Why placement is a search
//!
//! Nothing in the kernel's uAPI answers "can these layers be scanned out
//! together". `IN_FORMATS` prunes, `possible_crtcs` prunes, and neither
//! settles it: bandwidth limits, scaler counts and per-driver rules decide the
//! rest and are not advertised anywhere. The only oracle is an atomic
//! `TEST_ONLY` commit, which costs an ioctl.
//!
//! So the allocator proposes and the kernel disposes, and the whole design is
//! about proposing well enough that few proposals are needed. It seeds with a
//! maximum bipartite matching, orders candidates by a score, backtracks by
//! dropping the layer it can most afford to composite, and spends at most
//! [`Allocator::DEFAULT_MAX_TEST_COMMITS`] test commits per search before
//! settling for what it has. Layers that do not overlap are solved
//! independently, so a busy corner of the screen does not make the rest of it
//! expensive.
//!
//! Two caches keep the steady state near zero ioctls: a warm start that
//! re-validates last frame's assignment, and the fast path below.
//!
//! # Invariant 4
//!
//! [`Layer::property_hash`] isolates *content* from *placement*: a frame that
//! changes only content on already-placed layers reuses the cached plane
//! assignment and skips the redundant `TEST_ONLY` commit.
//!
//! The C++ can only document which properties are which. Here the split is
//! [`PropTag::class`], an exhaustive `match`, so a property added without a
//! classification does not compile — the misclassification the invariant warns
//! about cannot reach a running system.
pub use ;
pub use ;
pub use BipartiteMatching;
pub use ;
pub use Output;
pub use stacks_by_plane_id;
pub use ;
pub use ;
pub use ;
pub use ;