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]]
name = "smithay"
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 = [
"appendlist",
"bitflags 2.4.0",
@@ -1920,7 +1920,7 @@ dependencies = [
[[package]]
name = "smithay-drm-extras"
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 = [
"drm",
"edid-rs",
+9 -14
View File
@@ -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();
+2 -1
View File
@@ -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,
+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
.map(|r| Duration::from_nanos(r.get()))
}
pub fn presented(&mut self, presentation_time: Duration) {