aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/qxl
diff options
context:
space:
mode:
authorJohn Keeping <john@metanate.com>2015-11-18 06:17:25 -0500
committerJani Nikula <jani.nikula@intel.com>2016-03-31 04:09:33 -0400
commitd59a1f71ff1aeda4b4630df92d3ad4e3b1dfc885 (patch)
treeac5a42c6c1e9b6f8c530d9da626dbc3e3a0c6658 /drivers/gpu/drm/qxl
parentf55532a0c0b8bb6148f4e07853b876ef73bc69ca (diff)
drm/qxl: fix cursor position with non-zero hotspot
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> Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch> Cc: stable@vger.kernel.org Link: http://patchwork.freedesktop.org/patch/msgid/1447845445-2116-1-git-send-email-john@metanate.com Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Diffstat (limited to 'drivers/gpu/drm/qxl')
-rw-r--r--drivers/gpu/drm/qxl/qxl_display.c13
-rw-r--r--drivers/gpu/drm/qxl/qxl_drv.h2
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 43e5f503d1c5..030409a3ee4e 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,
375 375
376 qxl_bo_kunmap(user_bo); 376 qxl_bo_kunmap(user_bo);
377 377
378 qcrtc->cur_x += qcrtc->hot_spot_x - hot_x;
379 qcrtc->cur_y += qcrtc->hot_spot_y - hot_y;
380 qcrtc->hot_spot_x = hot_x;
381 qcrtc->hot_spot_y = hot_y;
382
378 cmd = (struct qxl_cursor_cmd *)qxl_release_map(qdev, release); 383 cmd = (struct qxl_cursor_cmd *)qxl_release_map(qdev, release);
379 cmd->type = QXL_CURSOR_SET; 384 cmd->type = QXL_CURSOR_SET;
380 cmd->u.set.position.x = qcrtc->cur_x; 385 cmd->u.set.position.x = qcrtc->cur_x + qcrtc->hot_spot_x;
381 cmd->u.set.position.y = qcrtc->cur_y; 386 cmd->u.set.position.y = qcrtc->cur_y + qcrtc->hot_spot_y;
382 387
383 cmd->u.set.shape = qxl_bo_physical_address(qdev, cursor_bo, 0); 388 cmd->u.set.shape = qxl_bo_physical_address(qdev, cursor_bo, 0);
384 389
@@ -441,8 +446,8 @@ static int qxl_crtc_cursor_move(struct drm_crtc *crtc,
441 446
442 cmd = (struct qxl_cursor_cmd *)qxl_release_map(qdev, release); 447 cmd = (struct qxl_cursor_cmd *)qxl_release_map(qdev, release);
443 cmd->type = QXL_CURSOR_MOVE; 448 cmd->type = QXL_CURSOR_MOVE;
444 cmd->u.position.x = qcrtc->cur_x; 449 cmd->u.position.x = qcrtc->cur_x + qcrtc->hot_spot_x;
445 cmd->u.position.y = qcrtc->cur_y; 450 cmd->u.position.y = qcrtc->cur_y + qcrtc->hot_spot_y;
446 qxl_release_unmap(qdev, release, &cmd->release_info); 451 qxl_release_unmap(qdev, release, &cmd->release_info);
447 452
448 qxl_push_cursor_ring_release(qdev, release, QXL_CMD_CURSOR, false); 453 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 6e6b9b1519b8..3f3897eb458c 100644
--- a/drivers/gpu/drm/qxl/qxl_drv.h
+++ b/drivers/gpu/drm/qxl/qxl_drv.h
@@ -135,6 +135,8 @@ struct qxl_crtc {
135 int index; 135 int index;
136 int cur_x; 136 int cur_x;
137 int cur_y; 137 int cur_y;
138 int hot_spot_x;
139 int hot_spot_y;
138}; 140};
139 141
140struct qxl_output { 142struct qxl_output {