diff mbox

[11/11] drm/i915: Introduce intel_crtc_update_sarea_pos()

Message ID 1351698624-26626-12-git-send-email-ville.syrjala@linux.intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Ville Syrjälä Oct. 31, 2012, 3:50 p.m. UTC
From: Ville Syrjälä <ville.syrjala@linux.intel.com>

Refactor the code that stores the panning x/y position into the sarea.

This also changes the code so that it won't mistakenly update
sareaB_x/y for pipe >= C.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 drivers/gpu/drm/i915/intel_display.c |   43 ++++++++++++++++++++++------------
 1 files changed, 28 insertions(+), 15 deletions(-)

Comments

Jesse Barnes Oct. 31, 2012, 8:27 p.m. UTC | #1
On Wed, 31 Oct 2012 17:50:24 +0200
ville.syrjala@linux.intel.com wrote:

> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> 
> Refactor the code that stores the panning x/y position into the sarea.
> 
> This also changes the code so that it won't mistakenly update
> sareaB_x/y for pipe >= C.
> 
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> ---
>  drivers/gpu/drm/i915/intel_display.c |   43 ++++++++++++++++++++++------------
>  1 files changed, 28 insertions(+), 15 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
> index e75156a..cbc0035 100644
> --- a/drivers/gpu/drm/i915/intel_display.c
> +++ b/drivers/gpu/drm/i915/intel_display.c
> @@ -2195,13 +2195,39 @@ intel_finish_fb(struct drm_framebuffer *old_fb)
>  	return ret;
>  }
>  
> +static void intel_crtc_update_sarea_pos(struct drm_crtc *crtc, int x, int y)
> +{
> +	struct drm_device *dev = crtc->dev;
> +	struct drm_i915_master_private *master_priv;
> +	struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
> +
> +	if (!dev->primary->master)
> +		return;
> +
> +	master_priv = dev->primary->master->driver_priv;
> +	if (!master_priv->sarea_priv)
> +		return;
> +
> +	switch (intel_crtc->pipe) {
> +	case 0:
> +		master_priv->sarea_priv->pipeA_x = x;
> +		master_priv->sarea_priv->pipeA_y = y;
> +		break;
> +	case 1:
> +		master_priv->sarea_priv->pipeB_x = x;
> +		master_priv->sarea_priv->pipeB_y = y;
> +		break;
> +	default:
> +		break;
> +	}
> +}
> +
>  static int
>  intel_pipe_set_base(struct drm_crtc *crtc, int x, int y,
>  		    struct drm_framebuffer *fb)
>  {
>  	struct drm_device *dev = crtc->dev;
>  	struct drm_i915_private *dev_priv = dev->dev_private;
> -	struct drm_i915_master_private *master_priv;
>  	struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
>  	struct drm_framebuffer *old_fb;
>  	int ret;
> @@ -2253,20 +2279,7 @@ intel_pipe_set_base(struct drm_crtc *crtc, int x, int y,
>  	intel_update_fbc(dev);
>  	mutex_unlock(&dev->struct_mutex);
>  
> -	if (!dev->primary->master)
> -		return 0;
> -
> -	master_priv = dev->primary->master->driver_priv;
> -	if (!master_priv->sarea_priv)
> -		return 0;
> -
> -	if (intel_crtc->pipe) {
> -		master_priv->sarea_priv->pipeB_x = x;
> -		master_priv->sarea_priv->pipeB_y = y;
> -	} else {
> -		master_priv->sarea_priv->pipeA_x = x;
> -		master_priv->sarea_priv->pipeA_y = y;
> -	}
> +	intel_crtc_update_sarea_pos(crtc, x, y);
>  
>  	return 0;
>  }

Reviewed-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Daniel Vetter Oct. 31, 2012, 11:02 p.m. UTC | #2
On Wed, Oct 31, 2012 at 01:27:48PM -0700, Jesse Barnes wrote:
> On Wed, 31 Oct 2012 17:50:24 +0200
> ville.syrjala@linux.intel.com wrote:
> 
> > From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> > 
> > Refactor the code that stores the panning x/y position into the sarea.
> > 
> > This also changes the code so that it won't mistakenly update
> > sareaB_x/y for pipe >= C.
> > 
> > Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>

I've slurped in the patches that Jesse reviewed from this series, safe for
the 2nd patch which somehow fails to apply. To be a good maintainer, I've
fixed up a conflict with the sprite offset adjustment code from Damien
though ;-)

Thanks, Daniel

