mirror of
https://github.com/niri-wm/niri.git
synced 2026-06-22 02:01:55 +07:00
frame_clock: Defend against last presentation time being too much in the future
This commit is contained in:
+12
-1
@@ -52,8 +52,19 @@ impl FrameClock {
|
||||
|
||||
if now <= last_presentation_time {
|
||||
// Got an early VBlank.
|
||||
let orig_now = now;
|
||||
now += Duration::from_nanos(refresh_interval_ns);
|
||||
// Assume two-frame early VBlanks don't happen. Overflow checks will catch them.
|
||||
|
||||
if now < last_presentation_time {
|
||||
// Not sure when this can happen.
|
||||
error!(
|
||||
now = ?orig_now,
|
||||
?last_presentation_time,
|
||||
"got a 2+ early VBlank, {:?} until presentation",
|
||||
last_presentation_time - now,
|
||||
);
|
||||
now = last_presentation_time + Duration::from_nanos(refresh_interval_ns);
|
||||
}
|
||||
}
|
||||
|
||||
let since_last = now - last_presentation_time;
|
||||
|
||||
Reference in New Issue
Block a user