Intel-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Jesse Barnes <jbarnes@virtuousgeek.org>
To: ville.syrjala@linux.intel.com
Cc: intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH 3/7] drm/i915: Add i915_get_crtc_scanline()
Date: Thu, 12 Dec 2013 12:59:23 -0800	[thread overview]
Message-ID: <20131212125923.4baa9504@jbarnes-desktop> (raw)
In-Reply-To: <1382039599-31605-4-git-send-email-ville.syrjala@linux.intel.com>

On Thu, 17 Oct 2013 22:53:15 +0300
ville.syrjala@linux.intel.com wrote:

> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> 
> Refactor the i915_get_crtc_scanoutpos() code a bit to make the
> "negative values during vblank" adjustment optional. For most uses
> the raw scanline number without such adjustments is easier to use.
> 
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> ---
>  drivers/gpu/drm/i915/i915_irq.c  | 46 ++++++++++++++++++++++++++++------------
>  drivers/gpu/drm/i915/intel_drv.h |  1 +
>  2 files changed, 33 insertions(+), 14 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/i915_irq.c b/drivers/gpu/drm/i915/i915_irq.c
> index 6b379de..49bcf4e 100644
> --- a/drivers/gpu/drm/i915/i915_irq.c
> +++ b/drivers/gpu/drm/i915/i915_irq.c
> @@ -646,8 +646,8 @@ static bool intel_pipe_in_vblank(struct drm_device *dev, enum pipe pipe)
>  	}
>  }
>  
> -static int i915_get_crtc_scanoutpos(struct drm_device *dev, int pipe,
> -			     int *vpos, int *hpos)
> +int i915_get_crtc_scanoutpos(struct drm_device *dev, int pipe,
> +			     int *vpos, int *hpos, bool adjust)
>  {
>  	struct drm_i915_private *dev_priv = dev->dev_private;
>  	struct drm_crtc *crtc = dev_priv->pipe_to_crtc_mapping[pipe];
> @@ -704,18 +704,20 @@ static int i915_get_crtc_scanoutpos(struct drm_device *dev, int pipe,
>  		vtotal *= htotal;
>  	}
>  
> -	in_vbl = position >= vbl_start && position < vbl_end;
> +	if (adjust) {
> +		in_vbl = position >= vbl_start && position < vbl_end;
>  
> -	/*
> -	 * While in vblank, position will be negative
> -	 * counting up towards 0 at vbl_end. And outside
> -	 * vblank, position will be positive counting
> -	 * up since vbl_end.
> -	 */
> -	if (position >= vbl_start)
> -		position -= vbl_end;
> -	else
> -		position += vtotal - vbl_end;
> +		/*
> +		 * While in vblank, position will be negative
> +		 * counting up towards 0 at vbl_end. And outside
> +		 * vblank, position will be positive counting
> +		 * up since vbl_end.
> +		 */
> +		if (position >= vbl_start)
> +			position -= vbl_end;
> +		else
> +			position += vtotal - vbl_end;
> +	}
>  
>  	if (IS_GEN2(dev) || IS_G4X(dev) || INTEL_INFO(dev)->gen >= 5) {
>  		*vpos = position;
> @@ -732,6 +734,22 @@ static int i915_get_crtc_scanoutpos(struct drm_device *dev, int pipe,
>  	return ret;
>  }
>  
> +static int i915_get_scanout_position(struct drm_device *dev, int pipe,
> +				     int *vpos, int *hpos)
> +{
> +	return i915_get_crtc_scanoutpos(dev, pipe, vpos, hpos, true);
> +}
> +
> +int i915_get_crtc_scanline(struct drm_crtc *crtc)
> +{
> +	int vpos = 0, hpos = 0;
> +
> +	i915_get_crtc_scanoutpos(crtc->dev, to_intel_crtc(crtc)->pipe,
> +				 &vpos, &hpos, false);
> +
> +	return vpos;
> +}
> +
>  static int i915_get_vblank_timestamp(struct drm_device *dev, int pipe,
>  			      int *max_error,
>  			      struct timeval *vblank_time,
> @@ -3313,7 +3331,7 @@ void intel_irq_init(struct drm_device *dev)
>  
>  	if (drm_core_check_feature(dev, DRIVER_MODESET)) {
>  		dev->driver->get_vblank_timestamp = i915_get_vblank_timestamp;
> -		dev->driver->get_scanout_position = i915_get_crtc_scanoutpos;
> +		dev->driver->get_scanout_position = i915_get_scanout_position;
>  	}
>  
>  	if (IS_VALLEYVIEW(dev)) {
> diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
> index e33f387..7f5f74d 100644
> --- a/drivers/gpu/drm/i915/intel_drv.h
> +++ b/drivers/gpu/drm/i915/intel_drv.h
> @@ -580,6 +580,7 @@ void snb_enable_pm_irq(struct drm_i915_private *dev_priv, uint32_t mask);
>  void snb_disable_pm_irq(struct drm_i915_private *dev_priv, uint32_t mask);
>  void hsw_pc8_disable_interrupts(struct drm_device *dev);
>  void hsw_pc8_restore_interrupts(struct drm_device *dev);
> +int i915_get_crtc_scanline(struct drm_crtc *crtc);
>  
>  
>  /* intel_crt.c */

Reviewed-by: Jesse Barnes <jbarnes@virtuousgeek.org>

-- 
Jesse Barnes, Intel Open Source Technology Center
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

  reply	other threads:[~2013-12-12 20:57 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-17 19:53 [PATCH 0/7] drm/i915: Atomic sprites ville.syrjala
2013-10-17 19:53 ` [PATCH 1/7] drm/i915: Don't disable primary when color keying is used ville.syrjala
2013-12-12 20:56   ` Jesse Barnes
2013-12-12 20:58     ` Daniel Vetter
2013-12-13  8:41       ` Ville Syrjälä
2013-10-17 19:53 ` [PATCH 2/7] drm/i915: Fix non-scaled sprites for ILK ville.syrjala
2013-10-17 20:56   ` Chris Wilson
2013-10-18  7:35     ` Ville Syrjälä
2013-10-17 19:53 ` [PATCH 3/7] drm/i915: Add i915_get_crtc_scanline() ville.syrjala
2013-12-12 20:59   ` Jesse Barnes [this message]
2013-10-17 19:53 ` [PATCH 4/7] drm/i915: Shuffle sprite register writes into a tighter group ville.syrjala
2013-12-12 21:00   ` Jesse Barnes
2013-10-17 19:53 ` [PATCH 5/7] drm/i915: Make sprite updates atomic ville.syrjala
2013-12-12 21:04   ` Jesse Barnes
2013-12-12 21:09   ` Jesse Barnes
2013-10-17 19:53 ` [PATCH 6/7] drm/i915: Perform primary enable/disable atomically with sprite updates ville.syrjala
2013-12-12 21:06   ` Jesse Barnes
2013-10-17 19:53 ` [PATCH 7/7] drm/i915: Add pipe update trace points ville.syrjala
2013-12-12 21:08   ` Jesse Barnes
2013-12-13  8:47     ` Ville Syrjälä

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=20131212125923.4baa9504@jbarnes-desktop \
    --to=jbarnes@virtuousgeek.org \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=ville.syrjala@linux.intel.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox