Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753541AbbKQPkU (ORCPT ); Tue, 17 Nov 2015 10:40:20 -0500 Received: from mga14.intel.com ([192.55.52.115]:60223 "EHLO mga14.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750867AbbKQPkS (ORCPT ); Tue, 17 Nov 2015 10:40:18 -0500 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.20,308,1444719600"; d="scan'208";a="822245734" Date: Tue, 17 Nov 2015 17:39:32 +0200 From: Ville =?iso-8859-1?Q?Syrj=E4l=E4?= To: John Keeping Cc: David Airlie , linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org Subject: Re: [PATCH v2] drm: support hotspot for universal plane cursors Message-ID: <20151117153932.GU4437@intel.com> References: <1447762218-11017-1-git-send-email-john@metanate.com> <1447772734-6480-1-git-send-email-john@metanate.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <1447772734-6480-1-git-send-email-john@metanate.com> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3111 Lines: 92 On Tue, Nov 17, 2015 at 03:05:34PM +0000, John Keeping wrote: > 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 > --- > v2: > - add kerneldoc for hot_x and hot_y in struct drm_crtc > > drivers/gpu/drm/drm_crtc.c | 11 +++++++---- > include/drm/drm_crtc.h | 6 ++++++ > 2 files changed, 13 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; Why does the location of the hotspot affect the plane position? Naturally there's no documentation in the uapi header for any of this stuff :( Would be nice if the pople excited about documentation would fix that part instead of just focusing on the internal stuff. > } > > if (fb) { > diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h > index 3f0c690..2be4414 100644 > --- a/include/drm/drm_crtc.h > +++ b/include/drm/drm_crtc.h > @@ -404,6 +404,8 @@ struct drm_crtc_funcs { > * @cursor: cursor plane for this CRTC > * @cursor_x: current x position of the cursor, used for universal cursor planes > * @cursor_y: current y position of the cursor, used for universal cursor planes > + * @hot_x: x-coordinate of cursor hotspot, used for universal cursor planes > + * @hot_y: y-coordinate of cursor hotspot, used for universal cursor planes > * @enabled: is this CRTC enabled? > * @mode: current mode timings > * @hwmode: mode timings as programmed to hw regs > @@ -445,6 +447,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.3.462.gbe2c914 > > _______________________________________________ > dri-devel mailing list > dri-devel@lists.freedesktop.org > http://lists.freedesktop.org/mailman/listinfo/dri-devel -- Ville Syrj?l? Intel OTC -- 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/