aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorIvan Molodetskikh <yalterz@gmail.com>2024-03-01 07:55:09 +0400
committerIvan Molodetskikh <yalterz@gmail.com>2024-03-01 07:55:09 +0400
commit202406aadfb710a4c6272c08455007e1a08f800b (patch)
treed1f9df5dca88770dac110e68a6107d1f1b578e2c /src
parent92d9c7ff4fda3b8e10d92e86e5803b0b40886766 (diff)
downloadniri-202406aadfb710a4c6272c08455007e1a08f800b.tar.gz
niri-202406aadfb710a4c6272c08455007e1a08f800b.tar.bz2
niri-202406aadfb710a4c6272c08455007e1a08f800b.zip
Fix presentation feedback panic with zero presentation time
Diffstat (limited to 'src')
-rw-r--r--src/backend/tty.rs17
1 files changed, 9 insertions, 8 deletions
diff --git a/src/backend/tty.rs b/src/backend/tty.rs
index c60dc4a0..01f10fb6 100644
--- a/src/backend/tty.rs
+++ b/src/backend/tty.rs
@@ -956,16 +956,17 @@ impl Tty {
.unwrap_or(Duration::ZERO);
// FIXME: ideally should be monotonically increasing for a surface.
let seq = meta.sequence as u64;
- let flags = wp_presentation_feedback::Kind::Vsync
- | wp_presentation_feedback::Kind::HwClock
+ let mut flags = wp_presentation_feedback::Kind::Vsync
| wp_presentation_feedback::Kind::HwCompletion;
- feedback.presented::<_, smithay::utils::Monotonic>(
- presentation_time,
- refresh,
- seq,
- flags,
- );
+ let time = if presentation_time.is_zero() {
+ now
+ } else {
+ flags.insert(wp_presentation_feedback::Kind::HwClock);
+ presentation_time
+ };
+
+ feedback.presented::<_, smithay::utils::Monotonic>(time, refresh, seq, flags);
if !presentation_time.is_zero() {
let misprediction_s =