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.
diff --git a/src/compositor.h b/src/compositor.h
index 6716bdc..4760993 100644
--- a/src/compositor.h
+++ b/src/compositor.h
@@ -160,7 +160,8 @@
 	int32_t mm_width, mm_height;
 	struct weston_border border;
 	pixman_region32_t region;
-	pixman_region32_t previous_damage;
+	int current_buffer;
+	pixman_region32_t buffer_damage[2];
 	int repaint_needed;
 	int repaint_scheduled;
 	struct weston_output_zoom zoom;