1
0
Fork 0
forked from wry/wry

wl_surface: don't request vblank if there are no new frame requests

This commit is contained in:
Julian Orth 2024-10-30 16:49:08 +01:00
parent 388a4d1c94
commit cccd53b12e

View file

@ -1290,11 +1290,11 @@ impl WlSurface {
damage_full = true;
}
}
let has_frame_requests = {
let has_new_frame_requests = pending.frame_request.is_not_empty();
{
let frs = &mut *self.frame_requests.borrow_mut();
frs.append(&mut pending.frame_request);
frs.is_not_empty()
};
}
let has_presentation_feedback = {
let mut fbs = self.presentation_feedback.borrow_mut();
for fb in fbs.drain(..) {
@ -1349,7 +1349,7 @@ impl WlSurface {
}
if self.visible.get() {
let output = self.output.get();
if has_frame_requests {
if has_new_frame_requests {
self.vblank_listener.attach(&output.vblank_event);
}
if has_presentation_feedback || fifo_barrier_set {
@ -1369,10 +1369,10 @@ impl WlSurface {
self.client.state.damage(damage);
} else if pending.has_damage() {
self.apply_damage(pending);
if has_frame_requests {
if has_new_frame_requests {
output.global.connector.damage();
}
} else if has_frame_requests && output.schedule.vrr_enabled() {
} else if has_new_frame_requests && output.schedule.vrr_enabled() {
// Frame requests must be dispatched at the highest possible frame rate.
// Therefore we must trigger a vsync of the output as soon as possible.
let rect = output.global.pos.get();