kms: protect against potential overflow of Duration when calculating avg frametime
Also see: https://github.com/Smithay/smithay/pull/1685 Fixes #1062 Co-authored-by: Victoria Brekenfeld <victoria@system76.com>
This commit is contained in:
parent
dbd43d7582
commit
8f40fc7a1b
1 changed files with 1 additions and 1 deletions
|
|
@ -213,7 +213,7 @@ impl Timings {
|
||||||
.rev()
|
.rev()
|
||||||
.take(window)
|
.take(window)
|
||||||
.map(|f| f.frame_time())
|
.map(|f| f.frame_time())
|
||||||
.sum::<Duration>()
|
.try_fold(Duration::ZERO, |acc, x| acc.checked_add(x))?
|
||||||
/ (window.min(self.previous_frames.len()) as u32),
|
/ (window.min(self.previous_frames.len()) as u32),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue