From: Zack Rusin <za...@vmware.com>

Atomic modesetting got support for mouse hotspots via the hotspot
properties. Drivers need to create those properties on cursor planes
which require the mouse hotspot coordinates.

Add the code creating hotspot properties and port away from old legacy
hotspot API. The legacy hotspot paths have an implementation that works
with new atomic properties so there's no reason to keep them and it
makes sense to unify both paths.

Signed-off-by: Zack Rusin <za...@vmware.com>
Cc: Dave Airlie <airl...@redhat.com>
Cc: Gerd Hoffmann <kra...@redhat.com>
Cc: Daniel Vetter <dan...@ffwll.ch>
Cc: virtualizat...@lists.linux-foundation.org
Cc: spice-de...@lists.freedesktop.org
---
 drivers/gpu/drm/qxl/qxl_display.c | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/qxl/qxl_display.c 
b/drivers/gpu/drm/qxl/qxl_display.c
index 9a64fa4c7530..4b578f9960cd 100644
--- a/drivers/gpu/drm/qxl/qxl_display.c
+++ b/drivers/gpu/drm/qxl/qxl_display.c
@@ -508,8 +508,8 @@ static int qxl_primary_apply_cursor(struct qxl_device *qdev,
 
        cmd = (struct qxl_cursor_cmd *)qxl_release_map(qdev, release);
        cmd->type = QXL_CURSOR_SET;
-       cmd->u.set.position.x = plane_state->crtc_x + fb->hot_x;
-       cmd->u.set.position.y = plane_state->crtc_y + fb->hot_y;
+       cmd->u.set.position.x = plane_state->crtc_x + plane_state->hotspot_x;
+       cmd->u.set.position.y = plane_state->crtc_y + plane_state->hotspot_y;
 
        cmd->u.set.shape = qxl_bo_physical_address(qdev, qcrtc->cursor_bo, 0);
 
@@ -552,8 +552,8 @@ static int qxl_primary_move_cursor(struct qxl_device *qdev,
 
        cmd = (struct qxl_cursor_cmd *)qxl_release_map(qdev, release);
        cmd->type = QXL_CURSOR_MOVE;
-       cmd->u.position.x = plane_state->crtc_x + fb->hot_x;
-       cmd->u.position.y = plane_state->crtc_y + fb->hot_y;
+       cmd->u.position.x = plane_state->crtc_x + plane_state->hotspot_x;
+       cmd->u.position.y = plane_state->crtc_y + plane_state->hotspot_y;
        qxl_release_unmap(qdev, release, &cmd->release_info);
 
        qxl_release_fence_buffer_objects(release);
@@ -849,8 +849,8 @@ static int qxl_plane_prepare_fb(struct drm_plane *plane,
                struct qxl_bo *old_cursor_bo = qcrtc->cursor_bo;
 
                qcrtc->cursor_bo = qxl_create_cursor(qdev, user_bo,
-                                                    new_state->fb->hot_x,
-                                                    new_state->fb->hot_y);
+                                                    new_state->hotspot_x,
+                                                    new_state->hotspot_y);
                qxl_free_cursor(old_cursor_bo);
        }
 
@@ -1002,6 +1002,7 @@ static int qdev_crtc_init(struct drm_device *dev, int 
crtc_id)
 
        qxl_crtc->index = crtc_id;
        drm_crtc_helper_add(&qxl_crtc->base, &qxl_crtc_helper_funcs);
+       drm_plane_create_hotspot_properties(cursor);
        return 0;
 
 clean_cursor:
-- 
2.34.1

Reply via email to