intel-gfx.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] drm/i915: simplify intel_ddi_pll_select()
@ 2017-03-21 21:57 Paulo Zanoni
  2017-03-21 22:16 ` ✓ Fi.CI.BAT: success for " Patchwork
                   ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: Paulo Zanoni @ 2017-03-21 21:57 UTC (permalink / raw)
  To: intel-gfx; +Cc: Paulo Zanoni

Because {hsw,skl,bxt}_ddi_pll_select all pretty much do the same thing
in slightly different ways. Replace everything with a simple copy of
the function and inline it inside intle_ddi_pll_select().

Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
---
 drivers/gpu/drm/i915/intel_ddi.c | 58 +++++-----------------------------------
 1 file changed, 7 insertions(+), 51 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_ddi.c b/drivers/gpu/drm/i915/intel_ddi.c
index d8214ba..bd6fd0b 100644
--- a/drivers/gpu/drm/i915/intel_ddi.c
+++ b/drivers/gpu/drm/i915/intel_ddi.c
@@ -1127,47 +1127,6 @@ void intel_ddi_clock_get(struct intel_encoder *encoder,
 		bxt_ddi_clock_get(encoder, pipe_config);
 }
 
-static bool
-hsw_ddi_pll_select(struct intel_crtc *intel_crtc,
-		   struct intel_crtc_state *crtc_state,
-		   struct intel_encoder *encoder)
-{
-	struct intel_shared_dpll *pll;
-
-	pll = intel_get_shared_dpll(intel_crtc, crtc_state,
-				    encoder);
-	if (!pll)
-		DRM_DEBUG_DRIVER("failed to find PLL for pipe %c\n",
-				 pipe_name(intel_crtc->pipe));
-
-	return pll;
-}
-
-static bool
-skl_ddi_pll_select(struct intel_crtc *intel_crtc,
-		   struct intel_crtc_state *crtc_state,
-		   struct intel_encoder *encoder)
-{
-	struct intel_shared_dpll *pll;
-
-	pll = intel_get_shared_dpll(intel_crtc, crtc_state, encoder);
-	if (pll == NULL) {
-		DRM_DEBUG_DRIVER("failed to find PLL for pipe %c\n",
-				 pipe_name(intel_crtc->pipe));
-		return false;
-	}
-
-	return true;
-}
-
-static bool
-bxt_ddi_pll_select(struct intel_crtc *intel_crtc,
-		   struct intel_crtc_state *crtc_state,
-		   struct intel_encoder *encoder)
-{
-	return !!intel_get_shared_dpll(intel_crtc, crtc_state, encoder);
-}
-
 /*
  * Tries to find a *shared* PLL for the CRTC and store it in
  * intel_crtc->ddi_pll_sel.
@@ -1178,19 +1137,16 @@ bxt_ddi_pll_select(struct intel_crtc *intel_crtc,
 bool intel_ddi_pll_select(struct intel_crtc *intel_crtc,
 			  struct intel_crtc_state *crtc_state)
 {
-	struct drm_i915_private *dev_priv = to_i915(intel_crtc->base.dev);
 	struct intel_encoder *encoder =
 		intel_ddi_get_crtc_new_encoder(crtc_state);
+	struct intel_shared_dpll *pll;
 
-	if (IS_GEN9_BC(dev_priv))
-		return skl_ddi_pll_select(intel_crtc, crtc_state,
-					  encoder);
-	else if (IS_GEN9_LP(dev_priv))
-		return bxt_ddi_pll_select(intel_crtc, crtc_state,
-					  encoder);
-	else
-		return hsw_ddi_pll_select(intel_crtc, crtc_state,
-					  encoder);
+	pll = intel_get_shared_dpll(intel_crtc, crtc_state, encoder);
+	if (!pll)
+		DRM_DEBUG_DRIVER("failed to find PLL for pipe %c\n",
+				  pipe_name(intel_crtc->pipe));
+
+	return pll;
 }
 
 void intel_ddi_set_pipe_settings(const struct intel_crtc_state *crtc_state)
-- 
2.7.4

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* ✓ Fi.CI.BAT: success for drm/i915: simplify intel_ddi_pll_select()
  2017-03-21 21:57 [PATCH] drm/i915: simplify intel_ddi_pll_select() Paulo Zanoni
@ 2017-03-21 22:16 ` Patchwork
  2017-03-21 23:05 ` [PATCH] " Pandiyan, Dhinakaran
  2017-03-22 13:21 ` Ville Syrjälä
  2 siblings, 0 replies; 10+ messages in thread
From: Patchwork @ 2017-03-21 22:16 UTC (permalink / raw)
  To: Paulo Zanoni; +Cc: intel-gfx

== Series Details ==

Series: drm/i915: simplify intel_ddi_pll_select()
URL   : https://patchwork.freedesktop.org/series/21639/
State : success

== Summary ==

Series 21639v1 drm/i915: simplify intel_ddi_pll_select()
https://patchwork.freedesktop.org/api/1.0/series/21639/revisions/1/mbox/

fi-bdw-5557u     total:278  pass:267  dwarn:0   dfail:0   fail:0   skip:11  time: 460s
fi-bsw-n3050     total:278  pass:239  dwarn:0   dfail:0   fail:0   skip:39  time: 584s
fi-bxt-j4205     total:278  pass:259  dwarn:0   dfail:0   fail:0   skip:19  time: 537s
fi-bxt-t5700     total:278  pass:258  dwarn:0   dfail:0   fail:0   skip:20  time: 549s
fi-byt-j1900     total:278  pass:251  dwarn:0   dfail:0   fail:0   skip:27  time: 504s
fi-byt-n2820     total:278  pass:247  dwarn:0   dfail:0   fail:0   skip:31  time: 505s
fi-hsw-4770      total:278  pass:262  dwarn:0   dfail:0   fail:0   skip:16  time: 444s
fi-hsw-4770r     total:278  pass:262  dwarn:0   dfail:0   fail:0   skip:16  time: 440s
fi-ilk-650       total:278  pass:228  dwarn:0   dfail:0   fail:0   skip:50  time: 439s
fi-ivb-3520m     total:278  pass:260  dwarn:0   dfail:0   fail:0   skip:18  time: 516s
fi-ivb-3770      total:278  pass:260  dwarn:0   dfail:0   fail:0   skip:18  time: 486s
fi-kbl-7500u     total:278  pass:260  dwarn:0   dfail:0   fail:0   skip:18  time: 483s
fi-skl-6260u     total:278  pass:268  dwarn:0   dfail:0   fail:0   skip:10  time: 476s
fi-skl-6700hq    total:278  pass:261  dwarn:0   dfail:0   fail:0   skip:17  time: 594s
fi-skl-6700k     total:278  pass:256  dwarn:4   dfail:0   fail:0   skip:18  time: 490s
fi-skl-6770hq    total:278  pass:268  dwarn:0   dfail:0   fail:0   skip:10  time: 517s
fi-snb-2520m     total:278  pass:250  dwarn:0   dfail:0   fail:0   skip:28  time: 559s
fi-snb-2600      total:278  pass:249  dwarn:0   dfail:0   fail:0   skip:29  time: 421s

