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
// SPDX-FileCopyrightText: (c) 2026 Joel Winarske
// SPDX-License-Identifier: MIT
//! Choosing a modifier both the producer and the display can live with.
use ;
/// Rank key: compression, then tiling, then linear.
const
/// Intersect what a producer can export with what a plane can scan out, and
/// rank the survivors.
///
/// Returns the candidates most-preferred first, or empty when the two sets do
/// not overlap. Duplicates in `producer` are collapsed.
///
/// # What the ranking means
///
/// Compression first, then tiling, then linear — because that is the order of
/// how much memory bandwidth each costs to scan out, and bandwidth is what
/// runs out first on the parts this library targets. Within a class the
/// producer's own order is preserved, since a producer that lists two tiled
/// layouts has a reason for the order it listed them in and this has no better
/// information.
///
/// # What it does not do
///
/// It does not decide anything. A modifier surviving here means only that
/// nothing *known* rules it out: the plane advertises it, the producer can
/// export it, and the rotation does not need a fetch order the layout cannot
/// provide. Bandwidth limits, scaler counts and per-driver rules are not
/// advertised anywhere, so the `TEST_ONLY` commit remains the arbiter and this
/// is a pre-filter that keeps the number of proposals small.
///
/// # Rotation
///
/// Explicit, where the reference defaults it to `Rotate0`. A caller that has
/// not thought about rotation is exactly the caller who should: a 90-degree
/// layer on a linear buffer is refused at commit, and the refusal names
/// neither the rotation nor the modifier.
/// As [`negotiate`], taking the plane's modifiers from a [`FormatTable`] for
/// one `fourcc`.
///
/// The table is what an `IN_FORMATS` blob parses into, so this is the form a
/// caller holding a real plane reaches for.