kms/surface: Only skip cursor updates if the application renders consistently
This commit is contained in:
parent
a2dda33abe
commit
66712009fb
1 changed files with 20 additions and 5 deletions
|
|
@ -11,7 +11,10 @@ use crate::{
|
|||
state::SurfaceDmabufFeedback,
|
||||
utils::prelude::*,
|
||||
wayland::{
|
||||
handlers::screencopy::{submit_buffer, FrameHolder, SessionData},
|
||||
handlers::{
|
||||
compositor::recursive_frame_time_estimation,
|
||||
screencopy::{submit_buffer, FrameHolder, SessionData},
|
||||
},
|
||||
protocols::screencopy::{
|
||||
FailureReason, Frame as ScreencopyFrame, SessionRef as ScreencopySessionRef,
|
||||
},
|
||||
|
|
@ -969,13 +972,24 @@ impl SurfaceThreadState {
|
|||
let mut additional_frame_flags = FrameFlags::empty();
|
||||
let mut remove_frame_flags = FrameFlags::empty();
|
||||
|
||||
let has_active_fullscreen = {
|
||||
let (has_active_fullscreen, fullscreen_drives_refresh_rate) = {
|
||||
let shell = self.shell.read();
|
||||
let output = self.mirroring.as_ref().unwrap_or(&self.output);
|
||||
if let Some((_, workspace)) = shell.workspaces.active(output) {
|
||||
workspace.get_fullscreen().is_some()
|
||||
if let Some(fullscreen_surface) = workspace.get_fullscreen() {
|
||||
const _30_FPS: Duration = Duration::from_nanos(1_000_000_000 / 30);
|
||||
(
|
||||
true,
|
||||
fullscreen_surface.wl_surface().is_some_and(|surface| {
|
||||
recursive_frame_time_estimation(&self.clock, &*surface)
|
||||
.is_some_and(|dur| dur <= _30_FPS)
|
||||
}),
|
||||
)
|
||||
} else {
|
||||
(false, false)
|
||||
}
|
||||
} else {
|
||||
false
|
||||
(false, false)
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -1009,7 +1023,8 @@ impl SurfaceThreadState {
|
|||
anyhow::format_err!("Failed to accumulate elements for rendering: {:?}", err)
|
||||
})?;
|
||||
|
||||
if vrr && has_active_fullscreen && !self.timings.past_min_render_time(&self.clock) {
|
||||
if vrr && fullscreen_drives_refresh_rate && !self.timings.past_min_render_time(&self.clock)
|
||||
{
|
||||
additional_frame_flags |= FrameFlags::SKIP_CURSOR_ONLY_UPDATES;
|
||||
};
|
||||
self.timings.set_vrr(vrr);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue