[PATCH v2 weston 10/16] compositor-drm: Track all plane types

Daniel Stone daniels at collabora.com
Mon Jun 22 09:25:15 PDT 2015


Retain drm_plane tracking objects for all actual DRM planes when using
universal planes, not just overlay planes.

These are currently unused.

v2: Rename sprite_list to plane_list.

Signed-off-by: Daniel Stone <daniels at collabora.com>
---
 src/compositor-drm.c | 37 +++++++++++++++++++++----------------
 1 file changed, 21 insertions(+), 16 deletions(-)

diff --git a/src/compositor-drm.c b/src/compositor-drm.c
index 09fb3af..d0d419f 100644
--- a/src/compositor-drm.c
+++ b/src/compositor-drm.c
@@ -157,7 +157,7 @@ struct drm_compositor {
 	uint32_t min_height, max_height;
 	int no_addfb2;
 
-	struct wl_list sprite_list;
+	struct wl_list plane_list;
 	int sprites_are_broken;
 	int sprites_hidden;
 
@@ -1043,13 +1043,16 @@ drm_output_repaint(struct weston_output *output_base,
 	/*
 	 * Now, update all the sprite surfaces
 	 */
-	wl_list_for_each(s, &compositor->sprite_list, link) {
+	wl_list_for_each(s, &compositor->plane_list, link) {
 		uint32_t flags = 0, fb_id = 0;
 		drmVBlank vbl = {
 			.request.type = DRM_VBLANK_RELATIVE | DRM_VBLANK_EVENT,
 			.request.sequence = 1,
 		};
 
+		if (s->type != WDRM_PLANE_TYPE_OVERLAY)
+			continue;
+
 		if ((!s->current && !s->next) ||
 		    !drm_plane_crtc_supported(output, s->possible_crtcs))
 			continue;
@@ -1284,10 +1287,13 @@ drm_output_prepare_overlay_view(struct drm_output *output,
 	if (!drm_view_transform_supported(ev))
 		return NULL;
 
-	wl_list_for_each(p, &c->sprite_list, link) {
+	wl_list_for_each(p, &c->plane_list, link) {
 		if (!drm_plane_crtc_supported(output, p->possible_crtcs))
 			continue;
 
+		if (p->type != WDRM_PLANE_TYPE_OVERLAY)
+			continue;
+
 		if (!p->next) {
 			found = 1;
 			break;
@@ -2788,7 +2794,7 @@ drm_plane_create(struct drm_compositor *ec, const drmModePlane *kplane)
 		plane->type = WDRM_PLANE_TYPE_OVERLAY;
 
 	weston_plane_init(&plane->base, &ec->base, 0, 0);
-	wl_list_insert(&ec->sprite_list, &plane->link);
+	wl_list_insert(&ec->plane_list, &plane->link);
 
 	return plane;
 }
@@ -2851,15 +2857,10 @@ create_sprites(struct drm_compositor *ec)
 		if (!drm_plane)
 			continue;
 
-		/* Ignore non-overlay planes for now. */
-		if (drm_plane->type != WDRM_PLANE_TYPE_OVERLAY) {
-			drm_plane_destroy(drm_plane);
-			continue;
-		}
-
-		weston_compositor_stack_plane(&ec->base,
-					      &drm_plane->base,
-					      &ec->base.primary_plane);
+		if (drm_plane->type == WDRM_PLANE_TYPE_OVERLAY)
+			weston_compositor_stack_plane(&ec->base,
+						      &drm_plane->base,
+						      &ec->base.primary_plane);
 	}
 
 	drmModeFreePlaneResources(kplane_res);
@@ -2877,7 +2878,7 @@ destroy_sprites(struct drm_compositor *compositor)
 {
 	struct drm_plane *plane, *next;
 
-	wl_list_for_each_safe(plane, next, &compositor->sprite_list, link)
+	wl_list_for_each_safe(plane, next, &compositor->plane_list, link)
 		drm_plane_destroy(plane);
 }
 
@@ -3147,11 +3148,15 @@ session_notify(struct wl_listener *listener, void *data)
 		output = container_of(ec->base.output_list.next,
 				      struct drm_output, base.link);
 
-		wl_list_for_each(sprite, &ec->sprite_list, link)
+		wl_list_for_each(sprite, &ec->plane_list, link) {
+			if (sprite->type != WDRM_PLANE_TYPE_OVERLAY)
+				continue;
+
 			drmModeSetPlane(ec->drm.fd,
 					sprite->plane_id,
 					output->crtc_id, 0, 0,
 					0, 0, 0, 0, 0, 0, 0, 0);
+		}
 	};
 }
 
@@ -3491,7 +3496,7 @@ drm_compositor_create(struct wl_display *display,
 						  MODIFIER_CTRL | MODIFIER_ALT,
 						  switch_vt_binding, ec);
 
-	wl_list_init(&ec->sprite_list);
+	wl_list_init(&ec->plane_list);
 	create_sprites(ec);
 
 	if (udev_input_init(&ec->input,
-- 
2.4.3



More information about the wayland-devel mailing list