[PATCH] compositor-drm: Handle cursors on scaled screens

alexl at redhat.com alexl at redhat.com
Tue May 28 08:19:27 PDT 2013


From: Alexander Larsson <alexl at redhat.com>

We fall back to not using the drm cursor any time
the scale differs, or the scaled size is to large.
---
 src/compositor-drm.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/src/compositor-drm.c b/src/compositor-drm.c
index 4222e57..a87cbc3 100644
--- a/src/compositor-drm.c
+++ b/src/compositor-drm.c
@@ -909,6 +909,8 @@ drm_output_prepare_cursor_surface(struct weston_output *output_base,
 		return NULL;
 	if (output->base.transform != WL_OUTPUT_TRANSFORM_NORMAL)
 		return NULL;
+	if (output->base.scale != es->buffer_scale)
+		return NULL;
 	if (output->cursor_surface)
 		return NULL;
 	if (es->output_mask != (1u << output_base->id))
@@ -917,7 +919,7 @@ drm_output_prepare_cursor_surface(struct weston_output *output_base,
 		return NULL;
 	if (es->buffer_ref.buffer == NULL ||
 	    !wl_buffer_is_shm(es->buffer_ref.buffer) ||
-	    es->geometry.width > 64 || es->geometry.height > 64)
+	    es->geometry.width * es->buffer_scale > 64 || es->geometry.height * es->buffer_scale > 64)
 		return NULL;
 
 	output->cursor_surface = es;
@@ -952,9 +954,9 @@ drm_output_set_cursor(struct drm_output *output)
 		memset(buf, 0, sizeof buf);
 		stride = wl_shm_buffer_get_stride(es->buffer_ref.buffer);
 		s = wl_shm_buffer_get_data(es->buffer_ref.buffer);
-		for (i = 0; i < es->geometry.height; i++)
+		for (i = 0; i < es->geometry.height * es->buffer_scale; i++)
 			memcpy(buf + i * 64, s + i * stride,
-			       es->geometry.width * 4);
+			       es->geometry.width * es->buffer_scale * 4);
 
 		if (gbm_bo_write(bo, buf, sizeof buf) < 0)
 			weston_log("failed update cursor: %m\n");
-- 
1.8.1.4



More information about the wayland-devel mailing list