aboutsummaryrefslogtreecommitdiff
path: root/sway/desktop
diff options
context:
space:
mode:
authorSimon Ser <contact@emersion.fr>2023-02-22 18:43:20 +0100
committerSimon Zeni <simon@bl4ckb0ne.ca>2023-02-22 13:37:44 -0500
commit16b0afd4331dbd8ed6bb1df49e8309d05f4488dd (patch)
tree732834ef9a90d2585c0f15b915c82e66f4fa63fe /sway/desktop
parentc2ccc0c9d4726a2d1f23f1696c7b6aa0f6cb1a63 (diff)
Check for empty damage before attaching render buffer
Check whether output->damage_ring.current is empty before calling wlr_output_attach_render(). Saves us from having to un-do that via wlr_output_rollback().
Diffstat (limited to 'sway/desktop')
-rw-r--r--sway/desktop/output.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/sway/desktop/output.c b/sway/desktop/output.c
index 4b6e9122..1b9b5e67 100644
--- a/sway/desktop/output.c
+++ b/sway/desktop/output.c
@@ -578,6 +578,11 @@ static int output_repaint_timer_handler(void *data) {
}
}
+ if (!output->wlr_output->needs_frame &&
+ !pixman_region32_not_empty(&output->damage_ring.current)) {
+ return 0;
+ }
+
int buffer_age;
if (!wlr_output_attach_render(output->wlr_output, &buffer_age)) {
return 0;
@@ -586,12 +591,6 @@ static int output_repaint_timer_handler(void *data) {
pixman_region32_t damage;
pixman_region32_init(&damage);
wlr_damage_ring_get_buffer_damage(&output->damage_ring, buffer_age, &damage);
- if (!output->wlr_output->needs_frame &&
- !pixman_region32_not_empty(&output->damage_ring.current)) {
- pixman_region32_fini(&damage);
- wlr_output_rollback(output->wlr_output);
- return 0;
- }
struct timespec now;
clock_gettime(CLOCK_MONOTONIC, &now);