diff mbox series

[3/6] drm/i915: Move hw.active assignment into intel_crtc_get_pipe_config()

Message ID 20201112191718.16683-4-ville.syrjala@linux.intel.com (mailing list archive)
State New, archived
Headers show
Series drm/i915: Introduce crtc_state.hw.pipe_mode | expand

Commit Message

Ville Syrjälä Nov. 12, 2020, 7:17 p.m. UTC
From: Ville Syrjälä <ville.syrjala@linux.intel.com>

No reason to make the callers of intel_crtc_get_pipe_config()
populate hw.active. Let's do it in intel_crtc_get_pipe_config()
itself. hw.enable we leave up to the callers since it's slightly
different for readout vs. state check.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 drivers/gpu/drm/i915/display/intel_display.c | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

Comments

Navare, Manasi Nov. 12, 2020, 7:48 p.m. UTC | #1
On Thu, Nov 12, 2020 at 09:17:15PM +0200, Ville Syrjala wrote:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> 
> No reason to make the callers of intel_crtc_get_pipe_config()
> populate hw.active. Let's do it in intel_crtc_get_pipe_config()
> itself. hw.enable we leave up to the callers since it's slightly
> different for readout vs. state check.
> 
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> ---
>  drivers/gpu/drm/i915/display/intel_display.c | 14 ++++++++++----
>  1 file changed, 10 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/drm/i915/display/intel_display.c
> index a8287414937c..889642bef192 100644
> --- a/drivers/gpu/drm/i915/display/intel_display.c
> +++ b/drivers/gpu/drm/i915/display/intel_display.c
> @@ -11412,7 +11412,12 @@ static bool intel_crtc_get_pipe_config(struct intel_crtc_state *crtc_state)
>  	struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc);
>  	struct drm_i915_private *i915 = to_i915(crtc->base.dev);
>  
> -	return i915->display.get_pipe_config(crtc, crtc_state);
> +	if (!i915->display.get_pipe_config(crtc, crtc_state))
> +		return false;
> +
> +	crtc_state->hw.active = true;
> +
> +	return true;

In that case this function can just return a void right, we are not catching the return value in the caller anyways now

With that change

Reviewed-by: Manasi Navare <manasi.d.navare@intel.com>

Manasi

>  }
>  
>  static u32 intel_cursor_base(const struct intel_plane_state *plane_state)
> @@ -14430,7 +14435,7 @@ verify_crtc_state(struct intel_crtc *crtc,
>  
>  	pipe_config->hw.enable = new_crtc_state->hw.enable;
>  
> -	pipe_config->hw.active = intel_crtc_get_pipe_config(pipe_config);
> +	intel_crtc_get_pipe_config(pipe_config);
>  
>  	/* we keep both pipes enabled on 830 */
>  	if (IS_I830(dev_priv) && pipe_config->hw.active)
> @@ -18742,8 +18747,9 @@ static void intel_modeset_readout_hw_state(struct drm_device *dev)
>  		intel_crtc_free_hw_state(crtc_state);
>  		intel_crtc_state_reset(crtc_state, crtc);
>  
> -		crtc_state->hw.active = crtc_state->hw.enable =
> -			intel_crtc_get_pipe_config(crtc_state);
> +		intel_crtc_get_pipe_config(crtc_state);
> +
> +		crtc_state->hw.enable = crtc_state->hw.active;
>  
>  		crtc->base.enabled = crtc_state->hw.enable;
>  		crtc->active = crtc_state->hw.active;
> -- 
> 2.26.2
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Ville Syrjälä Nov. 13, 2020, 2:27 p.m. UTC | #2
On Thu, Nov 12, 2020 at 11:48:12AM -0800, Navare, Manasi wrote:
> On Thu, Nov 12, 2020 at 09:17:15PM +0200, Ville Syrjala wrote:
> > From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> > 
> > No reason to make the callers of intel_crtc_get_pipe_config()
> > populate hw.active. Let's do it in intel_crtc_get_pipe_config()
> > itself. hw.enable we leave up to the callers since it's slightly
> > different for readout vs. state check.
> > 
> > Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> > ---
> >  drivers/gpu/drm/i915/display/intel_display.c | 14 ++++++++++----
> >  1 file changed, 10 insertions(+), 4 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/drm/i915/display/intel_display.c
> > index a8287414937c..889642bef192 100644
> > --- a/drivers/gpu/drm/i915/display/intel_display.c
> > +++ b/drivers/gpu/drm/i915/display/intel_display.c
> > @@ -11412,7 +11412,12 @@ static bool intel_crtc_get_pipe_config(struct intel_crtc_state *crtc_state)
> >  	struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc);
> >  	struct drm_i915_private *i915 = to_i915(crtc->base.dev);
> >  
> > -	return i915->display.get_pipe_config(crtc, crtc_state);
> > +	if (!i915->display.get_pipe_config(crtc, crtc_state))
> > +		return false;
> > +
> > +	crtc_state->hw.active = true;
> > +
> > +	return true;
> 
> In that case this function can just return a void right, we are not catching the return value in the caller anyways now