d17b31b3444ecffa68be0c331a4b20078fd10ccf drm-tip: 2017y-03m-21d-17h-36m-49s UTC integration manifest
f9a09b3 drm/i915: simplify intel_ddi_pll_select()

== Logs ==

For more details see: https://intel-gfx-ci.01.org/CI/Patchwork_4254/
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] drm/i915: simplify intel_ddi_pll_select()
  2017-03-21 21:57 [PATCH] drm/i915: simplify intel_ddi_pll_select() Paulo Zanoni
  2017-03-21 22:16 ` ✓ Fi.CI.BAT: success for " Patchwork
@ 2017-03-21 23:05 ` Pandiyan, Dhinakaran
  2017-03-22 17:33   ` Paulo Zanoni
  2017-03-22 13:21 ` Ville Syrjälä
  2 siblings, 1 reply; 10+ messages in thread
From: Pandiyan, Dhinakaran @ 2017-03-21 23:05 UTC (permalink / raw)
  To: Zanoni, Paulo R; +Cc: intel-gfx@lists.freedesktop.org

On Tue, 2017-03-21 at 18:57 -0300, Paulo Zanoni wrote:
> Because {hsw,skl,bxt}_ddi_pll_select all pretty much do the same thing
> in slightly different ways. Replace everything with a simple copy of
> the function and inline it inside intle_ddi_pll_select().
> 
> Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
> ---
>  drivers/gpu/drm/i915/intel_ddi.c | 58 +++++-----------------------------------
>  1 file changed, 7 insertions(+), 51 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/intel_ddi.c b/drivers/gpu/drm/i915/intel_ddi.c
> index d8214ba..bd6fd0b 100644
> --- a/drivers/gpu/drm/i915/intel_ddi.c
> +++ b/drivers/gpu/drm/i915/intel_ddi.c
> @@ -1127,47 +1127,6 @@ void intel_ddi_clock_get(struct intel_encoder *encoder,
>  		bxt_ddi_clock_get(encoder, pipe_config);
>  }
>  
> -static bool
> -hsw_ddi_pll_select(struct intel_crtc *intel_crtc,
> -		   struct intel_crtc_state *crtc_state,
> -		   struct intel_encoder *encoder)
> -{
> -	struct intel_shared_dpll *pll;
> -
> -	pll = intel_get_shared_dpll(intel_crtc, crtc_state,
> -				    encoder);

I have a related question, not a patch review :) Looks like we care only
about the boolean returned from intel_get_shared_dpll(). Could not find
any caller that uses the returned 'struct intel_shared_dpll *'. Should
it's signature be simply changed to return a bool? 

