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
90
91
92
93
94
95
96
97
98
// SPDX-FileCopyrightText: (c) 2026 Joel Winarske
// SPDX-License-Identifier: MIT
//! Teardown's bounded wait for the flip the last commit armed.
//!
//! Port of `wait_for_armed_flip` from `src/scene/layer_scene.cpp`
//! (`debd061`). Upstream's scene owns the device, so its destructor waits.
//! Here the scene has no device and its `Drop` stays non-blocking
//! (invariant 5); the wait lives with the two types that own both the scene
//! and the descriptor it commits on, [`ScanoutBackend`](crate::ScanoutBackend)
//! and [`DumbScanoutSink`](crate::DumbScanoutSink).
//!
//! It never reads the event queue. Most callers dispatch the flip event
//! themselves, and a teardown that consumed it would take it from them.
//! Instead it watches the CRTC's vblank sequence: once that has moved past
//! the one read right after the commit, the flip has landed. It also polls
//! the queue, without reading it: a driver that completes the flip inside the
//! commit (the SA8155P) has moved the sequence before it is read, and does
//! not move it again until the next commit, so the wait would always run to
//! its bound. The kernel queues the event only once the flip has landed
//! (drm-cxx `42287bd`). A CRTC with no vblank counter at all leaves the
//! queued event as the only thing to watch, and the wait watches it alone.
use AsFd;
use ;
use LayerScene;
/// How long teardown waits before giving up on a CRTC that stopped counting.
const BOUND: Duration = from_millis;
/// How often it looks.
const STEP: Duration = from_millis;
/// What teardown waits on, read right after a real commit that armed a flip.
pub
/// What to wait on, read right after a real commit succeeded.
///
/// `None` when the commit armed no flip.
pub
/// Wait, bounded, for the flip armed at `armed` to land, then tell the scene.
///
/// A no-op when the scene has no flip outstanding, is suspended, or the last
/// commit armed nothing. If the wait gives up, the scene is left believing
/// the flip is outstanding, so its own `Drop` still warns.
pub