Update Smithay and fix winit presentation time

This commit is contained in:
Ivan Molodetskikh
2023-09-04 15:09:58 +04:00
parent 9b4a8fed4f
commit 682182f363
4 changed files with 15 additions and 18 deletions
Generated
+2 -2
View File
@@ -1858,7 +1858,7 @@ checksum = "62bb4feee49fdd9f707ef802e22365a35de4b7b299de4763d44bfea899442ff9"
[[package]] [[package]]
name = "smithay" name = "smithay"
version = "0.3.0" version = "0.3.0"
source = "git+https://github.com/YaLTeR/smithay.git?branch=pointer-gestures#07b89166679ae280acff8aff93d0ecbbbbbcef5c" source = "git+https://github.com/YaLTeR/smithay.git?branch=pointer-gestures#6d2e4f9cb25f1846fad5820528f1caa68eff6985"
dependencies = [ dependencies = [
"appendlist", "appendlist",
"bitflags 2.4.0", "bitflags 2.4.0",
@@ -1920,7 +1920,7 @@ dependencies = [
[[package]] [[package]]
name = "smithay-drm-extras" name = "smithay-drm-extras"
version = "0.1.0" version = "0.1.0"
source = "git+https://github.com/YaLTeR/smithay.git?branch=pointer-gestures#07b89166679ae280acff8aff93d0ecbbbbbcef5c" source = "git+https://github.com/YaLTeR/smithay.git?branch=pointer-gestures#6d2e4f9cb25f1846fad5820528f1caa68eff6985"
dependencies = [ dependencies = [
"drm", "drm",
"edid-rs", "edid-rs",
+9 -14
View File
@@ -338,9 +338,8 @@ impl Tty {
Ok(Some(mut feedback)) => { Ok(Some(mut feedback)) => {
let refresh = output_state let refresh = output_state
.frame_clock .frame_clock
.refresh_interval_ns() .refresh_interval()
.and_then(|r| u32::try_from(r.get()).ok()) .unwrap_or(Duration::ZERO);
.unwrap_or(0);
// FIXME: ideally should be monotonically increasing for a surface. // FIXME: ideally should be monotonically increasing for a surface.
let seq = metadata.as_ref().unwrap().sequence as u64; let seq = metadata.as_ref().unwrap().sequence as u64;
let flags = wp_presentation_feedback::Kind::Vsync let flags = wp_presentation_feedback::Kind::Vsync
@@ -516,19 +515,15 @@ impl Tty {
crtc, 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. // Disable overlay planes as they cause weird performance issues on my system.
planes.overlay.clear(); planes.overlay.clear();
let scanout_formats = surface let scanout_formats = planes
.supported_formats(planes.primary.handle) .primary
.unwrap() .formats
.into_iter() .iter()
.chain( .chain(planes.overlay.iter().flat_map(|p| &p.formats))
planes .copied()
.overlay
.iter()
.flat_map(|p| surface.supported_formats(p.handle).unwrap()),
)
.collect::<HashSet<_>>(); .collect::<HashSet<_>>();
let scanout_formats = scanout_formats.intersection(&device.formats).copied(); let scanout_formats = scanout_formats.intersection(&device.formats).copied();
+2 -1
View File
@@ -143,7 +143,8 @@ impl Winit {
self.backend.submit(Some(&damage)).unwrap(); self.backend.submit(Some(&damage)).unwrap();
let mut presentation_feedbacks = niri.take_presentation_feedbacks(output, &res.states); 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>( presentation_feedbacks.presented::<_, smithay::utils::Monotonic>(
get_monotonic_time(), get_monotonic_time(),
refresh, refresh,
+2 -1
View File
@@ -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 self.refresh_interval_ns
.map(|r| Duration::from_nanos(r.get()))
} }
pub fn presented(&mut self, presentation_time: Duration) { pub fn presented(&mut self, presentation_time: Duration) {