diff mbox series

[9/9] drm/i915: Inline skl_build_pipe_wm() into its only caller

Message ID 20190312205844.6339-10-ville.syrjala@linux.intel.com (mailing list archive)
State New, archived
Headers show
Series skl+ cursor DDB allocation fixes | expand

Commit Message

Ville Syrjala March 12, 2019, 8:58 p.m. UTC
From: Ville Syrjälä <ville.syrjala@linux.intel.com>

skl_build_pipe_wm() is quite pointless now. Just inline it into
skl_compute_wm().

Cc: Neel Desai <neel.desai@intel.com>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 drivers/gpu/drm/i915/intel_pm.c | 32 ++++++--------------------------
 1 file changed, 6 insertions(+), 26 deletions(-)

Comments

Matt Roper March 19, 2019, 12:11 a.m. UTC | #1
On Tue, Mar 12, 2019 at 10:58:44PM +0200, Ville Syrjala wrote:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> 
> skl_build_pipe_wm() is quite pointless now. Just inline it into

I think you actually mean skl_update_pipe_wm(), right?

The code change looks good, so with an updated commit message,

Reviewed-by: Matt Roper <matthew.d.roper@intel.com>

> skl_compute_wm().
> 
> Cc: Neel Desai <neel.desai@intel.com>
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> ---
>  drivers/gpu/drm/i915/intel_pm.c | 32 ++++++--------------------------
>  1 file changed, 6 insertions(+), 26 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c
> index 80e964f7de58..ac0ca150a0d5 100644
> --- a/drivers/gpu/drm/i915/intel_pm.c
> +++ b/drivers/gpu/drm/i915/intel_pm.c
> @@ -5257,23 +5257,6 @@ bool skl_ddb_allocation_overlaps(const struct skl_ddb_entry *ddb,
>  	return false;
>  }
>  
> -static int skl_update_pipe_wm(struct intel_crtc_state *cstate,
> -			      const struct skl_pipe_wm *old_pipe_wm,
> -			      struct skl_pipe_wm *pipe_wm, /* out */
> -			      bool *changed /* out */)
> -{
> -	struct intel_crtc *crtc = to_intel_crtc(cstate->base.crtc);
> -	int ret;
> -
> -	ret = skl_build_pipe_wm(cstate);
> -	if (ret)
> -		return ret;
> -
> -	*changed = !skl_pipe_wm_equals(crtc, old_pipe_wm, pipe_wm);
> -
> -	return 0;
> -}
> -
>  static u32
>  pipes_modified(struct intel_atomic_state *state)
>  {
> @@ -5612,10 +5595,9 @@ static int
>  skl_compute_wm(struct intel_atomic_state *state)
>  {
>  	struct intel_crtc *crtc;
> -	struct intel_crtc_state *cstate;
> +	struct intel_crtc_state *new_crtc_state;
>  	struct intel_crtc_state *old_crtc_state;
>  	struct skl_ddb_values *results = &state->wm_results;
> -	struct skl_pipe_wm *pipe_wm;
>  	bool changed = false;
>  	int ret, i;
>  
> @@ -5633,12 +5615,8 @@ skl_compute_wm(struct intel_atomic_state *state)
>  	 * pipe allocations had to change.
>  	 */
>  	for_each_oldnew_intel_crtc_in_state(state, crtc, old_crtc_state,
> -					    cstate, i) {
> -		const struct skl_pipe_wm *old_pipe_wm =
> -			&old_crtc_state->wm.skl.optimal;
> -
> -		pipe_wm = &cstate->wm.skl.optimal;
> -		ret = skl_update_pipe_wm(cstate, old_pipe_wm, pipe_wm, &changed);
> +					    new_crtc_state, i) {
> +		ret = skl_build_pipe_wm(new_crtc_state);
>  		if (ret)
>  			return ret;
>  
> @@ -5646,7 +5624,9 @@ skl_compute_wm(struct intel_atomic_state *state)
>  		if (ret)
>  			return ret;
>  
> -		if (changed)
> +		if (!skl_pipe_wm_equals(crtc,
> +					&old_crtc_state->wm.skl.optimal,
> +					&new_crtc_state->wm.skl.optimal))
>  			results->dirty_pipes |= drm_crtc_mask(&crtc->base);
>  	}
>  
> -- 
> 2.19.2
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Ville Syrjala March 19, 2019, 10:49 a.m. UTC | #2
On Mon, Mar 18, 2019 at 05:11:30PM -0700, Matt Roper wrote:
> On Tue, Mar 12, 2019 at 10:58:44PM +0200, Ville Syrjala wrote:
> > From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> > 
> > skl_build_pipe_wm() is quite pointless now. Just inline it into
> 
> I think you actually mean skl_update_pipe_wm(), right?

Indeed.

> 
> The code change looks good, so with an updated commit message,
> 
> Reviewed-by: Matt Roper <matthew.d.roper@intel.com>

Thanks.

> 
> > skl_compute_wm().
> > 
> > Cc: Neel Desai <neel.desai@intel.com>
> > Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> > ---
> >  drivers/gpu/drm/i915/intel_pm.c | 32 ++++++--------------------------
> >  1 file changed, 6 insertions(+), 26 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c
> > index 80e964f7de58..ac0ca150a0d5 100644
> > --- a/drivers/gpu/drm/i915/intel_pm.c
> > +++ b/drivers/gpu/drm/i915/intel_pm.c
> > @@ -5257,23 +5257,6 @@ bool skl_ddb_allocation_overlaps(const struct skl_ddb_entry *ddb,
> >  	return false;
> >  }
> >  
> > -static int skl_update_pipe_wm(struct intel_crtc_state *cstate,
> > -			      const struct skl_pipe_wm *old_pipe_wm,
> > -			      struct skl_pipe_wm *pipe_wm, /* out */
> > -			      bool *changed /* out */)
> > -{
> > -	struct intel_crtc *crtc = to_intel_crtc(cstate->base.crtc);
> > -	int ret;
> > -
> > -	ret = skl_build_pipe_wm(cstate);
> > -	if (ret)
> > -		return ret;
> > -
> > -	*changed = !skl_pipe_wm_equals(crtc, old_pipe_wm, pipe_wm);
> > -
> > -	return 0;
> > -}
> > -
> >  static u32
> >  pipes_modified(struct intel_atomic_state *state)
> >  {
> > @@ -5612,10 +5595,9 @@ static int
> >  skl_compute_wm(struct intel_atomic_state *state)
> >  {
> >  	struct intel_crtc *crtc;
> > -	struct intel_crtc_state *cstate;
> > +	struct intel_crtc_state *new_crtc_state;
> >  	struct intel_crtc_state *old_crtc_state;
> >  	struct skl_ddb_values *results = &state->wm_results;
> > -	struct skl_pipe_wm *pipe_wm;
> >  	bool changed = false;
> >  	int ret, i;
> >  
> > @@ -5633,12 +5615,8 @@ skl_compute_wm(struct intel_atomic_state *state)
> >  	 * pipe allocations had to change.
> >  	 */
> >  	for_each_oldnew_intel_crtc_in_state(state, crtc, old_crtc_state,
> > -					    cstate, i) {
> > -		const struct skl_pipe_wm *old_pipe_wm =
> > -			&old_crtc_state->wm.skl.optimal;
> > -
> > -		pipe_wm = &cstate->wm.skl.optimal;
> > -		ret = skl_update_pipe_wm(cstate, old_pipe_wm, pipe_wm, &changed);
> > +					    new_crtc_state, i) {
> > +		ret = skl_build_pipe_wm(new_crtc_state);
> >  		if (ret)
> >  			return ret;
> >  
> > @@ -5646,7 +5624,9 @@ skl_compute_wm(struct intel_atomic_state *state)
> >  		if (ret)
> >  			return ret;
> >  
> > -		if (changed)
> > +		if (!skl_pipe_wm_equals(crtc,
> > +					&old_crtc_state->wm.skl.optimal,
> > +					&new_crtc_state->wm.skl.optimal))
> >  			results->dirty_pipes |= drm_crtc_mask(&crtc->base);
> >  	}
> >  
> > -- 
> > 2.19.2
> > 
> > _______________________________________________
> > Intel-gfx mailing list
> > Intel-gfx@lists.freedesktop.org
> > https://lists.freedesktop.org/mailman/listinfo/intel-gfx
> 
> -- 
> Matt Roper
> Graphics Software Engineer
> IoTG Platform Enabling & Development
> Intel Corporation
> (916) 356-2795
diff mbox series

Patch

diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c
index 80e964f7de58..ac0ca150a0d5 100644
--- a/drivers/gpu/drm/i915/intel_pm.c
+++ b/drivers/gpu/drm/i915/intel_pm.c
@@ -5257,23 +5257,6 @@  bool skl_ddb_allocation_overlaps(const struct skl_ddb_entry *ddb,
 	return false;
 }
 
-static int skl_update_pipe_wm(struct intel_crtc_state *cstate,
-			      const struct skl_pipe_wm *old_pipe_wm,
-			      struct skl_pipe_wm *pipe_wm, /* out */
-			      bool *changed /* out */)
-{
-	struct intel_crtc *crtc = to_intel_crtc(cstate->base.crtc);
-	int ret;
-
-	ret = skl_build_pipe_wm(cstate);
-	if (ret)
-		return ret;
-
-	*changed = !skl_pipe_wm_equals(crtc, old_pipe_wm, pipe_wm);
-
-	return 0;
-}
-
 static u32
 pipes_modified(struct intel_atomic_state *state)
 {
@@ -5612,10 +5595,9 @@  static int
 skl_compute_wm(struct intel_atomic_state *state)
 {
 	struct intel_crtc *crtc;
-	struct intel_crtc_state *cstate;
+	struct intel_crtc_state *new_crtc_state;
 	struct intel_crtc_state *old_crtc_state;
 	struct skl_ddb_values *results = &state->wm_results;
-	struct skl_pipe_wm *pipe_wm;
 	bool changed = false;
 	int ret, i;
 
@@ -5633,12 +5615,8 @@  skl_compute_wm(struct intel_atomic_state *state)
 	 * pipe allocations had to change.
 	 */
 	for_each_oldnew_intel_crtc_in_state(state, crtc, old_crtc_state,
-					    cstate, i) {
-		const struct skl_pipe_wm *old_pipe_wm =
-			&old_crtc_state->wm.skl.optimal;
-
-		pipe_wm = &cstate->wm.skl.optimal;
-		ret = skl_update_pipe_wm(cstate, old_pipe_wm, pipe_wm, &changed);
+					    new_crtc_state, i) {
+		ret = skl_build_pipe_wm(new_crtc_state);
 		if (ret)
 			return ret;
 
@@ -5646,7 +5624,9 @@  skl_compute_wm(struct intel_atomic_state *state)
 		if (ret)
 			return ret;
 
-		if (changed)
+		if (!skl_pipe_wm_equals(crtc,
+					&old_crtc_state->wm.skl.optimal,
+					&new_crtc_state->wm.skl.optimal))
 			results->dirty_pipes |= drm_crtc_mask(&crtc->base);
 	}