Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1272098 > unrolled thread

[PATCH] drm/qxl: fix cursor position with non-zero hotspot

Started byJohn Keeping <john@metanate.com>
First post2015-11-18 12:20 +0100
Last post2015-11-18 14:00 +0100
Articles 2 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] drm/qxl: fix cursor position with non-zero hotspot John Keeping <john@metanate.com> - 2015-11-18 12:20 +0100
    Re: [PATCH] drm/qxl: fix cursor position with non-zero hotspot Daniel Vetter <daniel@ffwll.ch> - 2015-11-18 14:00 +0100

#1272098 — [PATCH] drm/qxl: fix cursor position with non-zero hotspot

FromJohn Keeping <john@metanate.com>
Date2015-11-18 12:20 +0100
Subject[PATCH] drm/qxl: fix cursor position with non-zero hotspot
Message-ID<qw8Wl-29z-17@gated-at.bofh.it>
The SPICE protocol considers the position of a cursor to be the location
of its active pixel on the display, so the cursor is drawn with its
top-left corner at "(x - hot_spot_x, y - hot_spot_y)" but the DRM cursor
position gives the location where the top-left corner should be drawn,
with the hotspot being a hint for drivers that need it.

This fixes the location of the window resize cursors when using Fluxbox
with the QXL DRM driver and both the QXL and modesetting X drivers.

Signed-off-by: John Keeping <john@metanate.com>
---
This comes from the discussion in the thread at [1].  My test
environment is using:

    - X.Org X Server 1.17.4
    - xf86-video-qxl 0.1.4
    - spice-gtk3 0.30

[1] http://lists.freedesktop.org/archives/dri-devel/2015-November/thread.html#94650

 drivers/gpu/drm/qxl/qxl_display.c | 13 +++++++++----
 drivers/gpu/drm/qxl/qxl_drv.h     |  2 ++
 2 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/qxl/qxl_display.c b/drivers/gpu/drm/qxl/qxl_display.c
