compositor-drm: Remove unnecessary picked_scanout variable

e2e80136334f fixed the same issue as df573031d0ba in a different way.
The latter commit (applied earlier in the upstream tree) adds a variable
to assign_planes to keep track of when we successfully assign a view to
the scanout plane, and doesn't call prepare_scanout_view if we have.

The former commit adds this checking inside prepare_scanout_view: if the
pending output state already has a framebuffer assigned to the scanout
plane, we drop out of prepare_scanout_view early. The picked_scanout
variable inside assign_planes can thus be removed.

Signed-off-by: Daniel Stone <>
Reviewed-by: Pekka Paalanen <>
Tested-by: Emre Ucan <>
diff --git a/libweston/compositor-drm.c b/libweston/compositor-drm.c
index c5f971d..2e3cbd9 100644
--- a/libweston/compositor-drm.c
+++ b/libweston/compositor-drm.c
@@ -3099,7 +3099,6 @@
 	struct weston_view *ev;
 	pixman_region32_t surface_overlap, renderer_region;
 	struct weston_plane *primary, *next_plane;
-	bool picked_scanout = false;
 	state = drm_output_state_duplicate(output->state_cur,
@@ -3147,19 +3146,13 @@
 		next_plane = NULL;
-		if (pixman_region32_not_empty(&surface_overlap) || picked_scanout)
+		if (pixman_region32_not_empty(&surface_overlap))
 			next_plane = primary;
 		if (next_plane == NULL)
 			next_plane = drm_output_prepare_cursor_view(state, ev);
-		/* If a higher-stacked view already got assigned to scanout, it's incorrect to
-		 * assign a subsequent (lower-stacked) view to scanout.
-		 */
-		if (next_plane == NULL) {
+		if (next_plane == NULL)
 			next_plane = drm_output_prepare_scanout_view(state, ev);
-			if (next_plane)
-				picked_scanout = true;
-		}
 		if (next_plane == NULL)
 			next_plane = drm_output_prepare_overlay_view(state, ev);