From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ville =?iso-8859-1?Q?Syrj=E4l=E4?= Subject: Re: [PATCH v2] drm: support hotspot for universal plane cursors Date: Tue, 17 Nov 2015 18:09:23 +0200 Message-ID: <20151117160923.GV4437@intel.com> References: <1447762218-11017-1-git-send-email-john@metanate.com> <1447772734-6480-1-git-send-email-john@metanate.com> <20151117153932.GU4437@intel.com> <20151117155943.1e83b053.john@metanate.com> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: QUOTED-PRINTABLE Return-path: Content-Disposition: inline In-Reply-To: <20151117155943.1e83b053.john@metanate.com> Sender: linux-kernel-owner@vger.kernel.org To: John Keeping Cc: David Airlie , linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org List-Id: dri-devel@lists.freedesktop.org On Tue, Nov 17, 2015 at 03:59:43PM +0000, John Keeping wrote: > On Tue, 17 Nov 2015 17:39:32 +0200, Ville Syrj=E4l=E4 wrote: >=20 > > 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 whe= n > > > the cursor moves. > > >=20 > > > Signed-off-by: John Keeping > > > --- > > > v2: > > > - add kerneldoc for hot_x and hot_y in struct drm_crtc > > >=20 > > > drivers/gpu/drm/drm_crtc.c | 11 +++++++---- > > > include/drm/drm_crtc.h | 6 ++++++ > > > 2 files changed, 13 insertions(+), 4 deletions(-) > > >=20 > > > diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crt= c.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 dr= m > > > framebuffer\n"); return PTR_ERR(fb); > > > } > > > + > > > + crtc->hot_x =3D req->hot_x; > > > + crtc->hot_y =3D req->hot_y; > > > } else { > > > fb =3D NULL; > > > } > > > @@ -2841,11 +2844,11 @@ static int drm_mode_cursor_universal(stru= ct > > > drm_crtc *crtc, } > > > =20 > > > if (req->flags & DRM_MODE_CURSOR_MOVE) { > > > - crtc_x =3D req->x; > > > - crtc_y =3D req->y; > > > + crtc_x =3D req->x - crtc->hot_x; > > > + crtc_y =3D req->y - crtc->hot_y; > > > } else { > > > - crtc_x =3D crtc->cursor_x; > > > - crtc_y =3D crtc->cursor_y; > > > + crtc_x =3D crtc->cursor_x - crtc->hot_x; > > > + crtc_y =3D crtc->cursor_y - crtc->hot_y; =20 > >=20 > > Why does the location of the hotspot affect the plane position? >=20 > hot_{x,y} specify the location of the active pixel within the cursor > plane and cursor_{x,y} specify the location of the active pixel on th= e > display Does it? Impossible to say without docs, or some reference to the canonical implementation. Looking at the logs, I guess qxl was the first to get hotspot support. Unfortunately looking at the qxl driver isn't much help. But at leeast it seems to just pass the x/y and hot_x/y straight through without offsetting anything. > so we need to offset the plane position in order for the active > pixel to be in the correct place. >=20 > > > } > > > =20 > > > 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 univers= al > > > cursor planes > > > * @cursor_y: current y position of the cursor, used for univers= al > > > 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; > > > =20 > > > + /* hotspot of cursor */ > > > + int hot_x; > > > + int hot_y; > > > + > > > bool enabled; > > > =20 > > > /* Requested mode from modesetting. */ > > > --=20 > > > 2.6.3.462.gbe2c914 > > >=20 > > > _______________________________________________ > > > dri-devel mailing list > > > dri-devel@lists.freedesktop.org > > > http://lists.freedesktop.org/mailman/listinfo/dri-devel =20 > >=20 --=20 Ville Syrj=E4l=E4 Intel OTC