aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Ser <contact@emersion.fr>2019-05-25 20:13:36 +0300
committerDrew DeVault <sir@cmpwn.com>2019-06-07 09:06:11 -0400
commite07ffaa2493eb205d4ff3b3f042c43420e2012fe (patch)
tree1cccd82790580504bc36914a310efd99c402f38f
parent6c659da98b1f66596401d3294abfae49b55493e6 (diff)
output-damage: support direct scan-out
In case direct scan-out is used, we still need to accumulate damage for the render-buffers.
-rw-r--r--types/wlr_output_damage.c23
1 files changed, 18 insertions, 5 deletions
diff --git a/types/wlr_output_damage.c b/types/wlr_output_damage.c
index a129cec8..fe35b563 100644
--- a/types/wlr_output_damage.c
+++ b/types/wlr_output_damage.c
@@ -59,12 +59,25 @@ static void output_handle_commit(struct wl_listener *listener, void *data) {
return;
}
- // same as decrementing, but works on unsigned integers
- output_damage->previous_idx += WLR_OUTPUT_DAMAGE_PREVIOUS_LEN - 1;
- output_damage->previous_idx %= WLR_OUTPUT_DAMAGE_PREVIOUS_LEN;
+ pixman_region32_t *prev;
+ switch (output_damage->output->pending.buffer_type) {
+ case WLR_OUTPUT_STATE_BUFFER_RENDER:
+ // render-buffers have been swapped, rotate the damage
+
+ // same as decrementing, but works on unsigned integers
+ output_damage->previous_idx += WLR_OUTPUT_DAMAGE_PREVIOUS_LEN - 1;
+ output_damage->previous_idx %= WLR_OUTPUT_DAMAGE_PREVIOUS_LEN;
+
+ prev = &output_damage->previous[output_damage->previous_idx];
+ pixman_region32_copy(prev, &output_damage->current);
+ break;
+ case WLR_OUTPUT_STATE_BUFFER_SCANOUT:
+ // accumulate render-buffer damage
+ prev = &output_damage->previous[output_damage->previous_idx];
+ pixman_region32_union(prev, prev, &output_damage->current);
+ break;
+ }
- pixman_region32_copy(&output_damage->previous[output_damage->previous_idx],
- &output_damage->current);
pixman_region32_clear(&output_damage->current);
}