Skip to content

Commit 29a6495

Browse files
craftyguyDrakulix
authored andcommitted
kms.timings.presented: print debug msg when frame time is overflowing
Also see: #1062
1 parent 8f40fc7 commit 29a6495

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

src/backend/kms/surface/timings.rs

+10-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use std::{collections::VecDeque, num::NonZeroU64, time::Duration};
22

33
use smithay::utils::{Clock, Monotonic, Time};
4-
use tracing::error;
4+
use tracing::{debug, error};
55

66
const FRAME_TIME_BUFFER: Duration = Duration::from_millis(1);
77
const FRAME_TIME_WINDOW: usize = 3;
@@ -138,13 +138,20 @@ impl Timings {
138138

139139
pub fn presented(&mut self, value: Time<Monotonic>) {
140140
if let Some(frame) = self.pending_frame.take() {
141-
self.previous_frames.push_back(Frame {
141+
let new_frame = Frame {
142142
render_start: frame.render_start,
143143
render_duration_elements: frame.render_duration_elements.unwrap_or_default(),
144144
render_duration_draw: frame.render_duration_draw.unwrap_or_default(),
145145
presentation_submitted: frame.presentation_submitted.unwrap(),
146146
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);
148155
while self.previous_frames.len() > Self::WINDOW_SIZE {
149156
self.previous_frames.pop_front();
150157
}

0 commit comments

Comments
 (0)