[PATCH weston] compositor-drm: Don't drop viewported surfaces into the cursor plane

Derek Foreman derekf at osg.samsung.com
Fri Sep 30 18:09:37 UTC 2016


No good can come of this... the cursor plane's constraints are too
heavy to make bothering with this worthwhile.

To see the bug this fixes, set your output scale to 2 and then
launch weston-scaler -s and perform an action that makes the cursor
disappear (such as typing in a weston terminal the cursor is over
top of).

The problem is that we don't implement cropping in the copy to the
cursor bo, and the cursor plane can't scale.  So viewport features
are unimplemented or unimplementable for cursor planes.

Signed-off-by: Derek Foreman <derekf at osg.samsung.com>
---
 libweston/compositor-drm.c | 25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)

diff --git a/libweston/compositor-drm.c b/libweston/compositor-drm.c
index 8319d7c..06be565 100644
--- a/libweston/compositor-drm.c
+++ b/libweston/compositor-drm.c
@@ -1125,6 +1125,29 @@ drm_output_prepare_overlay_view(struct drm_output *output,
 	return &s->plane;
 }
 
+static bool
+viewport_is_cursor_compatible(struct weston_buffer_viewport *viewport)
+{
+	/* While we could technically relax soem of these constraints
+	 * if we implemented cropping in cursor_bo_update, it doesn't
+	 * seem worth the effort.
+	 * It is also possible to more thoroughly test if src and dst
+	 * sizes match when widths aren't -1, but again, likely not
+	 * worth the complexity.
+	 */
+	if (viewport->surface.width != -1)
+		return false;
+	if (wl_fixed_to_int(viewport->buffer.src_x) != 0)
+		return false;
+	if (wl_fixed_to_int(viewport->buffer.src_y) != 0)
+		return false;
+	if (wl_fixed_to_int(viewport->buffer.src_width) != -1)
+		return false;
+	if (viewport->surface.width != -1)
+		return false;
+	return true;
+}
+
 static struct weston_plane *
 drm_output_prepare_cursor_view(struct drm_output *output,
 			       struct weston_view *ev)
@@ -1142,6 +1165,8 @@ drm_output_prepare_cursor_view(struct drm_output *output,
 		return NULL;
 	if (viewport->buffer.scale != output->base.current_scale)
 		return NULL;
+	if (!viewport_is_cursor_compatible(viewport))
+		return NULL;
 	if (output->cursor_view)
 		return NULL;
 	if (ev->output_mask != (1u << output->base.id))
-- 
2.9.3



More information about the wayland-devel mailing list