compositor: damage pending subsurfaces when committing them

When a client changes the subsurfaces state, we need to damage
them so the result is visible. We do that by flagging the surfaces
when the state changes and causing damage when committing the
state. This prevents normal repaints from considering these changes
until a commit has happened, and allows the client to atomically
schedule several changes.

This fixes the subsurface_z_order test, which is now marked as expected
to succeed.

Signed-off-by: Emilio Pozuelo Monfort <emilio.pozuelo@collabora.co.uk>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Micah Fedke <micah.fedke@collabora.co.uk>
diff --git a/libweston/compositor.h b/libweston/compositor.h
index b049c98..08e728a 100644
--- a/libweston/compositor.h
+++ b/libweston/compositor.h
@@ -1235,6 +1235,9 @@
 	struct weston_surface_state cached;
 	struct weston_buffer_reference cached_buffer_ref;
 
+	/* Sub-surface has been reordered; need to apply damage. */
+	bool reordered;
+
 	int synchronized;
 
 	/* Used for constructing the view tree */