compositor, drm: set per-surface Presentation feedback flags

PRESENTATION_FEEDBACK_KIND_ZERO_COPY is a flag that needs to be set for
each surface separately. Some surfaces may be zero-copy (as defined by
Presentation feedback) while some are not.

A complication with Weston is that a surface may have multiple views on
screen. All copies (views) of the surface are required to be zero-copy
for the ZERO_COPY flag to be set.

Backends set per-view feedback flags during the assing_planes hook, and
then Weston core collects the flags from all views of a surface.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Mario Kleiner <mario.kleiner.de@gmail.com>
Tested-by: Mario Kleiner <mario.kleiner.de@gmail.com>
diff --git a/src/compositor-drm.c b/src/compositor-drm.c
index 86adfee..209f2ae 100644
--- a/src/compositor-drm.c
+++ b/src/compositor-drm.c
@@ -1130,11 +1130,24 @@
 			next_plane = drm_output_prepare_overlay_view(output, ev);
 		if (next_plane == NULL)
 			next_plane = primary;
+
 		weston_view_move_to_plane(ev, next_plane);
+
 		if (next_plane == primary)
 			pixman_region32_union(&overlap, &overlap,
 					      &ev->transform.boundingbox);
 
+		if (next_plane == primary ||
+		    next_plane == &output->cursor_plane) {
+			/* cursor plane involves a copy */
+			ev->psf_flags = 0;
+		} else {
+			/* All other planes are a direct scanout of a
+			 * single client buffer.
+			 */
+			ev->psf_flags = PRESENTATION_FEEDBACK_KIND_ZERO_COPY;
+		}
+
 		pixman_region32_fini(&surface_overlap);
 	}
 	pixman_region32_fini(&overlap);