Skip to content

Commit

Permalink
Merge pull request #312 from mahkoh/jorth/old-frame-requests
Browse files Browse the repository at this point in the history
wl_surface: don't request vblank if there are no new frame requests
  • Loading branch information
mahkoh authored Oct 31, 2024
2 parents de75f1e + cccd53b commit f36993e
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/ifs/wl_surface.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(..) {
Expand Down Expand Up @@ -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 {
Expand All @@ -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();
Expand Down

0 comments on commit f36993e

Please sign in to comment.