index 183aea1..5edebf4 100644
--- a/drivers/gpu/drm/qxl/qxl_display.c
+++ b/drivers/gpu/drm/qxl/qxl_display.c
@@ -375,10 +375,15 @@ static int qxl_crtc_cursor_set2(struct drm_crtc *crtc,
 
 	qxl_bo_kunmap(user_bo);
 
+	qcrtc->cur_x += qcrtc->hot_spot_x - hot_x;
+	qcrtc->cur_y += qcrtc->hot_spot_y - hot_y;
+	qcrtc->hot_spot_x = hot_x;
+	qcrtc->hot_spot_y = hot_y;
+
 	cmd = (struct qxl_cursor_cmd *)qxl_release_map(qdev, release);
 	cmd->type = QXL_CURSOR_SET;
-	cmd->u.set.position.x = qcrtc->cur_x;
-	cmd->u.set.position.y = qcrtc->cur_y;
+	cmd->u.set.position.x = qcrtc->cur_x + qcrtc->hot_spot_x;
+	cmd->u.set.position.y = qcrtc->cur_y + qcrtc->hot_spot_y;
 
 	cmd->u.set.shape = qxl_bo_physical_address(qdev, cursor_bo, 0);
 
@@ -441,8 +446,8 @@ static int qxl_crtc_cursor_move(struct drm_crtc *crtc,
 
 	cmd = (struct qxl_cursor_cmd *)qxl_release_map(qdev, release);
 	cmd->type = QXL_CURSOR_MOVE;
-	cmd->u.position.x = qcrtc->cur_x;
-	cmd->u.position.y = qcrtc->cur_y;
+	cmd->u.position.x = qcrtc->cur_x + qcrtc->hot_spot_x;
+	cmd->u.position.y = qcrtc->cur_y + qcrtc->hot_spot_y;
 	qxl_release_unmap(qdev, release, &cmd->release_info);
 
 	qxl_push_cursor_ring_release(qdev, release, QXL_CMD_CURSOR, false);
diff --git a/drivers/gpu/drm/qxl/qxl_drv.h b/drivers/gpu/drm/qxl/qxl_drv.h
index 01a8694..3ab9017 100644
--- a/drivers/gpu/drm/qxl/qxl_drv.h
+++ b/drivers/gpu/drm/qxl/qxl_drv.h
@@ -135,6 +135,8 @@ struct qxl_crtc {
 	int index;
 	int cur_x;
 	int cur_y;
+	int hot_spot_x;
+	int hot_spot_y;
 };
 
 struct qxl_output {
-- 
2.6.3.462.gbe2c914

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [next] | [standalone]


#1272135

FromDaniel Vetter <daniel@ffwll.ch>
Date2015-11-18 14:00 +0100
Message-ID<qwav9-2Zg-15@gated-at.bofh.it>
In reply to#1272098
On Wed, Nov 18, 2015 at 11:17:25AM +0000, John Keeping wrote:
> The SPICE protocol considers the position of a cursor to be the location
> of its active pixel on the display, so the cursor is drawn with its
> top-left corner at "(x - hot_spot_x, y - hot_spot_y)" but the DRM cursor
> position gives the location where the top-left corner should be drawn,
> with the hotspot being a hint for drivers that need it.
> 
> This fixes the location of the window resize cursors when using Fluxbox
> with the QXL DRM driver and both the QXL and modesetting X drivers.
> 
> Signed-off-by: John Keeping <john@metanate.com>
> ---
> This comes from the discussion in the thread at [1].  My test
> environment is using:
> 
>     - X.Org X Server 1.17.4
>     - xf86-video-qxl 0.1.4
>     - spice-gtk3 0.30
> 
> [1] http://lists.freedesktop.org/archives/dri-devel/2015-November/thread.html#94650
> 
>  drivers/gpu/drm/qxl/qxl_display.c | 13 +++++++++----
>  drivers/gpu/drm/qxl/qxl_drv.h     |  2 ++
>  2 files changed, 11 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/gpu/drm/qxl/qxl_display.c b/drivers/gpu/drm/qxl/qxl_display.c
> index 183aea1..5edebf4 100644
> --- a/drivers/gpu/drm/qxl/qxl_display.c
> +++ b/drivers/gpu/drm/qxl/qxl_display.c
> @@ -375,10 +375,15 @@ static int qxl_crtc_cursor_set2(struct drm_crtc *crtc,
>  
>  	qxl_bo_kunmap(user_bo);
>  
> +	qcrtc->cur_x += qcrtc->hot_spot_x - hot_x;
> +	qcrtc->cur_y += qcrtc->hot_spot_y - hot_y;
> +	qcrtc->hot_spot_x = hot_x;
> +	qcrtc->hot_spot_y = hot_y;

Yay for the artificial split of the legacy driver interface for cursors.

Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: stable@vger.kernel.org

Dave, can you pls pick this up if you agree?

Thanks, Daniel

> +
>  	cmd = (struct qxl_cursor_cmd *)qxl_release_map(qdev, release);
>  	cmd->type = QXL_CURSOR_SET;
> -	cmd->u.set.position.x = qcrtc->cur_x;
> -	cmd->u.set.position.y = qcrtc->cur_y;
> +	cmd->u.set.position.x = qcrtc->cur_x + qcrtc->hot_spot_x;
> +	cmd->u.set.position.y = qcrtc->cur_y + qcrtc->hot_spot_y;
>  
>  	cmd->u.set.shape = qxl_bo_physical_address(qdev, cursor_bo, 0);
>  
> @@ -441,8 +446,8 @@ static int qxl_crtc_cursor_move(struct drm_crtc *crtc,
>  
>  	cmd = (struct qxl_cursor_cmd *)qxl_release_map(qdev, release);
>  	cmd->type = QXL_CURSOR_MOVE;
> -	cmd->u.position.x = qcrtc->cur_x;
> -	cmd->u.position.y = qcrtc->cur_y;
> +	cmd->u.position.x = qcrtc->cur_x + qcrtc->hot_spot_x;
> +	cmd->u.position.y = qcrtc->cur_y + qcrtc->hot_spot_y;
>  	qxl_release_unmap(qdev, release, &cmd->release_info);
>  
>  	qxl_push_cursor_ring_release(qdev, release, QXL_CMD_CURSOR, false);
> diff --git a/drivers/gpu/drm/qxl/qxl_drv.h b/drivers/gpu/drm/qxl/qxl_drv.h
> index 01a8694..3ab9017 100644
> --- a/drivers/gpu/drm/qxl/qxl_drv.h
> +++ b/drivers/gpu/drm/qxl/qxl_drv.h
> @@ -135,6 +135,8 @@ struct qxl_crtc {
>  	int index;
>  	int cur_x;
>  	int cur_y;
> +	int hot_spot_x;
> +	int hot_spot_y;
>  };
>  
>  struct qxl_output {
> -- 
> 2.6.3.462.gbe2c914
> 

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web