kms: Rely on the compositor to skip empty frames

This commit is contained in:
Victoria Brekenfeld 2024-02-15 13:25:34 +01:00 committed by Victoria Brekenfeld
parent db27fa483d
commit 1c3d45c155

View file

@ -146,8 +146,6 @@ pub struct Surface {
vrr: bool, vrr: bool,
scheduled: bool, scheduled: bool,
pending: bool, pending: bool,
dirty: bool,
last_animation_state: bool,
render_timer_token: Option<RegistrationToken>, render_timer_token: Option<RegistrationToken>,
fps: Fps, fps: Fps,
feedback: HashMap<DrmNode, SurfaceDmabufFeedback>, feedback: HashMap<DrmNode, SurfaceDmabufFeedback>,
@ -516,20 +514,10 @@ impl State {
} }
surface.pending = false; surface.pending = false;
let animations_going = Some((
state.common.shell.animations_going(); surface.output.clone(),
let animation_diff = std::mem::replace( surface.fps.avg_time_to_display(5),
&mut surface.last_animation_state, ))
animations_going,
) != animations_going;
(surface.dirty || animations_going || animation_diff).then(
|| {
(
surface.output.clone(),
surface.fps.avg_time_to_display(5),
)
},
)
} }
Some(Err(err)) => { Some(Err(err)) => {
warn!(?err, "Failed to submit frame."); warn!(?err, "Failed to submit frame.");
@ -1043,8 +1031,6 @@ impl Device {
refresh_rate, refresh_rate,
scheduled: false, scheduled: false,
pending: false, pending: false,
dirty: false,
last_animation_state: false,
render_timer_token: None, render_timer_token: None,
fps: Fps::new(renderer.as_mut()), fps: Fps::new(renderer.as_mut()),
feedback: HashMap::new(), feedback: HashMap::new(),
@ -1396,7 +1382,6 @@ impl KmsState {
if surface.surface.take().is_some() { if surface.surface.take().is_some() {
// just drop it // just drop it
surface.pending = false; surface.pending = false;
surface.dirty = false;
} }
} }
false false
@ -1690,7 +1675,6 @@ impl KmsState {
match result { match result {
Ok(_) => { Ok(_) => {
trace!(?crtc, "Frame pending"); trace!(?crtc, "Frame pending");
surface.dirty = false;
surface.scheduled = false; surface.scheduled = false;
surface.render_timer_token = None; surface.render_timer_token = None;
return TimeoutAction::Drop; return TimeoutAction::Drop;
@ -1724,9 +1708,6 @@ impl KmsState {
} }
}); });
} }
if surface.pending {
surface.dirty = true;
}
} }
} }
Ok(()) Ok(())