There is a third caller.

> 
> With that change
> 
> Reviewed-by: Manasi Navare <manasi.d.navare@intel.com>
> 
> Manasi
> 
> >  }
> >  
> >  static u32 intel_cursor_base(const struct intel_plane_state *plane_state)
> > @@ -14430,7 +14435,7 @@ verify_crtc_state(struct intel_crtc *crtc,
> >  
> >  	pipe_config->hw.enable = new_crtc_state->hw.enable;
> >  
> > -	pipe_config->hw.active = intel_crtc_get_pipe_config(pipe_config);
> > +	intel_crtc_get_pipe_config(pipe_config);
> >  
> >  	/* we keep both pipes enabled on 830 */
> >  	if (IS_I830(dev_priv) && pipe_config->hw.active)
> > @@ -18742,8 +18747,9 @@ static void intel_modeset_readout_hw_state(struct drm_device *dev)
> >  		intel_crtc_free_hw_state(crtc_state);
> >  		intel_crtc_state_reset(crtc_state, crtc);
> >  
> > -		crtc_state->hw.active = crtc_state->hw.enable =
> > -			intel_crtc_get_pipe_config(crtc_state);
> > +		intel_crtc_get_pipe_config(crtc_state);
> > +
> > +		crtc_state->hw.enable = crtc_state->hw.active;
> >  
> >  		crtc->base.enabled = crtc_state->hw.enable;
> >  		crtc->active = crtc_state->hw.active;
> > -- 
> > 2.26.2
> > 
> > _______________________________________________
> > Intel-gfx mailing list
> > Intel-gfx@lists.freedesktop.org
> > https://lists.freedesktop.org/mailman/listinfo/intel-gfx
diff mbox series

Patch

diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/drm/i915/display/intel_display.c
index a8287414937c..889642bef192 100644
--- a/drivers/gpu/drm/i915/display/intel_display.c
+++ b/drivers/gpu/drm/i915/display/intel_display.c
@@ -11412,7 +11412,12 @@  static bool intel_crtc_get_pipe_config(struct intel_crtc_state *crtc_state)
 	struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc);
 	struct drm_i915_private *i915 = to_i915(crtc->base.dev);
 
-	return i915->display.get_pipe_config(crtc, crtc_state);
+	if (!i915->display.get_pipe_config(crtc, crtc_state))
+		return false;
+
+	crtc_state->hw.active = true;
+
+	return true;
 }
 
 static u32 intel_cursor_base(const struct intel_plane_state *plane_state)
@@ -14430,7 +14435,7 @@  verify_crtc_state(struct intel_crtc *crtc,
 
 	pipe_config->hw.enable = new_crtc_state->hw.enable;
 
-	pipe_config->hw.active = intel_crtc_get_pipe_config(pipe_config);
+	intel_crtc_get_pipe_config(pipe_config);
 
 	/* we keep both pipes enabled on 830 */
 	if (IS_I830(dev_priv) && pipe_config->hw.active)
@@ -18742,8 +18747,9 @@  static void intel_modeset_readout_hw_state(struct drm_device *dev)
 		intel_crtc_free_hw_state(crtc_state);
 		intel_crtc_state_reset(crtc_state, crtc);
 
-		crtc_state->hw.active = crtc_state->hw.enable =
-			intel_crtc_get_pipe_config(crtc_state);
+		intel_crtc_get_pipe_config(crtc_state);
+
+		crtc_state->hw.enable = crtc_state->hw.active;
 
 		crtc->base.enabled = crtc_state->hw.enable;
 		crtc->active = crtc_state->hw.active;