Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752817AbbKQMaz (ORCPT ); Tue, 17 Nov 2015 07:30:55 -0500 Received: from dougal.metanate.com ([90.155.101.14]:29849 "EHLO metanate.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752193AbbKQMay (ORCPT ); Tue, 17 Nov 2015 07:30:54 -0500 X-Greylist: delayed 1203 seconds by postgrey-1.27 at vger.kernel.org; Tue, 17 Nov 2015 07:30:53 EST From: John Keeping To: David Airlie Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, John Keeping Subject: [PATCH] drm: support hotspot for universal plane cursors Date: Tue, 17 Nov 2015 12:10:18 +0000 Message-Id: <1447762218-11017-1-git-send-email-john@metanate.com> X-Mailer: git-send-email 2.6.3.462.gbe2c914 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1857 Lines: 64 The request's hot_x and hot_y are set correctly for both DRM_IOCTL_MODE_CURSOR and DRM_IOCTL_MODE_CURSOR2 so we just need to save the values and then apply the offset to the cursor plane when the cursor moves. Signed-off-by: John Keeping --- drivers/gpu/drm/drm_crtc.c | 11 +++++++---- include/drm/drm_crtc.h | 4 ++++ 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c index 720a153..40f5b84 100644 --- a/drivers/gpu/drm/drm_crtc.c +++ b/drivers/gpu/drm/drm_crtc.c @@ -2831,6 +2831,9 @@ static int drm_mode_cursor_universal(struct drm_crtc *crtc, DRM_DEBUG_KMS("failed to wrap cursor buffer in drm framebuffer\n"); return PTR_ERR(fb); } + + crtc->hot_x = req->hot_x; + crtc->hot_y = req->hot_y; } else { fb = NULL; } @@ -2841,11 +2844,11 @@ static int drm_mode_cursor_universal(struct drm_crtc *crtc, } if (req->flags & DRM_MODE_CURSOR_MOVE) { - crtc_x = req->x; - crtc_y = req->y; + crtc_x = req->x - crtc->hot_x; + crtc_y = req->y - crtc->hot_y; } else { - crtc_x = crtc->cursor_x; - crtc_y = crtc->cursor_y; + crtc_x = crtc->cursor_x - crtc->hot_x; + crtc_y = crtc->cursor_y - crtc->hot_y; } if (fb) { diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h index 3f0c690..1420145 100644 --- a/include/drm/drm_crtc.h +++ b/include/drm/drm_crtc.h @@ -445,6 +445,10 @@ struct drm_crtc { int cursor_x; int cursor_y; + /* hotspot of cursor */ + int hot_x; + int hot_y; + bool enabled; /* Requested mode from modesetting. */ -- 2.6.2.400.gcb098da -- 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/