diff options
author | 2023-02-22 18:43:20 +0100 | |
---|---|---|
committer | 2023-02-22 13:37:44 -0500 | |
commit | 16b0afd4331dbd8ed6bb1df49e8309d05f4488dd (patch) | |
tree | 732834ef9a90d2585c0f15b915c82e66f4fa63fe | |
parent | Move output commit out of output_render() (diff) | |
download | sway-16b0afd4331dbd8ed6bb1df49e8309d05f4488dd.tar.gz sway-16b0afd4331dbd8ed6bb1df49e8309d05f4488dd.tar.zst sway-16b0afd4331dbd8ed6bb1df49e8309d05f4488dd.zip |
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().
-rw-r--r-- | sway/desktop/output.c | 11 |
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) { | |||
578 | } | 578 | } |
579 | } | 579 | } |
580 | 580 | ||
581 | if (!output->wlr_output->needs_frame && | ||
582 | !pixman_region32_not_empty(&output->damage_ring.current)) { | ||
583 | return 0; | ||
584 | } | ||
585 | |||
581 | int buffer_age; | 586 | int buffer_age; |
582 | if (!wlr_output_attach_render(output->wlr_output, &buffer_age)) { | 587 | if (!wlr_output_attach_render(output->wlr_output, &buffer_age)) { |
583 | return 0; | 588 | return 0; |
@@ -586,12 +591,6 @@ static int output_repaint_timer_handler(void *data) { | |||
586 | pixman_region32_t damage; | 591 | pixman_region32_t damage; |
587 | pixman_region32_init(&damage); | 592 | pixman_region32_init(&damage); |
588 | wlr_damage_ring_get_buffer_damage(&output->damage_ring, buffer_age, &damage); | 593 | wlr_damage_ring_get_buffer_damage(&output->damage_ring, buffer_age, &damage); |
589 | if (!output->wlr_output->needs_frame && | ||
590 | !pixman_region32_not_empty(&output->damage_ring.current)) { | ||
591 | pixman_region32_fini(&damage); | ||
592 | wlr_output_rollback(output->wlr_output); | ||
593 | return 0; | ||
594 | } | ||
595 | 594 | ||
596 | struct timespec now; | 595 | struct timespec now; |
597 | clock_gettime(CLOCK_MONOTONIC, &now); | 596 | clock_gettime(CLOCK_MONOTONIC, &now); |