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 | 1858 | [[package]] |
| 1859 | 1859 | name = "smithay" |
| 1860 | 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 | 1862 | dependencies = [ |
| 1863 | 1863 | "appendlist", |
| 1864 | 1864 | "bitflags 2.4.0", |
| @@ -1920,7 +1920,7 @@ dependencies = [ | ||
| 1920 | 1920 | [[package]] |
| 1921 | 1921 | name = "smithay-drm-extras" |
| 1922 | 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 | 1924 | dependencies = [ |
| 1925 | 1925 | "drm", |
| 1926 | 1926 | "edid-rs", |
src/backend/tty.rsmodified+9 -14
| @@ -338,9 +338,8 @@ impl Tty { | ||
| 338 | 338 | Ok(Some(mut feedback)) => { |
| 339 | 339 | let refresh = output_state |
| 340 | 340 | .frame_clock |
| 341 | - .refresh_interval_ns() | |
| 342 | - .and_then(|r| u32::try_from(r.get()).ok()) | |
| 343 | - .unwrap_or(0); | |
| 341 | + .refresh_interval() | |
| 342 | + .unwrap_or(Duration::ZERO); | |
| 344 | 343 | // FIXME: ideally should be monotonically increasing for a surface. |
| 345 | 344 | let seq = metadata.as_ref().unwrap().sequence as u64; |
| 346 | 345 | let flags = wp_presentation_feedback::Kind::Vsync |
| @@ -516,19 +515,15 @@ impl Tty { | ||
| 516 | 515 | crtc, |
| 517 | 516 | }); |
| 518 | 517 | |
| 519 | - let mut planes = surface.planes().unwrap(); | |
| 518 | + let mut planes = surface.planes().clone(); | |
| 520 | 519 | // Disable overlay planes as they cause weird performance issues on my system. |
| 521 | 520 | planes.overlay.clear(); |
| 522 | - let scanout_formats = surface | |
| 523 | - .supported_formats(planes.primary.handle) | |
| 524 | - .unwrap() | |
| 525 | - .into_iter() | |
| 526 | - .chain( | |
| 527 | - planes | |
| 528 | - .overlay | |
| 529 | - .iter() | |
| 530 | - .flat_map(|p| surface.supported_formats(p.handle).unwrap()), | |
| 531 | - ) | |
| 521 | + let scanout_formats = planes | |
| 522 | + .primary | |
| 523 | + .formats | |
| 524 | + .iter() | |
| 525 | + .chain(planes.overlay.iter().flat_map(|p| &p.formats)) | |
| 526 | + .copied() | |
| 532 | 527 | .collect::<HashSet<_>>(); |
| 533 | 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 | 143 | self.backend.submit(Some(&damage)).unwrap(); |
| 144 | 144 | |
| 145 | 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 | 148 | presentation_feedbacks.presented::<_, smithay::utils::Monotonic>( |
| 148 | 149 | get_monotonic_time(), |
| 149 | 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 | 28 | self.refresh_interval_ns |
| 29 | + .map(|r| Duration::from_nanos(r.get())) | |
| 29 | 30 | } |
| 30 | 31 | |
| 31 | 32 | pub fn presented(&mut self, presentation_time: Duration) { |