> > ---
> >  drivers/gpu/drm/i915/intel_display.c |   43 ++++++++++++++++++++++------------
> >  1 files changed, 28 insertions(+), 15 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
> > index e75156a..cbc0035 100644
> > --- a/drivers/gpu/drm/i915/intel_display.c
> > +++ b/drivers/gpu/drm/i915/intel_display.c
> > @@ -2195,13 +2195,39 @@ intel_finish_fb(struct drm_framebuffer *old_fb)
> >  	return ret;
> >  }
> >  
> > +static void intel_crtc_update_sarea_pos(struct drm_crtc *crtc, int x, int y)
> > +{
> > +	struct drm_device *dev = crtc->dev;
> > +	struct drm_i915_master_private *master_priv;
> > +	struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
> > +
> > +	if (!dev->primary->master)
> > +		return;
> > +
> > +	master_priv = dev->primary->master->driver_priv;
> > +	if (!master_priv->sarea_priv)
> > +		return;
> > +
> > +	switch (intel_crtc->pipe) {
> > +	case 0:
> > +		master_priv->sarea_priv->pipeA_x = x;
> > +		master_priv->sarea_priv->pipeA_y = y;
> > +		break;
> > +	case 1:
> > +		master_priv->sarea_priv->pipeB_x = x;
> > +		master_priv->sarea_priv->pipeB_y = y;
> > +		break;
> > +	default:
> > +		break;
> > +	}
> > +}
> > +
> >  static int
> >  intel_pipe_set_base(struct drm_crtc *crtc, int x, int y,
> >  		    struct drm_framebuffer *fb)
> >  {
> >  	struct drm_device *dev = crtc->dev;
> >  	struct drm_i915_private *dev_priv = dev->dev_private;
> > -	struct drm_i915_master_private *master_priv;
> >  	struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
> >  	struct drm_framebuffer *old_fb;
> >  	int ret;
> > @@ -2253,20 +2279,7 @@ intel_pipe_set_base(struct drm_crtc *crtc, int x, int y,
> >  	intel_update_fbc(dev);
> >  	mutex_unlock(&dev->struct_mutex);
> >  
> > -	if (!dev->primary->master)
> > -		return 0;
> > -
> > -	master_priv = dev->primary->master->driver_priv;
> > -	if (!master_priv->sarea_priv)
> > -		return 0;
> > -
> > -	if (intel_crtc->pipe) {
> > -		master_priv->sarea_priv->pipeB_x = x;
> > -		master_priv->sarea_priv->pipeB_y = y;
> > -	} else {
> > -		master_priv->sarea_priv->pipeA_x = x;
> > -		master_priv->sarea_priv->pipeA_y = y;
> > -	}
> > +	intel_crtc_update_sarea_pos(crtc, x, y);
> >  
> >  	return 0;
> >  }
> 
> 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
diff mbox

Patch

diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index e75156a..cbc0035 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -2195,13 +2195,39 @@  intel_finish_fb(struct drm_framebuffer *old_fb)
 	return ret;
 }
 
+static void intel_crtc_update_sarea_pos(struct drm_crtc *crtc, int x, int y)
+{
+	struct drm_device *dev = crtc->dev;
+	struct drm_i915_master_private *master_priv;
+	struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
+
+	if (!dev->primary->master)
+		return;
+
+	master_priv = dev->primary->master->driver_priv;
+	if (!master_priv->sarea_priv)
+		return;
+
+	switch (intel_crtc->pipe) {
+	case 0:
+		master_priv->sarea_priv->pipeA_x = x;
+		master_priv->sarea_priv->pipeA_y = y;
+		break;
+	case 1:
+		master_priv->sarea_priv->pipeB_x = x;
+		master_priv->sarea_priv->pipeB_y = y;
+		break;
+	default:
+		break;
+	}
+}
+
 static int
 intel_pipe_set_base(struct drm_crtc *crtc, int x, int y,
 		    struct drm_framebuffer *fb)
 {
 	struct drm_device *dev = crtc->dev;
 	struct drm_i915_private *dev_priv = dev->dev_private;
-	struct drm_i915_master_private *master_priv;
 	struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
 	struct drm_framebuffer *old_fb;
 	int ret;
@@ -2253,20 +2279,7 @@  intel_pipe_set_base(struct drm_crtc *crtc, int x, int y,
 	intel_update_fbc(dev);
 	mutex_unlock(&dev->struct_mutex);
 
-	if (!dev->primary->master)
-		return 0;
-
-	master_priv = dev->primary->master->driver_priv;
-	if (!master_priv->sarea_priv)
-		return 0;
-
-	if (intel_crtc->pipe) {
-		master_priv->sarea_priv->pipeB_x = x;
-		master_priv->sarea_priv->pipeB_y = y;
-	} else {
-		master_priv->sarea_priv->pipeA_x = x;
-		master_priv->sarea_priv->pipeA_y = y;
-	}
+	intel_crtc_update_sarea_pos(crtc, x, y);
 
 	return 0;
 }