summaryrefslogtreecommitdiff
path: root/src/screenshooter.c
diff options
context:
space:
mode:
authorAnder Conselvan de Oliveira <ander.conselvan.de.oliveira@intel.com>2012-09-14 16:12:03 +0300
committerKristian Høgsberg <krh@bitplanet.net>2012-09-14 13:40:08 -0400
commit8ea818fb00aa45fb6e9ff83059778502cef82d1b (patch)
tree72d0d4e681662109388a3c78ba60f43d18ec764d /src/screenshooter.c
parent7bbdffabc7a44e727833253878293e33bcfdab24 (diff)
downloadweston-8ea818fb00aa45fb6e9ff83059778502cef82d1b.tar.gz
compositor: Generalize output previous damage into per buffer damage
This is a more generic fix for the issue solved in 4f521731 where damage obscured by overlays could be lost in one of the output buffers due to rapid move of a surface in an overlay plane. This changes the renderer so it keeps track of the damage in each buffer. Every time a new frame is drawn, the damage of the frame is added to all the buffers and the rendered regions are cleared from the current buffer's damage.
Diffstat (limited to 'src/screenshooter.c')
-rw-r--r--src/screenshooter.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/src/screenshooter.c b/src/screenshooter.c
index ba80ce55..ffcc9706 100644
--- a/src/screenshooter.c
+++ b/src/screenshooter.c
@@ -261,7 +261,7 @@ weston_recorder_frame_notify(struct wl_listener *listener, void *data)
struct weston_output *output = data;
uint32_t msecs = output->frame_time;
pixman_box32_t *r;
- pixman_region32_t damage;
+ pixman_region32_t damage, *previous_damage;
int i, j, k, n, width, height, run, stride;
uint32_t delta, prev, *d, *s, *p, next;
struct {
@@ -270,9 +270,18 @@ weston_recorder_frame_notify(struct wl_listener *listener, void *data)
} header;
struct iovec v[2];
+ /* When recording, this will be exactly the region that was repainted
+ * in this frame. Since overlays are disabled, the whole primary plane
+ * damage is rendered. For the first frame, the whole output will be
+ * damaged and that damage will be added to both buffers causing the
+ * non-current buffer damage to be while output. Rendering will clear
+ * all the damage in the current buffer so in the next frame (when
+ * that is non-current) the only damage left will be the one added
+ * from the primary plane. */
+ previous_damage = &output->buffer_damage[output->current_buffer ^ 1];
+
pixman_region32_init(&damage);
- pixman_region32_intersect(&damage, &output->region,
- &output->previous_damage);
+ pixman_region32_intersect(&damage, &output->region, previous_damage);
r = pixman_region32_rectangles(&damage, &n);
if (n == 0)