[RFC weston 10/14] composor-drm: Track cursor_plane with a drm_plane

Daniel Stone daniels at collabora.com
Thu May 21 00:29:07 PDT 2015


Change the type of cursor_plane from a weston_plane (base tracking
structure) to a drm_plane (wrapper containing additional DRM-specific
details).

Except that we don't actually use any of drm_plane's members yet; this
is just a cosmetic rename.

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

diff --git a/src/compositor-drm.c b/src/compositor-drm.c
index 6053c18..af70a28 100644
--- a/src/compositor-drm.c
+++ b/src/compositor-drm.c
@@ -252,7 +252,7 @@ struct drm_output {
 
 	struct gbm_surface *surface;
 	struct gbm_bo *cursor_bo[2];
-	struct weston_plane cursor_plane;
+	struct drm_plane cursor_plane;
 	struct weston_plane fb_plane;
 	struct weston_view *cursor_view;
 	int current_cursor;
@@ -1388,7 +1388,7 @@ drm_output_prepare_cursor_view(struct drm_output *output,
 
 	output->cursor_view = ev;
 
-	return &output->cursor_plane;
+	return &output->cursor_plane.base;
 }
 
 static void
@@ -1439,9 +1439,9 @@ drm_output_set_cursor(struct drm_output *output)
 	buffer = ev->surface->buffer_ref.buffer;
 
 	if (buffer &&
-	    pixman_region32_not_empty(&output->cursor_plane.damage)) {
-		pixman_region32_fini(&output->cursor_plane.damage);
-		pixman_region32_init(&output->cursor_plane.damage);
+	    pixman_region32_not_empty(&output->cursor_plane.base.damage)) {
+		pixman_region32_fini(&output->cursor_plane.base.damage);
+		pixman_region32_init(&output->cursor_plane.base.damage);
 		output->current_cursor ^= 1;
 		bo = output->cursor_bo[output->current_cursor];
 
@@ -1456,14 +1456,14 @@ drm_output_set_cursor(struct drm_output *output)
 
 	x = (ev->geometry.x - output->base.x) * output->base.current_scale;
 	y = (ev->geometry.y - output->base.y) * output->base.current_scale;
-	if (output->cursor_plane.x != x || output->cursor_plane.y != y) {
+	if (output->cursor_plane.base.x != x || output->cursor_plane.base.y != y) {
 		if (drmModeMoveCursor(c->drm.fd, output->crtc_id, x, y)) {
 			weston_log("failed to move cursor: %m\n");
 			c->cursors_are_broken = 1;
 		}
 
-		output->cursor_plane.x = x;
-		output->cursor_plane.y = y;
+		output->cursor_plane.base.x = x;
+		output->cursor_plane.base.y = y;
 	}
 }
 
@@ -1535,7 +1535,7 @@ drm_assign_planes(struct weston_output *output_base)
 					      &ev->transform.boundingbox);
 
 		if (next_plane == primary ||
-		    next_plane == &output->cursor_plane) {
+		    next_plane == &output->cursor_plane.base) {
 			/* cursor plane involves a copy */
 			ev->psf_flags = 0;
 		} else {
@@ -1592,7 +1592,7 @@ drm_output_destroy(struct weston_output *output_base)
 	}
 
 	weston_plane_release(&output->fb_plane);
-	weston_plane_release(&output->cursor_plane);
+	weston_plane_release(&output->cursor_plane.base);
 
 	weston_output_destroy(&output->base);
 
@@ -2579,6 +2579,10 @@ create_output_for_connector(struct drm_compositor *ec,
 			   connector->mmWidth, connector->mmHeight,
 			   transform, scale);
 
+	weston_plane_init(&output->cursor_plane.base, &ec->base, 0, 0);
+	weston_compositor_stack_plane(&ec->base, &output->cursor_plane.base,
+				      NULL);
+
 	if (ec->use_pixman) {
 		if (drm_output_init_pixman(output, ec) < 0) {
 			weston_log("Failed to init output pixman state\n");
@@ -2616,10 +2620,7 @@ create_output_for_connector(struct drm_compositor *ec,
 	output->base.gamma_size = output->original_crtc->gamma_size;
 	output->base.set_gamma = drm_output_set_gamma;
 
-	weston_plane_init(&output->cursor_plane, &ec->base, 0, 0);
 	weston_plane_init(&output->fb_plane, &ec->base, 0, 0);
-
-	weston_compositor_stack_plane(&ec->base, &output->cursor_plane, NULL);
 	weston_compositor_stack_plane(&ec->base, &output->fb_plane,
 				      &ec->base.primary_plane);
 
-- 
2.4.1



More information about the wayland-devel mailing list