[PATCH weston] compositor-drm: fix hw cursor positioning

Derek Foreman derekf at osg.samsung.com
Fri Nov 27 07:37:11 PST 2015


On 27/11/15 06:20 AM, Pekka Paalanen wrote:
> From: Pekka Paalanen <pekka.paalanen at collabora.co.uk>
> 
> Fix a regression introduced by be428b3825043cbcc676d2526fe6213bea7f676a
> which accidentally removed the global-to-output space conversion.

Sigh.  Yup.

> Signed-off-by: Pekka Paalanen <pekka.paalanen at collabora.co.uk>
> Cc: Derek Foreman <derekf at osg.samsung.com>
> Cc: Daniel Stone <daniels at collabora.com>

Reviewed-by: Derek Foreman <derekf at osg.samsung.com>
Tested-by: Derek Foreman <derekf at osg.samsung.com>

> ---
>  src/compositor-drm.c | 7 +++++++
>  1 file changed, 7 insertions(+)
> 
> Hi Derek,
> 
> if you want to fix this with some matrix stuff instead, that would be
> cool. This fixes my use case at least.

I think what you've done is complete anyway - once rotations or scales
are involved we can't get here (as your comment explains).  That's why I
didn't bother in the first place - seems I forgot about translations
though.  Winning.

Actually, I guess it should be possible to match the display rotation
and scale with the cursor's buffer, so we can use hardware cursors even
on rotated or scaled displays.  I'll probably play with that later, but
an immediate fix is appropriate, so:

Pushed.

Thanks for the quick fix!
Derek
(Who's trying to remember why he didn't follow through with his patch
series to randomize the position of the first display :)

> diff --git a/src/compositor-drm.c b/src/compositor-drm.c
> index 6575847..4f9bbaf 100644
> --- a/src/compositor-drm.c
> +++ b/src/compositor-drm.c
> @@ -1196,6 +1196,13 @@ drm_output_set_cursor(struct drm_output *output)
>  	}
>  
>  	weston_view_to_global_float(ev, 0, 0, &x, &y);
> +
> +	/* From global to output space, output transform is guaranteed to be
> +	 * NORMAL by drm_output_prepare_cursor_view().
> +	 */
> +	x = (x - output->base.x) * output->base.current_scale;
> +	y = (y - output->base.y) * output->base.current_scale;
> +
>  	if (output->cursor_plane.x != x || output->cursor_plane.y != y) {
>  		if (drmModeMoveCursor(b->drm.fd, output->crtc_id, x, y)) {
>  			weston_log("failed to move cursor: %m\n");
> 



More information about the wayland-devel mailing list