|
1 | 1 | use std::{collections::VecDeque, num::NonZeroU64, time::Duration};
|
2 | 2 |
|
3 | 3 | use smithay::utils::{Clock, Monotonic, Time};
|
4 |
| -use tracing::error; |
| 4 | +use tracing::{debug, error}; |
5 | 5 |
|
6 | 6 | const FRAME_TIME_BUFFER: Duration = Duration::from_millis(1);
|
7 | 7 | const FRAME_TIME_WINDOW: usize = 3;
|
@@ -138,13 +138,20 @@ impl Timings {
|
138 | 138 |
|
139 | 139 | pub fn presented(&mut self, value: Time<Monotonic>) {
|
140 | 140 | if let Some(frame) = self.pending_frame.take() {
|
141 |
| - self.previous_frames.push_back(Frame { |
| 141 | + let new_frame = Frame { |
142 | 142 | render_start: frame.render_start,
|
143 | 143 | render_duration_elements: frame.render_duration_elements.unwrap_or_default(),
|
144 | 144 | render_duration_draw: frame.render_duration_draw.unwrap_or_default(),
|
145 | 145 | presentation_submitted: frame.presentation_submitted.unwrap(),
|
146 | 146 | presentation_presented: value,
|
147 |
| - }); |
| 147 | + }; |
| 148 | + if new_frame.render_start > new_frame.presentation_submitted { |
| 149 | + debug!( |
| 150 | + "frame time overflowed: {}", |
| 151 | + new_frame.frame_time().as_millis() |
| 152 | + ); |
| 153 | + } |
| 154 | + self.previous_frames.push_back(new_frame); |
148 | 155 | while self.previous_frames.len() > Self::WINDOW_SIZE {
|
149 | 156 | self.previous_frames.pop_front();
|
150 | 157 | }
|
|
0 commit comments