aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorIvan Molodetskikh <yalterz@gmail.com>2023-09-04 15:09:58 +0400
committerIvan Molodetskikh <yalterz@gmail.com>2023-09-04 15:09:58 +0400
commit682182f3633276cdb27aa7fdc028443ff0aa9e13 (patch)
tree2d59eddd3d0cdda768ae2dca699a05910f7fc955 /src
parent9b4a8fed4f1df129d282cc379e44771278ea13c1 (diff)
downloadniri-682182f3633276cdb27aa7fdc028443ff0aa9e13.tar.gz
niri-682182f3633276cdb27aa7fdc028443ff0aa9e13.tar.bz2
niri-682182f3633276cdb27aa7fdc028443ff0aa9e13.zip
Update Smithay and fix winit presentation time
Diffstat (limited to 'src')
-rw-r--r--src/backend/tty.rs23
-rw-r--r--src/backend/winit.rs3
-rw-r--r--src/frame_clock.rs3
3 files changed, 13 insertions, 16 deletions
diff --git a/src/backend/tty.rs b/src/backend/tty.rs
index 64edd8c2..a3298655 100644
--- a/src/backend/tty.rs
+++ b/src/backend/tty.rs
@@ -338,9 +338,8 @@ impl Tty {
Ok(Some(mut feedback)) => {
let refresh = output_state
.frame_clock
- .refresh_interval_ns()
- .and_then(|r| u32::try_from(r.get()).ok())
- .unwrap_or(0);
+ .refresh_interval()
+ .unwrap_or(Duration::ZERO);
// FIXME: ideally should be monotonically increasing for a surface.
let seq = metadata.as_ref().unwrap().sequence as u64;
let flags = wp_presentation_feedback::Kind::Vsync
@@ -516,19 +515,15 @@ impl Tty {
crtc,
});
- let mut planes = surface.planes().unwrap();
+ let mut planes = surface.planes().clone();
// Disable overlay planes as they cause weird performance issues on my system.
planes.overlay.clear();
- let scanout_formats = surface
- .supported_formats(planes.primary.handle)
- .unwrap()
- .into_iter()
- .chain(
- planes
- .overlay
- .iter()
- .flat_map(|p| surface.supported_formats(p.handle).unwrap()),
- )
+ let scanout_formats = planes
+ .primary
+ .formats
+ .iter()
+ .chain(planes.overlay.iter().flat_map(|p| &p.formats))
+ .copied()
.collect::<HashSet<_>>();
let scanout_formats = scanout_formats.intersection(&device.formats).copied();
diff --git a/src/backend/winit.rs b/src/backend/winit.rs
index dc2e8bc6..be8ec29a 100644
--- a/src/backend/winit.rs
+++ b/src/backend/winit.rs
@@ -143,7 +143,8 @@ impl Winit {
self.backend.submit(Some(&damage)).unwrap();
let mut presentation_feedbacks = niri.take_presentation_feedbacks(output, &res.states);
- let refresh = output.current_mode().unwrap().refresh as u32;
+ let mode = output.current_mode().unwrap();
+ let refresh = Duration::from_secs_f64(1_000f64 / mode.refresh as f64);
presentation_feedbacks.presented::<_, smithay::utils::Monotonic>(
get_monotonic_time(),
refresh,
diff --git a/src/frame_clock.rs b/src/frame_clock.rs
index 61ad9572..f7f55890 100644
--- a/src/frame_clock.rs
+++ b/src/frame_clock.rs
@@ -24,8 +24,9 @@ impl FrameClock {
}
}
- pub fn refresh_interval_ns(&self) -> Option<NonZeroU64> {
+ pub fn refresh_interval(&self) -> Option<Duration> {
self.refresh_interval_ns
+ .map(|r| Duration::from_nanos(r.get()))
}
pub fn presented(&mut self, presentation_time: Duration) {