-DK
> -	if (!pll)
> -		DRM_DEBUG_DRIVER("failed to find PLL for pipe %c\n",
> -				 pipe_name(intel_crtc->pipe));
> -
> -	return pll;
> -}
> -
> -static bool
> -skl_ddi_pll_select(struct intel_crtc *intel_crtc,
> -		   struct intel_crtc_state *crtc_state,
> -		   struct intel_encoder *encoder)
> -{
> -	struct intel_shared_dpll *pll;
> -
> -	pll = intel_get_shared_dpll(intel_crtc, crtc_state, encoder);
> -	if (pll == NULL) {
> -		DRM_DEBUG_DRIVER("failed to find PLL for pipe %c\n",
> -				 pipe_name(intel_crtc->pipe));
> -		return false;
> -	}
> -
> -	return true;
> -}
> -
> -static bool
> -bxt_ddi_pll_select(struct intel_crtc *intel_crtc,
> -		   struct intel_crtc_state *crtc_state,
> -		   struct intel_encoder *encoder)
> -{
> -	return !!intel_get_shared_dpll(intel_crtc, crtc_state, encoder);
> -}
> -
>  /*
>   * Tries to find a *shared* PLL for the CRTC and store it in
>   * intel_crtc->ddi_pll_sel.
> @@ -1178,19 +1137,16 @@ bxt_ddi_pll_select(struct intel_crtc *intel_crtc,
>  bool intel_ddi_pll_select(struct intel_crtc *intel_crtc,
>  			  struct intel_crtc_state *crtc_state)
>  {
> -	struct drm_i915_private *dev_priv = to_i915(intel_crtc->base.dev);
>  	struct intel_encoder *encoder =
>  		intel_ddi_get_crtc_new_encoder(crtc_state);
> +	struct intel_shared_dpll *pll;
>  
> -	if (IS_GEN9_BC(dev_priv))
> -		return skl_ddi_pll_select(intel_crtc, crtc_state,
> -					  encoder);
> -	else if (IS_GEN9_LP(dev_priv))
> -		return bxt_ddi_pll_select(intel_crtc, crtc_state,
> -					  encoder);
> -	else
> -		return hsw_ddi_pll_select(intel_crtc, crtc_state,
> -					  encoder);
> +	pll = intel_get_shared_dpll(intel_crtc, crtc_state, encoder);
> +	if (!pll)
> +		DRM_DEBUG_DRIVER("failed to find PLL for pipe %c\n",
> +				  pipe_name(intel_crtc->pipe));
> +
> +	return pll;
>  }
>  
>  void intel_ddi_set_pipe_settings(const struct intel_crtc_state *crtc_state)

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] drm/i915: simplify intel_ddi_pll_select()
  2017-03-21 21:57 [PATCH] drm/i915: simplify intel_ddi_pll_select() Paulo Zanoni
  2017-03-21 22:16 ` ✓ Fi.CI.BAT: success for " Patchwork
  2017-03-21 23:05 ` [PATCH] " Pandiyan, Dhinakaran
@ 2017-03-22 13:21 ` Ville Syrjälä
  2017-03-22 17:40   ` Paulo Zanoni
  2 siblings, 1 reply; 10+ messages in thread
From: Ville Syrjälä @ 2017-03-22 13:21 UTC (permalink / raw)
  To: Paulo Zanoni; +Cc: intel-gfx

On Tue, Mar 21, 2017 at 06:57:10PM -0300, Paulo Zanoni wrote:
> Because {hsw,skl,bxt}_ddi_pll_select all pretty much do the same thing
> in slightly different ways. Replace everything with a simple copy of
> the function and inline it inside intle_ddi_pll_select().
> 
> Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
> ---
>  drivers/gpu/drm/i915/intel_ddi.c | 58 +++++-----------------------------------
>  1 file changed, 7 insertions(+), 51 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/intel_ddi.c b/drivers/gpu/drm/i915/intel_ddi.c
> index d8214ba..bd6fd0b 100644
> --- a/drivers/gpu/drm/i915/intel_ddi.c
> +++ b/drivers/gpu/drm/i915/intel_ddi.c
> @@ -1127,47 +1127,6 @@ void intel_ddi_clock_get(struct intel_encoder *encoder,
>  		bxt_ddi_clock_get(encoder, pipe_config);
>  }
>  
> -static bool
> -hsw_ddi_pll_select(struct intel_crtc *intel_crtc,
> -		   struct intel_crtc_state *crtc_state,
> -		   struct intel_encoder *encoder)
> -{
> -	struct intel_shared_dpll *pll;
> -
> -	pll = intel_get_shared_dpll(intel_crtc, crtc_state,
> -				    encoder);
> -	if (!pll)
> -		DRM_DEBUG_DRIVER("failed to find PLL for pipe %c\n",
> -				 pipe_name(intel_crtc->pipe));
> -
> -	return pll;
> -}
> -
> -static bool
> -skl_ddi_pll_select(struct intel_crtc *intel_crtc,
> -		   struct intel_crtc_state *crtc_state,
> -		   struct intel_encoder *encoder)
> -{
> -	struct intel_shared_dpll *pll;
> -
> -	pll = intel_get_shared_dpll(intel_crtc, crtc_state, encoder);
> -	if (pll == NULL) {
> -		DRM_DEBUG_DRIVER("failed to find PLL for pipe %c\n",
> -				 pipe_name(intel_crtc->pipe));
> -		return false;
> -	}
> -
> -	return true;
> -}
> -
> -static bool
> -bxt_ddi_pll_select(struct intel_crtc *intel_crtc,
> -		   struct intel_crtc_state *crtc_state,
> -		   struct intel_encoder *encoder)
> -{
> -	return !!intel_get_shared_dpll(intel_crtc, crtc_state, encoder);
> -}
> -
>  /*
>   * Tries to find a *shared* PLL for the CRTC and store it in
>   * intel_crtc->ddi_pll_sel.
> @@ -1178,19 +1137,16 @@ bxt_ddi_pll_select(struct intel_crtc *intel_crtc,
>  bool intel_ddi_pll_select(struct intel_crtc *intel_crtc,
>  			  struct intel_crtc_state *crtc_state)
>  {
> -	struct drm_i915_private *dev_priv = to_i915(intel_crtc->base.dev);
>  	struct intel_encoder *encoder =
>  		intel_ddi_get_crtc_new_encoder(crtc_state);
> +	struct intel_shared_dpll *pll;
>  
> -	if (IS_GEN9_BC(dev_priv))
> -		return skl_ddi_pll_select(intel_crtc, crtc_state,
> -					  encoder);
> -	else if (IS_GEN9_LP(dev_priv))
> -		return bxt_ddi_pll_select(intel_crtc, crtc_state,
> -					  encoder);
> -	else
> -		return hsw_ddi_pll_select(intel_crtc, crtc_state,
> -					  encoder);
> +	pll = intel_get_shared_dpll(intel_crtc, crtc_state, encoder);

I wonder if intel_ddi_pll_select() has any good reason to even exist
anymore. It's just calling this one function, so maybe we should just
call it directly?

> +	if (!pll)
> +		DRM_DEBUG_DRIVER("failed to find PLL for pipe %c\n",
> +				  pipe_name(intel_crtc->pipe));
> +
> +	return pll;

I would probably write 'pll != NULL' for a bit of extra clarity.

Either way
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>

>  }
>  
>  void intel_ddi_set_pipe_settings(const struct intel_crtc_state *crtc_state)
> -- 
> 2.7.4
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx

-- 
Ville Syrjälä
Intel OTC
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] drm/i915: simplify intel_ddi_pll_select()
  2017-03-21 23:05 ` [PATCH] " Pandiyan, Dhinakaran
@ 2017-03-22 17:33   ` Paulo Zanoni
  0 siblings, 0 replies; 10+ messages in thread
From: Paulo Zanoni @ 2017-03-22 17:33 UTC (permalink / raw)
  To: Pandiyan, Dhinakaran; +Cc: intel-gfx@lists.freedesktop.org

Em Ter, 2017-03-21 às 23:05 +0000, Pandiyan, Dhinakaran escreveu:
> On Tue, 2017-03-21 at 18:57 -0300, Paulo Zanoni wrote:
> > 
> > Because {hsw,skl,bxt}_ddi_pll_select all pretty much do the same
> > thing
> > in slightly different ways. Replace everything with a simple copy
> > of
> > the function and inline it inside intle_ddi_pll_select().
> > 
> > Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
> > ---
> >  drivers/gpu/drm/i915/intel_ddi.c | 58 +++++-----------------------
> > ------------
> >  1 file changed, 7 insertions(+), 51 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/i915/intel_ddi.c
> > b/drivers/gpu/drm/i915/intel_ddi.c
> > index d8214ba..bd6fd0b 100644
> > --- a/drivers/gpu/drm/i915/intel_ddi.c
> > +++ b/drivers/gpu/drm/i915/intel_ddi.c
> > @@ -1127,47 +1127,6 @@ void intel_ddi_clock_get(struct
> > intel_encoder *encoder,
> >  		bxt_ddi_clock_get(encoder, pipe_config);
> >  }
> >  
> > -static bool
> > -hsw_ddi_pll_select(struct intel_crtc *intel_crtc,
> > -		   struct intel_crtc_state *crtc_state,
> > -		   struct intel_encoder *encoder)
> > -{
> > -	struct intel_shared_dpll *pll;
> > -
> > -	pll = intel_get_shared_dpll(intel_crtc, crtc_state,
> > -				    encoder);
> 
> I have a related question, not a patch review :) Looks like we care
> only
> about the boolean returned from intel_get_shared_dpll(). Could not
> find
> any caller that uses the returned 'struct intel_shared_dpll *'.
> Should
> it's signature be simply changed to return a bool? 

There are only two callers. It would be possible to change the
signature, although I don't see many benefits from doing it now.

Perhaps it would be better to unify the error handling.

> 
> -DK
> > 
> > -	if (!pll)
> > -		DRM_DEBUG_DRIVER("failed to find PLL for pipe
> > %c\n",
> > -				 pipe_name(intel_crtc->pipe));
> > -
> > -	return pll;
> > -}
> > -
> > -static bool
> > -skl_ddi_pll_select(struct intel_crtc *intel_crtc,
> > -		   struct intel_crtc_state *crtc_state,
> > -		   struct intel_encoder *encoder)
> > -{
> > -	struct intel_shared_dpll *pll;
> > -
> > -	pll = intel_get_shared_dpll(intel_crtc, crtc_state,
> > encoder);
> > -	if (pll == NULL) {
> > -		DRM_DEBUG_DRIVER("failed to find PLL for pipe
> > %c\n",
> > -				 pipe_name(intel_crtc->pipe));
> > -		return false;
> > -	}
> > -
> > -	return true;
> > -}
> > -
> > -static bool
> > -bxt_ddi_pll_select(struct intel_crtc *intel_crtc,
> > -		   struct intel_crtc_state *crtc_state,
> > -		   struct intel_encoder *encoder)
> > -{
> > -	return !!intel_get_shared_dpll(intel_crtc, crtc_state,
> > encoder);
> > -}
> > -
> >  /*
> >   * Tries to find a *shared* PLL for the CRTC and store it in
> >   * intel_crtc->ddi_pll_sel.
> > @@ -1178,19 +1137,16 @@ bxt_ddi_pll_select(struct intel_crtc
> > *intel_crtc,
> >  bool intel_ddi_pll_select(struct intel_crtc *intel_crtc,
> >  			  struct intel_crtc_state *crtc_state)
> >  {
> > -	struct drm_i915_private *dev_priv = to_i915(intel_crtc-
> > >base.dev);
> >  	struct intel_encoder *encoder =
> >  		intel_ddi_get_crtc_new_encoder(crtc_state);
> > +	struct intel_shared_dpll *pll;
> >  
> > -	if (IS_GEN9_BC(dev_priv))
> > -		return skl_ddi_pll_select(intel_crtc, crtc_state,
> > -					  encoder);
> > -	else if (IS_GEN9_LP(dev_priv))
> > -		return bxt_ddi_pll_select(intel_crtc, crtc_state,
> > -					  encoder);
> > -	else
> > -		return hsw_ddi_pll_select(intel_crtc, crtc_state,
> > -					  encoder);
> > +	pll = intel_get_shared_dpll(intel_crtc, crtc_state,
> > encoder);
> > +	if (!pll)
> > +		DRM_DEBUG_DRIVER("failed to find PLL for pipe
> > %c\n",
> > +				  pipe_name(intel_crtc->pipe));
> > +
> > +	return pll;
> >  }
> >  
> >  void intel_ddi_set_pipe_settings(const struct intel_crtc_state
> > *crtc_state)
> 
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] drm/i915: simplify intel_ddi_pll_select()
  2017-03-22 13:21 ` Ville Syrjälä
@ 2017-03-22 17:40   ` Paulo Zanoni
  2017-03-22 17:50     ` Ville Syrjälä
  0 siblings, 1 reply; 10+ messages in thread
From: Paulo Zanoni @ 2017-03-22 17:40 UTC (permalink / raw)
  To: Ville Syrjälä; +Cc: intel-gfx

Em Qua, 2017-03-22 às 15:21 +0200, Ville Syrjälä escreveu:
> On Tue, Mar 21, 2017 at 06:57:10PM -0300, Paulo Zanoni wrote:
> > 
> > Because {hsw,skl,bxt}_ddi_pll_select all pretty much do the same
> > thing
> > in slightly different ways. Replace everything with a simple copy
> > of
> > the function and inline it inside intle_ddi_pll_select().
> > 
> > Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
> > ---
> >  drivers/gpu/drm/i915/intel_ddi.c | 58 +++++-----------------------
> > ------------
> >  1 file changed, 7 insertions(+), 51 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/i915/intel_ddi.c
> > b/drivers/gpu/drm/i915/intel_ddi.c
> > index d8214ba..bd6fd0b 100644
> > --- a/drivers/gpu/drm/i915/intel_ddi.c
> > +++ b/drivers/gpu/drm/i915/intel_ddi.c
> > @@ -1127,47 +1127,6 @@ void intel_ddi_clock_get(struct
> > intel_encoder *encoder,
> >  		bxt_ddi_clock_get(encoder, pipe_config);
> >  }
> >  
> > -static bool
> > -hsw_ddi_pll_select(struct intel_crtc *intel_crtc,
> > -		   struct intel_crtc_state *crtc_state,
> > -		   struct intel_encoder *encoder)
> > -{
> > -	struct intel_shared_dpll *pll;
> > -
> > -	pll = intel_get_shared_dpll(intel_crtc, crtc_state,
> > -				    encoder);
> > -	if (!pll)
> > -		DRM_DEBUG_DRIVER("failed to find PLL for pipe
> > %c\n",
> > -				 pipe_name(intel_crtc->pipe));
> > -
> > -	return pll;
> > -}
> > -
> > -static bool
> > -skl_ddi_pll_select(struct intel_crtc *intel_crtc,
> > -		   struct intel_crtc_state *crtc_state,
> > -		   struct intel_encoder *encoder)
> > -{
> > -	struct intel_shared_dpll *pll;
> > -
> > -	pll = intel_get_shared_dpll(intel_crtc, crtc_state,
> > encoder);
> > -	if (pll == NULL) {
> > -		DRM_DEBUG_DRIVER("failed to find PLL for pipe
> > %c\n",
> > -				 pipe_name(intel_crtc->pipe));
> > -		return false;
> > -	}
> > -
> > -	return true;
> > -}
> > -
> > -static bool
> > -bxt_ddi_pll_select(struct intel_crtc *intel_crtc,
> > -		   struct intel_crtc_state *crtc_state,
> > -		   struct intel_encoder *encoder)
> > -{
> > -	return !!intel_get_shared_dpll(intel_crtc, crtc_state,
> > encoder);
> > -}
> > -
> >  /*
> >   * Tries to find a *shared* PLL for the CRTC and store it in
> >   * intel_crtc->ddi_pll_sel.
> > @@ -1178,19 +1137,16 @@ bxt_ddi_pll_select(struct intel_crtc
> > *intel_crtc,
> >  bool intel_ddi_pll_select(struct intel_crtc *intel_crtc,
> >  			  struct intel_crtc_state *crtc_state)
> >  {
> > -	struct drm_i915_private *dev_priv = to_i915(intel_crtc-
> > >base.dev);
> >  	struct intel_encoder *encoder =
> >  		intel_ddi_get_crtc_new_encoder(crtc_state);
> > +	struct intel_shared_dpll *pll;
> >  
> > -	if (IS_GEN9_BC(dev_priv))
> > -		return skl_ddi_pll_select(intel_crtc, crtc_state,
> > -					  encoder);
> > -	else if (IS_GEN9_LP(dev_priv))
> > -		return bxt_ddi_pll_select(intel_crtc, crtc_state,
> > -					  encoder);
> > -	else
> > -		return hsw_ddi_pll_select(intel_crtc, crtc_state,
> > -					  encoder);
> > +	pll = intel_get_shared_dpll(intel_crtc, crtc_state,
> > encoder);
> 
> I wonder if intel_ddi_pll_select() has any good reason to even exist
> anymore. It's just calling this one function, so maybe we should just
> call it directly?

You're right here. Then the two callers would be
haswell_crtc_compute_clock() and ironlake_crtc_compute_clock(), which
makes even more sene. I'll submit another patch.

> 
> > 
> > +	if (!pll)
> > +		DRM_DEBUG_DRIVER("failed to find PLL for pipe
> > %c\n",
> > +				  pipe_name(intel_crtc->pipe));
> > +
> > +	return pll;
> 
> I would probably write 'pll != NULL' for a bit of extra clarity.

Are you talking about the return statement or the if condition?

I'll assume you're talking about the return statement. I can fix this.
Another thing would be "return !!pll". I'm fine with all approaches.

> 
> Either way
> Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>

Thanks!

> 
> > 
> >  }
> >  
> >  void intel_ddi_set_pipe_settings(const struct intel_crtc_state
> > *crtc_state)
> > -- 
> > 2.7.4
> > 
> > _______________________________________________
> > Intel-gfx mailing list
> > Intel-gfx@lists.freedesktop.org
> > https://lists.freedesktop.org/mailman/listinfo/intel-gfx
> 
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] drm/i915: simplify intel_ddi_pll_select()
  2017-03-22 17:40   ` Paulo Zanoni
@ 2017-03-22 17:50     ` Ville Syrjälä
  2017-03-22 18:58       ` [PATCH 1/2] " Paulo Zanoni
  0 siblings, 1 reply; 10+ messages in thread
From: Ville Syrjälä @ 2017-03-22 17:50 UTC (permalink / raw)
  To: Paulo Zanoni; +Cc: intel-gfx

On Wed, Mar 22, 2017 at 02:40:01PM -0300, Paulo Zanoni wrote:
> Em Qua, 2017-03-22 às 15:21 +0200, Ville Syrjälä escreveu:
> > On Tue, Mar 21, 2017 at 06:57:10PM -0300, Paulo Zanoni wrote:
> > > 
> > > Because {hsw,skl,bxt}_ddi_pll_select all pretty much do the same
> > > thing
> > > in slightly different ways. Replace everything with a simple copy
> > > of
> > > the function and inline it inside intle_ddi_pll_select().
> > > 
> > > Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
> > > ---
> > >  drivers/gpu/drm/i915/intel_ddi.c | 58 +++++-----------------------
> > > ------------
> > >  1 file changed, 7 insertions(+), 51 deletions(-)
> > > 
> > > diff --git a/drivers/gpu/drm/i915/intel_ddi.c
> > > b/drivers/gpu/drm/i915/intel_ddi.c
> > > index d8214ba..bd6fd0b 100644
> > > --- a/drivers/gpu/drm/i915/intel_ddi.c
> > > +++ b/drivers/gpu/drm/i915/intel_ddi.c
> > > @@ -1127,47 +1127,6 @@ void intel_ddi_clock_get(struct
> > > intel_encoder *encoder,
> > >  		bxt_ddi_clock_get(encoder, pipe_config);
> > >  }
> > >  
> > > -static bool
> > > -hsw_ddi_pll_select(struct intel_crtc *intel_crtc,
> > > -		   struct intel_crtc_state *crtc_state,
> > > -		   struct intel_encoder *encoder)
> > > -{
> > > -	struct intel_shared_dpll *pll;
> > > -
> > > -	pll = intel_get_shared_dpll(intel_crtc, crtc_state,
> > > -				    encoder);
> > > -	if (!pll)
> > > -		DRM_DEBUG_DRIVER("failed to find PLL for pipe
> > > %c\n",
> > > -				 pipe_name(intel_crtc->pipe));
> > > -
> > > -	return pll;
> > > -}
> > > -
> > > -static bool
> > > -skl_ddi_pll_select(struct intel_crtc *intel_crtc,
> > > -		   struct intel_crtc_state *crtc_state,
> > > -		   struct intel_encoder *encoder)
> > > -{
> > > -	struct intel_shared_dpll *pll;
> > > -
> > > -	pll = intel_get_shared_dpll(intel_crtc, crtc_state,
> > > encoder);
> > > -	if (pll == NULL) {
> > > -		DRM_DEBUG_DRIVER("failed to find PLL for pipe
> > > %c\n",
> > > -				 pipe_name(intel_crtc->pipe));
> > > -		return false;
> > > -	}
> > > -
> > > -	return true;
> > > -}
> > > -
> > > -static bool
> > > -bxt_ddi_pll_select(struct intel_crtc *intel_crtc,
> > > -		   struct intel_crtc_state *crtc_state,
> > > -		   struct intel_encoder *encoder)
> > > -{
> > > -	return !!intel_get_shared_dpll(intel_crtc, crtc_state,
> > > encoder);
> > > -}
> > > -
> > >  /*
> > >   * Tries to find a *shared* PLL for the CRTC and store it in
> > >   * intel_crtc->ddi_pll_sel.
> > > @@ -1178,19 +1137,16 @@ bxt_ddi_pll_select(struct intel_crtc
> > > *intel_crtc,
> > >  bool intel_ddi_pll_select(struct intel_crtc *intel_crtc,
> > >  			  struct intel_crtc_state *crtc_state)
> > >  {
> > > -	struct drm_i915_private *dev_priv = to_i915(intel_crtc-
> > > >base.dev);
> > >  	struct intel_encoder *encoder =
> > >  		intel_ddi_get_crtc_new_encoder(crtc_state);
> > > +	struct intel_shared_dpll *pll;
> > >  
> > > -	if (IS_GEN9_BC(dev_priv))
> > > -		return skl_ddi_pll_select(intel_crtc, crtc_state,
> > > -					  encoder);
> > > -	else if (IS_GEN9_LP(dev_priv))
> > > -		return bxt_ddi_pll_select(intel_crtc, crtc_state,
> > > -					  encoder);
> > > -	else
> > > -		return hsw_ddi_pll_select(intel_crtc, crtc_state,
> > > -					  encoder);
> > > +	pll = intel_get_shared_dpll(intel_crtc, crtc_state,
> > > encoder);
> > 
> > I wonder if intel_ddi_pll_select() has any good reason to even exist
> > anymore. It's just calling this one function, so maybe we should just
> > call it directly?
> 
> You're right here. Then the two callers would be
> haswell_crtc_compute_clock() and ironlake_crtc_compute_clock(), which
> makes even more sene. I'll submit another patch.
> 
> > 
> > > 
> > > +	if (!pll)
> > > +		DRM_DEBUG_DRIVER("failed to find PLL for pipe
> > > %c\n",
> > > +				  pipe_name(intel_crtc->pipe));
> > > +
> > > +	return pll;
> > 
> > I would probably write 'pll != NULL' for a bit of extra clarity.
> 
> Are you talking about the return statement or the if condition?

The return.

> 
> I'll assume you're talking about the return statement. I can fix this.
> Another thing would be "return !!pll". I'm fine with all approaches.

For whatever reason I've started to prefer !=NULL type of stuff.
Not really sure why since I used to dislike it when I was younger.

> 
> > 
> > Either way
> > Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> 
> Thanks!
> 
> > 
> > > 
> > >  }
> > >  
> > >  void intel_ddi_set_pipe_settings(const struct intel_crtc_state
> > > *crtc_state)
> > > -- 
> > > 2.7.4
> > > 
> > > _______________________________________________
> > > Intel-gfx mailing list
> > > Intel-gfx@lists.freedesktop.org
> > > https://lists.freedesktop.org/mailman/listinfo/intel-gfx
> > 

-- 
Ville Syrjälä
Intel OTC
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH 1/2] drm/i915: simplify intel_ddi_pll_select()
  2017-03-22 17:50     ` Ville Syrjälä
@ 2017-03-22 18:58       ` Paulo Zanoni
  2017-03-22 18:58         ` [PATCH 2/2] drm/i915: kill intel_ddi_pll_select() Paulo Zanoni
  0 siblings, 1 reply; 10+ messages in thread
From: Paulo Zanoni @ 2017-03-22 18:58 UTC (permalink / raw)
  To: intel-gfx; +Cc: Paulo Zanoni

Because {hsw,skl,bxt}_ddi_pll_select all pretty much do the same thing
in slightly different ways. Replace everything with a simple copy of
the function and inline it inside intle_ddi_pll_select().

v2: s/return pll/return pll != NULL/ (Ville)

Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
---
 drivers/gpu/drm/i915/intel_ddi.c | 58 +++++-----------------------------------
 1 file changed, 7 insertions(+), 51 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_ddi.c b/drivers/gpu/drm/i915/intel_ddi.c
index d8214ba..08a810d 100644
--- a/drivers/gpu/drm/i915/intel_ddi.c
+++ b/drivers/gpu/drm/i915/intel_ddi.c
@@ -1127,47 +1127,6 @@ void intel_ddi_clock_get(struct intel_encoder *encoder,
 		bxt_ddi_clock_get(encoder, pipe_config);
 }
 
-static bool
-hsw_ddi_pll_select(struct intel_crtc *intel_crtc,
-		   struct intel_crtc_state *crtc_state,
-		   struct intel_encoder *encoder)
-{
-	struct intel_shared_dpll *pll;
-
-	pll = intel_get_shared_dpll(intel_crtc, crtc_state,
-				    encoder);
-	if (!pll)
-		DRM_DEBUG_DRIVER("failed to find PLL for pipe %c\n",
-				 pipe_name(intel_crtc->pipe));
-
-	return pll;
-}
-
-static bool
-skl_ddi_pll_select(struct intel_crtc *intel_crtc,
-		   struct intel_crtc_state *crtc_state,
-		   struct intel_encoder *encoder)
-{
-	struct intel_shared_dpll *pll;
-
-	pll = intel_get_shared_dpll(intel_crtc, crtc_state, encoder);
-	if (pll == NULL) {
-		DRM_DEBUG_DRIVER("failed to find PLL for pipe %c\n",
-				 pipe_name(intel_crtc->pipe));
-		return false;
-	}
-
-	return true;
-}
-
-static bool
-bxt_ddi_pll_select(struct intel_crtc *intel_crtc,
-		   struct intel_crtc_state *crtc_state,
-		   struct intel_encoder *encoder)
-{
-	return !!intel_get_shared_dpll(intel_crtc, crtc_state, encoder);
-}
-
 /*
  * Tries to find a *shared* PLL for the CRTC and store it in
  * intel_crtc->ddi_pll_sel.
@@ -1178,19 +1137,16 @@ bxt_ddi_pll_select(struct intel_crtc *intel_crtc,
 bool intel_ddi_pll_select(struct intel_crtc *intel_crtc,
 			  struct intel_crtc_state *crtc_state)
 {
-	struct drm_i915_private *dev_priv = to_i915(intel_crtc->base.dev);
 	struct intel_encoder *encoder =
 		intel_ddi_get_crtc_new_encoder(crtc_state);
+	struct intel_shared_dpll *pll;
 
-	if (IS_GEN9_BC(dev_priv))
-		return skl_ddi_pll_select(intel_crtc, crtc_state,
-					  encoder);
-	else if (IS_GEN9_LP(dev_priv))
-		return bxt_ddi_pll_select(intel_crtc, crtc_state,
-					  encoder);
-	else
-		return hsw_ddi_pll_select(intel_crtc, crtc_state,
-					  encoder);
+	pll = intel_get_shared_dpll(intel_crtc, crtc_state, encoder);
+	if (!pll)
+		DRM_DEBUG_DRIVER("failed to find PLL for pipe %c\n",
+				  pipe_name(intel_crtc->pipe));
+
+	return pll != NULL;
 }
 
 void intel_ddi_set_pipe_settings(const struct intel_crtc_state *crtc_state)
-- 
2.7.4

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH 2/2] drm/i915: kill intel_ddi_pll_select()
  2017-03-22 18:58       ` [PATCH 1/2] " Paulo Zanoni
@ 2017-03-22 18:58         ` Paulo Zanoni
  2017-03-22 19:26           ` Ville Syrjälä
  0 siblings, 1 reply; 10+ messages in thread
From: Paulo Zanoni @ 2017-03-22 18:58 UTC (permalink / raw)
  To: intel-gfx; +Cc: Paulo Zanoni

All it does is pick the encoder and call intel_get_shared_dpll(). We
can just do this in the caller. One less indirection level during code
reading.

As another plus, now the two callers of intel_get_shared_dpll() are
{ironlake,haswell}_crtc_compute_clock().

Reported-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
---
 drivers/gpu/drm/i915/intel_ddi.c     | 25 ++-----------------------
 drivers/gpu/drm/i915/intel_display.c |  8 +++++++-
 drivers/gpu/drm/i915/intel_drv.h     |  4 ++--
 3 files changed, 11 insertions(+), 26 deletions(-)


To be honest I'm not super sure if this change is an improvement. I like keeping
DDI-related code in intel_ddi.c. I'll let you guys decide with the
upvote/downvote buttons in your email clients.


diff --git a/drivers/gpu/drm/i915/intel_ddi.c b/drivers/gpu/drm/i915/intel_ddi.c
index 08a810d..3fbe498 100644
--- a/drivers/gpu/drm/i915/intel_ddi.c
+++ b/drivers/gpu/drm/i915/intel_ddi.c
@@ -837,7 +837,8 @@ intel_ddi_get_crtc_encoder(struct intel_crtc *crtc)
 	return ret;
 }
 
-static struct intel_encoder *
+/* Finds the only possible encoder associated with the given CRTC. */
+struct intel_encoder *
 intel_ddi_get_crtc_new_encoder(struct intel_crtc_state *crtc_state)
 {
 	struct intel_crtc *crtc = to_intel_crtc(crtc_state->base.crtc);
@@ -1127,28 +1128,6 @@ void intel_ddi_clock_get(struct intel_encoder *encoder,
 		bxt_ddi_clock_get(encoder, pipe_config);
 }
 
-/*
- * Tries to find a *shared* PLL for the CRTC and store it in
- * intel_crtc->ddi_pll_sel.
- *
- * For private DPLLs, compute_config() should do the selection for us. This
- * function should be folded into compute_config() eventually.
- */
-bool intel_ddi_pll_select(struct intel_crtc *intel_crtc,
-			  struct intel_crtc_state *crtc_state)
-{
-	struct intel_encoder *encoder =
-		intel_ddi_get_crtc_new_encoder(crtc_state);
-	struct intel_shared_dpll *pll;
-
-	pll = intel_get_shared_dpll(intel_crtc, crtc_state, encoder);
-	if (!pll)
-		DRM_DEBUG_DRIVER("failed to find PLL for pipe %c\n",
-				  pipe_name(intel_crtc->pipe));
-
-	return pll != NULL;
-}
-
 void intel_ddi_set_pipe_settings(const struct intel_crtc_state *crtc_state)
 {
 	struct intel_crtc *crtc = to_intel_crtc(crtc_state->base.crtc);
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index 010e5dd..9cdf9b2 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -8862,8 +8862,14 @@ static int haswell_crtc_compute_clock(struct intel_crtc *crtc,
 				      struct intel_crtc_state *crtc_state)
 {
 	if (!intel_crtc_has_type(crtc_state, INTEL_OUTPUT_DSI)) {
-		if (!intel_ddi_pll_select(crtc, crtc_state))
+		struct intel_encoder *encoder =
+			intel_ddi_get_crtc_new_encoder(crtc_state);
+
+		if (!intel_get_shared_dpll(crtc, crtc_state, encoder)) {
+			DRM_DEBUG_DRIVER("failed to find PLL for pipe %c\n",
+					  pipe_name(crtc->pipe));
 			return -EINVAL;
+		}
 	}
 
 	crtc->lowfreq_avail = false;
diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
index 51228fe..ad7bdf5 100644
--- a/drivers/gpu/drm/i915/intel_drv.h
+++ b/drivers/gpu/drm/i915/intel_drv.h
@@ -1236,8 +1236,8 @@ void intel_ddi_disable_transcoder_func(struct drm_i915_private *dev_priv,
 				       enum transcoder cpu_transcoder);
 void intel_ddi_enable_pipe_clock(const struct intel_crtc_state *crtc_state);
 void intel_ddi_disable_pipe_clock(const  struct intel_crtc_state *crtc_state);
-bool intel_ddi_pll_select(struct intel_crtc *crtc,
-			  struct intel_crtc_state *crtc_state);
+struct intel_encoder *
+intel_ddi_get_crtc_new_encoder(struct intel_crtc_state *crtc_state);
 void intel_ddi_set_pipe_settings(const struct intel_crtc_state *crtc_state);
 void intel_ddi_prepare_link_retrain(struct intel_dp *intel_dp);
 bool intel_ddi_connector_get_hw_state(struct intel_connector *intel_connector);
-- 
2.7.4

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCH 2/2] drm/i915: kill intel_ddi_pll_select()
  2017-03-22 18:58         ` [PATCH 2/2] drm/i915: kill intel_ddi_pll_select() Paulo Zanoni
@ 2017-03-22 19:26           ` Ville Syrjälä
  0 siblings, 0 replies; 10+ messages in thread
From: Ville Syrjälä @ 2017-03-22 19:26 UTC (permalink / raw)
  To: Paulo Zanoni; +Cc: intel-gfx

On Wed, Mar 22, 2017 at 03:58:45PM -0300, Paulo Zanoni wrote:
> All it does is pick the encoder and call intel_get_shared_dpll(). We
> can just do this in the caller. One less indirection level during code
> reading.
> 
> As another plus, now the two callers of intel_get_shared_dpll() are
> {ironlake,haswell}_crtc_compute_clock().
> 
> Reported-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
> ---
>  drivers/gpu/drm/i915/intel_ddi.c     | 25 ++-----------------------
>  drivers/gpu/drm/i915/intel_display.c |  8 +++++++-
>  drivers/gpu/drm/i915/intel_drv.h     |  4 ++--
>  3 files changed, 11 insertions(+), 26 deletions(-)
> 
> 
> To be honest I'm not super sure if this change is an improvement. I like keeping
> DDI-related code in intel_ddi.c. I'll let you guys decide with the
> upvote/downvote buttons in your email clients.

I guess the thing that sort of ruins is the
intel_ddi_get_crtc_new_encoder() call. First I thought we could nuke
that by using output_types instead of encoder->type, but looks like
BXT wants to disagree with us and really requires the encoder in
.get_dpll() :(

Oh well, we trade one ddi thing for another. Although
intel_ddi_get_crtc_new_encoder() doesn't really have anything truly ddi
specific in it so we could even move it elsewhere or even just inline it
in .compute_clock() since it's not even called from anywhere else.

I do like the fact that there's at least one less hoop to jump
through when tracing through the code. So this works for me.

Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>

> 
> 
> diff --git a/drivers/gpu/drm/i915/intel_ddi.c b/drivers/gpu/drm/i915/intel_ddi.c
> index 08a810d..3fbe498 100644
> --- a/drivers/gpu/drm/i915/intel_ddi.c
> +++ b/drivers/gpu/drm/i915/intel_ddi.c
> @@ -837,7 +837,8 @@ intel_ddi_get_crtc_encoder(struct intel_crtc *crtc)
>  	return ret;
>  }
>  
> -static struct intel_encoder *
> +/* Finds the only possible encoder associated with the given CRTC. */
> +struct intel_encoder *
>  intel_ddi_get_crtc_new_encoder(struct intel_crtc_state *crtc_state)
>  {
>  	struct intel_crtc *crtc = to_intel_crtc(crtc_state->base.crtc);
> @@ -1127,28 +1128,6 @@ void intel_ddi_clock_get(struct intel_encoder *encoder,
>  		bxt_ddi_clock_get(encoder, pipe_config);
>  }
>  
> -/*
> - * Tries to find a *shared* PLL for the CRTC and store it in
> - * intel_crtc->ddi_pll_sel.
> - *
> - * For private DPLLs, compute_config() should do the selection for us. This
> - * function should be folded into compute_config() eventually.
> - */
> -bool intel_ddi_pll_select(struct intel_crtc *intel_crtc,
> -			  struct intel_crtc_state *crtc_state)
> -{
> -	struct intel_encoder *encoder =
> -		intel_ddi_get_crtc_new_encoder(crtc_state);
> -	struct intel_shared_dpll *pll;
> -
> -	pll = intel_get_shared_dpll(intel_crtc, crtc_state, encoder);
> -	if (!pll)
> -		DRM_DEBUG_DRIVER("failed to find PLL for pipe %c\n",
> -				  pipe_name(intel_crtc->pipe));
> -
> -	return pll != NULL;
> -}
> -
>  void intel_ddi_set_pipe_settings(const struct intel_crtc_state *crtc_state)
>  {
>  	struct intel_crtc *crtc = to_intel_crtc(crtc_state->base.crtc);
> diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
> index 010e5dd..9cdf9b2 100644
> --- a/drivers/gpu/drm/i915/intel_display.c
> +++ b/drivers/gpu/drm/i915/intel_display.c
> @@ -8862,8 +8862,14 @@ static int haswell_crtc_compute_clock(struct intel_crtc *crtc,
>  				      struct intel_crtc_state *crtc_state)
>  {
>  	if (!intel_crtc_has_type(crtc_state, INTEL_OUTPUT_DSI)) {
> -		if (!intel_ddi_pll_select(crtc, crtc_state))
> +		struct intel_encoder *encoder =
> +			intel_ddi_get_crtc_new_encoder(crtc_state);
> +
> +		if (!intel_get_shared_dpll(crtc, crtc_state, encoder)) {
> +			DRM_DEBUG_DRIVER("failed to find PLL for pipe %c\n",
> +					  pipe_name(crtc->pipe));
>  			return -EINVAL;
> +		}
>  	}
>  
>  	crtc->lowfreq_avail = false;
> diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
> index 51228fe..ad7bdf5 100644
> --- a/drivers/gpu/drm/i915/intel_drv.h
> +++ b/drivers/gpu/drm/i915/intel_drv.h
> @@ -1236,8 +1236,8 @@ void intel_ddi_disable_transcoder_func(struct drm_i915_private *dev_priv,
>  				       enum transcoder cpu_transcoder);
>  void intel_ddi_enable_pipe_clock(const struct intel_crtc_state *crtc_state);
>  void intel_ddi_disable_pipe_clock(const  struct intel_crtc_state *crtc_state);
> -bool intel_ddi_pll_select(struct intel_crtc *crtc,
> -			  struct intel_crtc_state *crtc_state);
> +struct intel_encoder *
> +intel_ddi_get_crtc_new_encoder(struct intel_crtc_state *crtc_state);
>  void intel_ddi_set_pipe_settings(const struct intel_crtc_state *crtc_state);
>  void intel_ddi_prepare_link_retrain(struct intel_dp *intel_dp);
>  bool intel_ddi_connector_get_hw_state(struct intel_connector *intel_connector);
> -- 
> 2.7.4
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx

-- 
Ville Syrjälä
Intel OTC
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2017-03-22 19:26 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-03-21 21:57 [PATCH] drm/i915: simplify intel_ddi_pll_select() Paulo Zanoni
2017-03-21 22:16 ` ✓ Fi.CI.BAT: success for " Patchwork
2017-03-21 23:05 ` [PATCH] " Pandiyan, Dhinakaran
2017-03-22 17:33   ` Paulo Zanoni
2017-03-22 13:21 ` Ville Syrjälä
2017-03-22 17:40   ` Paulo Zanoni
2017-03-22 17:50     ` Ville Syrjälä
2017-03-22 18:58       ` [PATCH 1/2] " Paulo Zanoni
2017-03-22 18:58         ` [PATCH 2/2] drm/i915: kill intel_ddi_pll_select() Paulo Zanoni
2017-03-22 19:26           ` Ville Syrjälä

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).