When using output scaling a client surface's wicth and height can be smaller than the cursor plane's size, even if its buffer is actually bigger. So check the buffer size rather than the surface size. --- libweston/compositor-drm.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-)
diff --git a/libweston/compositor-drm.c b/libweston/compositor-drm.c index a899213..0913f6c 100644 --- a/libweston/compositor-drm.c +++ b/libweston/compositor-drm.c @@ -1127,6 +1127,7 @@ drm_output_prepare_cursor_view(struct drm_output *output, struct drm_backend *b = to_drm_backend(output->base.compositor); struct weston_buffer_viewport *viewport = &ev->surface->buffer_viewport; struct wl_shm_buffer *shmbuf; + struct weston_buffer *buffer = ev->surface->buffer_ref.buffer; if (ev->transform.enabled && (ev->transform.matrix.type > WESTON_MATRIX_TRANSFORM_TRANSLATE)) @@ -1147,13 +1148,13 @@ drm_output_prepare_cursor_view(struct drm_output *output, return NULL; if (ev->surface->buffer_ref.buffer == NULL) return NULL; - shmbuf = wl_shm_buffer_get(ev->surface->buffer_ref.buffer->resource); + shmbuf = wl_shm_buffer_get(buffer->resource); if (!shmbuf) return NULL; if (wl_shm_buffer_get_format(shmbuf) != WL_SHM_FORMAT_ARGB8888) return NULL; - if (ev->surface->width > b->cursor_width || - ev->surface->height > b->cursor_height) + if (buffer->width > b->cursor_width || + buffer->height > b->cursor_height) return NULL; output->cursor_view = ev; @@ -1180,8 +1181,8 @@ cursor_bo_update(struct drm_backend *b, struct gbm_bo *bo, assert(buffer && buffer->shm_buffer); assert(buffer->shm_buffer == wl_shm_buffer_get(buffer->resource)); - assert(ev->surface->width <= b->cursor_width); - assert(ev->surface->height <= b->cursor_height); + assert(buffer->width <= b->cursor_width); + assert(buffer->height <= b->cursor_height); memset(buf, 0, sizeof buf); stride = wl_shm_buffer_get_stride(buffer->shm_buffer); @@ -1191,7 +1192,7 @@ cursor_bo_update(struct drm_backend *b, struct gbm_bo *bo, for (i = 0; i < ev->surface->height; i++) memcpy(buf + i * b->cursor_width, s + i * stride, - ev->surface->width * 4); + buffer->width * 4); wl_shm_buffer_end_access(buffer->shm_buffer); if (gbm_bo_write(bo, buf, sizeof buf) < 0) @@ -1292,8 +1293,8 @@ drm_assign_planes(struct weston_output *output_base) if (b->use_pixman || (es->buffer_ref.buffer && (!wl_shm_buffer_get(es->buffer_ref.buffer->resource) || - (ev->surface->width <= b->cursor_width && - ev->surface->height <= b->cursor_height)))) + (es->buffer_ref.buffer->width <= b->cursor_width && + es->buffer_ref.buffer->height <= b->cursor_height)))) es->keep_buffer = true; else es->keep_buffer = false; -- 2.10.2 _______________________________________________ wayland-devel mailing list wayland-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/wayland-devel