All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: John Keeping <john@metanate.com>
Cc: David Airlie <airlied@linux.ie>,
	linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org
Subject: Re: [PATCH v2] drm: support hotspot for universal plane cursors
Date: Tue, 17 Nov 2015 18:09:23 +0200	[thread overview]
Message-ID: <20151117160923.GV4437@intel.com> (raw)
In-Reply-To: <20151117155943.1e83b053.john@metanate.com>

On Tue, Nov 17, 2015 at 03:59:43PM +0000, John Keeping wrote:
> On Tue, 17 Nov 2015 17:39:32 +0200, Ville Syrjälä wrote:
> 
> > 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 <john@metanate.com>
> > > ---
> > > 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?
> 
> 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 the
> 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.
> 
> > >  	}
> > >  
> > >  	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

  reply	other threads:[~2015-11-17 16:09 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-17 12:10 [PATCH] drm: support hotspot for universal plane cursors John Keeping
2015-11-17 13:13 ` kbuild test robot
2015-11-17 13:13   ` kbuild test robot
2015-11-17 15:05 ` [PATCH v2] " John Keeping
2015-11-17 15:05   ` John Keeping
2015-11-17 15:39   ` Ville Syrjälä
2015-11-17 15:39     ` Ville Syrjälä
2015-11-17 15:59     ` John Keeping
2015-11-17 15:59       ` John Keeping
2015-11-17 16:09       ` Ville Syrjälä [this message]
2015-11-17 16:29       ` Daniel Vetter
2015-11-17 16:29         ` Daniel Vetter
2015-11-17 16:58         ` John Keeping
2015-11-17 16:58           ` John Keeping
2015-11-17 18:40           ` Daniel Vetter
2015-11-17 18:40             ` Daniel Vetter
2015-11-17 19:11             ` Alex Deucher
2015-11-17 19:11               ` Alex Deucher
2015-11-17 17:07         ` Alex Deucher
2015-11-17 17:07           ` Alex Deucher
2015-11-17 18:31           ` Daniel Vetter
2015-11-17 18:31             ` Daniel Vetter
2015-11-17 18:47             ` John Keeping
2015-11-17 18:47               ` John Keeping
2015-11-17 19:11               ` Daniel Vetter
2015-11-17 19:11                 ` Daniel Vetter
2015-11-18 10:12                 ` John Keeping
2015-11-18 10:12                   ` John Keeping
2015-11-18 11:08                   ` Daniel Vetter
2015-11-18 11:08                     ` Daniel Vetter
2015-11-18  8:39         ` Michel Dänzer
2015-11-18  8:39           ` Michel Dänzer
2015-11-18  8:51           ` Daniel Vetter
2015-11-18  8:51             ` Daniel Vetter
2015-11-18  8:59             ` Michel Dänzer
2015-11-18  8:59               ` Michel Dänzer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20151117160923.GV4437@intel.com \
    --to=ville.syrjala@linux.intel.com \
    --cc=airlied@linux.ie \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=john@metanate.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.