drm: Fix hang on zoom

Transforming the scanout damage by the zoom will result in rectangles
outside of the display, and some with negative co-ordinates. This makes
at least some drivers unhappy (tested on vmware), and the page flip fails,
and weston hangs indefinitely.

Clip the damage to the output so we don't fall down.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
diff --git a/libweston/backend-drm/drm.c b/libweston/backend-drm/drm.c
index 9a1a39e..4278770 100644
--- a/libweston/backend-drm/drm.c
+++ b/libweston/backend-drm/drm.c
@@ -415,9 +415,16 @@
 	pixman_region32_copy(&scanout_damage, damage);
 
 	if (output->base.zoom.active) {
+		pixman_region32_t clip;
+
 		weston_matrix_transform_region(&scanout_damage,
 					       &output->base.matrix,
 					       &scanout_damage);
+		pixman_region32_init_rect(&clip, 0, 0,
+					  output->base.width,
+					  output->base.height);
+		pixman_region32_intersect(&scanout_damage, &scanout_damage, &clip);
+		pixman_region32_fini(&clip);
 	} else {
 		pixman_region32_translate(&scanout_damage,
 					  -output->base.x, -output->base.y);