From patchwork Tue Nov 17 12:10:18 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Keeping X-Patchwork-Id: 7644131 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 9F3B0C05CA for ; Wed, 18 Nov 2015 01:09:11 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id C6E1A205EF for ; Wed, 18 Nov 2015 01:09:10 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 0437A205F3 for ; Wed, 18 Nov 2015 01:09:10 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 6F90489471; Tue, 17 Nov 2015 17:09:07 -0800 (PST) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org X-Greylist: delayed 1208 seconds by postgrey-1.34 at gabe; Tue, 17 Nov 2015 04:30:59 PST Received: from metanate.com (dougal.metanate.com [90.155.101.14]) by gabe.freedesktop.org (Postfix) with ESMTPS id B35596E380 for ; Tue, 17 Nov 2015 04:30:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=simple/simple; d=metanate.com; s=stronger; h=Message-Id:Date:Subject:Cc:To:From; bh=bLfPwBl+rEQd5lScGpPoxJiaMLL7uOxM+mJFy3VN7gY=; b=ryERn/AlfJMKeh3v9/QsqN7dV+SBMSYZN2EVvh4tI51QegjRA8PHjeR9jQVL3afXeyblv8yTMHilOnd6h722rmPZlUJDD9Jq3pSGS4j+7JnUXKDAc63bXUDa50GoCDi7EXcWllaNAlvDVTXHBigaXSnQAgkILrihu4WKM/KucqBxpQSprDShKDYZwyUrXkuKwyP+bMT/Shkhz/kRi301oX5shWjcXyw8FCvoltwHuk6cY6PQBPWdBEMlDN7gBTnGA391cO77zXPWO/HbGoMwtmlw93oKECR5RxOaknsChJ59oG01VyrpTLxqUCE009JmDwz5U2pWD23EpOI2Hyzf/A==; Received: from brian ([192.168.88.1] helo=leela.metanate.com) by shrek.metanate.com with esmtpsa (TLSv1.2:AES128-SHA256:128) (Exim 4.83_RC2) (envelope-from ) id 1Zyf5y-0004R5-OW; Tue, 17 Nov 2015 12:10:46 +0000 From: John Keeping To: David Airlie 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 X-Mailman-Approved-At: Tue, 17 Nov 2015 17:08:56 -0800 Cc: linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Spam-Status: No, score=-4.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,RP_MATCHES_RCVD,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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. */