Update Smithay and fix winit presentation time
Browse files at this commit682182f3633276cdb27aa7fdc028443ff0aa9e13Parent: 9b4a8fe4 changed files +15 -18
- Cargo.lock +2 -2
- src/backend/tty.rs +9 -14
- src/backend/winit.rs +2 -1
- src/frame_clock.rs +2 -1
Cargo.lockmodified+2 -2
| @@ -1858,7 +1858,7 @@ checksum = "62bb4feee49fdd9f707ef802e22365a35de4b7b299de4763d44bfea899442ff9" | |||
| 1858 | [[package]] | 1858 | [[package]] |
| 1859 | name = "smithay" | 1859 | name = "smithay" |
| 1860 | version = "0.3.0" | 1860 | version = "0.3.0" |
| 1861 | -source = "git+https://github.com/YaLTeR/smithay.git?branch=pointer-gestures#07b89166679ae280acff8aff93d0ecbbbbbcef5c" | 1861 | +source = "git+https://github.com/YaLTeR/smithay.git?branch=pointer-gestures#6d2e4f9cb25f1846fad5820528f1caa68eff6985" |
| 1862 | dependencies = [ | 1862 | dependencies = [ |
| 1863 | "appendlist", | 1863 | "appendlist", |
| 1864 | "bitflags 2.4.0", | 1864 | "bitflags 2.4.0", |
| @@ -1920,7 +1920,7 @@ dependencies = [ | |||
| 1920 | [[package]] | 1920 | [[package]] |
| 1921 | name = "smithay-drm-extras" | 1921 | name = "smithay-drm-extras" |
| 1922 | version = "0.1.0" | 1922 | version = "0.1.0" |
| 1923 | -source = "git+https://github.com/YaLTeR/smithay.git?branch=pointer-gestures#07b89166679ae280acff8aff93d0ecbbbbbcef5c" | 1923 | +source = "git+https://github.com/YaLTeR/smithay.git?branch=pointer-gestures#6d2e4f9cb25f1846fad5820528f1caa68eff6985" |
| 1924 | dependencies = [ | 1924 | dependencies = [ |
| 1925 | "drm", | 1925 | "drm", |
| 1926 | "edid-rs", | 1926 | "edid-rs", |
src/backend/tty.rsmodified+9 -14
| @@ -338,9 +338,8 @@ impl Tty { | |||
| 338 | Ok(Some(mut feedback)) => { | 338 | Ok(Some(mut feedback)) => { |
| 339 | let refresh = output_state | 339 | let refresh = output_state |
| 340 | .frame_clock | 340 | .frame_clock |
| 341 | - .refresh_interval_ns() | 341 | + .refresh_interval() |
| 342 | - .and_then(|r| u32::try_from(r.get()).ok()) | 342 | + .unwrap_or(Duration::ZERO); |
| 343 | - .unwrap_or(0); | ||
| 344 | // FIXME: ideally should be monotonically increasing for a surface. | 343 | // FIXME: ideally should be monotonically increasing for a surface. |
| 345 | let seq = metadata.as_ref().unwrap().sequence as u64; | 344 | let seq = metadata.as_ref().unwrap().sequence as u64; |
| 346 | let flags = wp_presentation_feedback::Kind::Vsync | 345 | let flags = wp_presentation_feedback::Kind::Vsync |
| @@ -516,19 +515,15 @@ impl Tty { | |||
| 516 | crtc, | 515 | crtc, |
| 517 | }); | 516 | }); |
| 518 | 517 | ||
| 519 | - let mut planes = surface.planes().unwrap(); | 518 | + let mut planes = surface.planes().clone(); |
| 520 | // Disable overlay planes as they cause weird performance issues on my system. | 519 | // Disable overlay planes as they cause weird performance issues on my system. |
| 521 | planes.overlay.clear(); | 520 | planes.overlay.clear(); |
| 522 | - let scanout_formats = surface | 521 | + let scanout_formats = planes |
| 523 | - .supported_formats(planes.primary.handle) | 522 | + .primary |
| 524 | - .unwrap() | 523 | + .formats |
| 525 | - .into_iter() | 524 | + .iter() |
| 526 | - .chain( | 525 | + .chain(planes.overlay.iter().flat_map(|p| &p.formats)) |
| 527 | - planes | 526 | + .copied() |
| 528 | - .overlay | ||
| 529 | - .iter() | ||
| 530 | - .flat_map(|p| surface.supported_formats(p.handle).unwrap()), | ||
| 531 | - ) | ||
| 532 | .collect::<HashSet<_>>(); | 527 | .collect::<HashSet<_>>(); |
| 533 | let scanout_formats = scanout_formats.intersection(&device.formats).copied(); | 528 | let scanout_formats = scanout_formats.intersection(&device.formats).copied(); |
| 534 | 529 | ||
src/backend/winit.rsmodified+2 -1
| @@ -143,7 +143,8 @@ impl Winit { | |||
| 143 | self.backend.submit(Some(&damage)).unwrap(); | 143 | self.backend.submit(Some(&damage)).unwrap(); |
| 144 | 144 | ||
| 145 | let mut presentation_feedbacks = niri.take_presentation_feedbacks(output, &res.states); | 145 | let mut presentation_feedbacks = niri.take_presentation_feedbacks(output, &res.states); |
| 146 | - let refresh = output.current_mode().unwrap().refresh as u32; | 146 | + let mode = output.current_mode().unwrap(); |
| 147 | + let refresh = Duration::from_secs_f64(1_000f64 / mode.refresh as f64); | ||
| 147 | presentation_feedbacks.presented::<_, smithay::utils::Monotonic>( | 148 | presentation_feedbacks.presented::<_, smithay::utils::Monotonic>( |
| 148 | get_monotonic_time(), | 149 | get_monotonic_time(), |
| 149 | refresh, | 150 | refresh, |
src/frame_clock.rsmodified+2 -1
| @@ -24,8 +24,9 @@ impl FrameClock { | |||
| 24 | } | 24 | } |
| 25 | } | 25 | } |
| 26 | 26 | ||
| 27 | - pub fn refresh_interval_ns(&self) -> Option<NonZeroU64> { | 27 | + pub fn refresh_interval(&self) -> Option<Duration> { |
| 28 | self.refresh_interval_ns | 28 | self.refresh_interval_ns |
| 29 | + .map(|r| Duration::from_nanos(r.get())) | ||
| 29 | } | 30 | } |
| 30 | 31 | ||
| 31 | pub fn presented(&mut self, presentation_time: Duration) { | 32 | pub fn presented(&mut self, presentation_time: Duration) { |