aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIvan Molodetskikh <yalterz@gmail.com>2024-12-13 10:28:25 +0300
committerIvan Molodetskikh <yalterz@gmail.com>2024-12-30 20:12:37 +0300
commit70f96cca0a2b985dcc7298b4a87a2f0819991878 (patch)
treefe23044da3809a96b146c91cf633c0b4738944cf
parent4e357e9659e5aafeec3cdeb18581698716d97a78 (diff)
downloadniri-70f96cca0a2b985dcc7298b4a87a2f0819991878.tar.gz
niri-70f96cca0a2b985dcc7298b4a87a2f0819991878.tar.bz2
niri-70f96cca0a2b985dcc7298b4a87a2f0819991878.zip
Update Smithay (presentation-time v2)
-rw-r--r--Cargo.lock16
-rw-r--r--src/backend/headless.rs3
-rw-r--r--src/backend/tty.rs16
-rw-r--r--src/backend/winit.rs6
-rw-r--r--src/pw_utils.rs2
5 files changed, 25 insertions, 18 deletions
diff --git a/Cargo.lock b/Cargo.lock
index 8ac8b146..863d0874 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -1337,9 +1337,9 @@ dependencies = [
[[package]]
name = "gbm"
-version = "0.16.0"
+version = "0.18.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c724107aa10444b1d2709aae4727c18a33c16b3e15ea8a46cc4ae226c084c88a"
+checksum = "ce852e998d3ca5e4a97014fb31c940dc5ef344ec7d364984525fd11e8a547e6a"
dependencies = [
"bitflags 2.6.0",
"drm",
@@ -1352,9 +1352,9 @@ dependencies = [
[[package]]
name = "gbm-sys"
-version = "0.3.1"
+version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a9cc2f64de9fa707b5c6b2d2f10d7a7e49e845018a9f5685891eb40d3bab2538"
+checksum = "c13a5f2acc785d8fb6bf6b7ab6bfb0ef5dad4f4d97e8e70bb8e470722312f76f"
dependencies = [
"libc",
]
@@ -3093,9 +3093,9 @@ dependencies = [
[[package]]
name = "pixman"
-version = "0.1.0"
+version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d24a24da0bec14f4e43a495c1837a3c358b87532e7fe66bd75c348b89f0451b6"
+checksum = "459d9be014c5e9725153de54b1cacd6f5bbe258aba7daae10e76ca2cda0ad8c2"
dependencies = [
"drm-fourcc",
"paste",
@@ -3727,7 +3727,7 @@ checksum = "b7c388c1b5e93756d0c740965c41e8822f866621d41acbdf6336a6a168f8840c"
[[package]]
name = "smithay"
version = "0.3.0"
-source = "git+https://github.com/Smithay/smithay.git#b8292400ea7d137946099e941bf3985ade3ecf91"
+source = "git+https://github.com/Smithay/smithay.git#c3f3ac8dc0776d47bc50f9a1911b613a56e6e04b"
dependencies = [
"appendlist",
"bitflags 2.6.0",
@@ -3799,7 +3799,7 @@ dependencies = [
[[package]]
name = "smithay-drm-extras"
version = "0.1.0"
-source = "git+https://github.com/Smithay/smithay.git#b8292400ea7d137946099e941bf3985ade3ecf91"
+source = "git+https://github.com/Smithay/smithay.git#c3f3ac8dc0776d47bc50f9a1911b613a56e6e04b"
dependencies = [
"drm",
"libdisplay-info",
diff --git a/src/backend/headless.rs b/src/backend/headless.rs
index 5b8c7428..3c96f731 100644
--- a/src/backend/headless.rs
+++ b/src/backend/headless.rs
@@ -13,6 +13,7 @@ use smithay::backend::renderer::gles::GlesRenderer;
use smithay::output::{Mode, Output, PhysicalProperties, Subpixel};
use smithay::reexports::wayland_protocols::wp::presentation_time::server::wp_presentation_feedback;
use smithay::utils::Size;
+use smithay::wayland::presentation::Refresh;
use super::{IpcOutputMap, OutputId, RenderResult};
use crate::niri::{Niri, RedrawState};
@@ -102,7 +103,7 @@ impl Headless {
let mut presentation_feedbacks = niri.take_presentation_feedbacks(output, &states);
presentation_feedbacks.presented::<_, smithay::utils::Monotonic>(
get_monotonic_time(),
- std::time::Duration::ZERO,
+ Refresh::Unknown,
0,
wp_presentation_feedback::Kind::empty(),
);
diff --git a/src/backend/tty.rs b/src/backend/tty.rs
index b5991d3f..f9b9d33c 100644
--- a/src/backend/tty.rs
+++ b/src/backend/tty.rs
@@ -50,6 +50,7 @@ use smithay::wayland::dmabuf::{DmabufFeedback, DmabufFeedbackBuilder, DmabufGlob
use smithay::wayland::drm_lease::{
DrmLease, DrmLeaseBuilder, DrmLeaseRequest, DrmLeaseState, LeaseRejected,
};
+use smithay::wayland::presentation::Refresh;
use smithay_drm_extras::drm_scanner::{DrmScanEvent, DrmScanner};
use wayland_protocols::wp::linux_dmabuf::zv1::server::zwp_linux_dmabuf_feedback_v1::TrancheFlags;
use wayland_protocols::wp::presentation_time::server::wp_presentation_feedback;
@@ -1233,10 +1234,17 @@ impl Tty {
// Mark the last frame as submitted.
match surface.compositor.frame_submitted() {
Ok(Some((mut feedback, target_presentation_time))) => {
- let refresh = output_state
- .frame_clock
- .refresh_interval()
- .unwrap_or(Duration::ZERO);
+ let refresh = match output_state.frame_clock.refresh_interval() {
+ Some(refresh) => {
+ if output_state.frame_clock.vrr() {
+ Refresh::Variable(refresh)
+ } else {
+ Refresh::Fixed(refresh)
+ }
+ }
+ None => Refresh::Unknown,
+ };
+
// FIXME: ideally should be monotonically increasing for a surface.
let seq = meta.sequence as u64;
let mut flags = wp_presentation_feedback::Kind::Vsync
diff --git a/src/backend/winit.rs b/src/backend/winit.rs
index 500215f7..3472ff3e 100644
--- a/src/backend/winit.rs
+++ b/src/backend/winit.rs
@@ -3,7 +3,6 @@ use std::collections::HashMap;
use std::mem;
use std::rc::Rc;
use std::sync::{Arc, Mutex};
-use std::time::Duration;
use niri_config::{Config, OutputName};
use smithay::backend::allocator::dmabuf::Dmabuf;
@@ -16,6 +15,7 @@ use smithay::reexports::calloop::LoopHandle;
use smithay::reexports::wayland_protocols::wp::presentation_time::server::wp_presentation_feedback;
use smithay::reexports::winit::dpi::LogicalSize;
use smithay::reexports::winit::window::Window;
+use smithay::wayland::presentation::Refresh;
use super::{IpcOutputMap, OutputId, RenderResult};
use crate::niri::{Niri, RedrawState, State};
@@ -216,11 +216,9 @@ impl Winit {
self.backend.submit(Some(damage)).unwrap();
let mut presentation_feedbacks = niri.take_presentation_feedbacks(output, &res.states);
- 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,
+ Refresh::Unknown,
0,
wp_presentation_feedback::Kind::empty(),
);
diff --git a/src/pw_utils.rs b/src/pw_utils.rs
index a68ba9fe..95b7e9c0 100644
--- a/src/pw_utils.rs
+++ b/src/pw_utils.rs
@@ -1027,7 +1027,7 @@ fn allocate_buffer(
.create_buffer_object_with_modifiers2::<()>(w, h, fourcc, modifiers, flags)
.context("error creating GBM buffer object")?;
- let modifier = bo.modifier().unwrap();
+ let modifier = bo.modifier();
let buffer = GbmBuffer::from_bo(bo, false);
Ok((buffer, modifier))
}