mirror of
https://github.com/niri-wm/niri.git
synced 2026-06-23 02:05:33 +07:00
Fix refresh passed to presentation feedback
This commit is contained in:
+18
-15
@@ -320,12 +320,27 @@ impl Tty {
|
|||||||
.unwrap()
|
.unwrap()
|
||||||
.message(&message, 0);
|
.message(&message, 0);
|
||||||
|
|
||||||
|
let output = data
|
||||||
|
.state
|
||||||
|
.niri
|
||||||
|
.global_space
|
||||||
|
.outputs()
|
||||||
|
.find(|output| {
|
||||||
|
let tty_state: &TtyOutputState = output.user_data().get().unwrap();
|
||||||
|
tty_state.device_id == device.id && tty_state.crtc == crtc
|
||||||
|
})
|
||||||
|
.unwrap()
|
||||||
|
.clone();
|
||||||
|
let output_state = data.state.niri.output_state.get_mut(&output).unwrap();
|
||||||
|
|
||||||
// Mark the last frame as submitted.
|
// Mark the last frame as submitted.
|
||||||
match surface.compositor.frame_submitted() {
|
match surface.compositor.frame_submitted() {
|
||||||
Ok(Some(mut feedback)) => {
|
Ok(Some(mut feedback)) => {
|
||||||
let refresh =
|
let refresh = output_state
|
||||||
feedback.output().unwrap().current_mode().unwrap().refresh
|
.frame_clock
|
||||||
as u32;
|
.refresh_interval_ns()
|
||||||
|
.and_then(|r| u32::try_from(r.get()).ok())
|
||||||
|
.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
|
||||||
@@ -345,18 +360,6 @@ impl Tty {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let output = data
|
|
||||||
.state
|
|
||||||
.niri
|
|
||||||
.global_space
|
|
||||||
.outputs()
|
|
||||||
.find(|output| {
|
|
||||||
let tty_state: &TtyOutputState = output.user_data().get().unwrap();
|
|
||||||
tty_state.device_id == device.id && tty_state.crtc == crtc
|
|
||||||
})
|
|
||||||
.unwrap()
|
|
||||||
.clone();
|
|
||||||
let output_state = data.state.niri.output_state.get_mut(&output).unwrap();
|
|
||||||
output_state.waiting_for_vblank = false;
|
output_state.waiting_for_vblank = false;
|
||||||
output_state.frame_clock.presented(presentation_time);
|
output_state.frame_clock.presented(presentation_time);
|
||||||
data.state.niri.queue_redraw(output);
|
data.state.niri.queue_redraw(output);
|
||||||
|
|||||||
@@ -24,6 +24,10 @@ impl FrameClock {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn refresh_interval_ns(&self) -> Option<NonZeroU64> {
|
||||||
|
self.refresh_interval_ns
|
||||||
|
}
|
||||||
|
|
||||||
pub fn presented(&mut self, presentation_time: Duration) {
|
pub fn presented(&mut self, presentation_time: Duration) {
|
||||||
if presentation_time.is_zero() {
|
if presentation_time.is_zero() {
|
||||||
// Not interested in these.
|
// Not interested in these.
|
||||||
|
|||||||
Reference in New Issue
Block a user