diff mbox series

[1/3] drm/i915/bigjoiner: Refactor bigjoiner state readout

Message ID 20240221192010.25413-2-stanislav.lisovskiy@intel.com (mailing list archive)
State New, archived
Headers show
Series Bigjoiner refactoring | expand

Commit Message

Stanislav Lisovskiy Feb. 21, 2024, 7:20 p.m. UTC
Don't call enabled_bigjoiner_pipes twice, lets just move
intel_get_bigjoiner_config earlier, because it is anyway
calling same function.
Also cleanup hsw_enabled_transcoders from irrelevant bigjoiner code.

Signed-off-by: Stanislav Lisovskiy <stanislav.lisovskiy@intel.com>
---
 drivers/gpu/drm/i915/display/intel_display.c | 22 ++++++++++----------
 1 file changed, 11 insertions(+), 11 deletions(-)

Comments

Ville Syrjälä March 1, 2024, 10:10 a.m. UTC | #1
On Wed, Feb 21, 2024 at 09:20:08PM +0200, Stanislav Lisovskiy wrote:
> Don't call enabled_bigjoiner_pipes twice, lets just move
> intel_get_bigjoiner_config earlier, because it is anyway
> calling same function.
> Also cleanup hsw_enabled_transcoders from irrelevant bigjoiner code.

I still don't like this.

> 
> Signed-off-by: Stanislav Lisovskiy <stanislav.lisovskiy@intel.com>
> ---
>  drivers/gpu/drm/i915/display/intel_display.c | 22 ++++++++++----------
>  1 file changed, 11 insertions(+), 11 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/drm/i915/display/intel_display.c
> index 00ac65a140298..916c13a149fd5 100644
> --- a/drivers/gpu/drm/i915/display/intel_display.c
> +++ b/drivers/gpu/drm/i915/display/intel_display.c
> @@ -3535,7 +3535,6 @@ static u8 hsw_enabled_transcoders(struct intel_crtc *crtc)
>  	struct drm_i915_private *dev_priv = to_i915(dev);
>  	u8 panel_transcoder_mask = hsw_panel_transcoders(dev_priv);
>  	enum transcoder cpu_transcoder;
> -	u8 master_pipes, slave_pipes;
>  	u8 enabled_transcoders = 0;
>  
>  	/*
> @@ -3586,15 +3585,6 @@ static u8 hsw_enabled_transcoders(struct intel_crtc *crtc)
>  	if (transcoder_ddi_func_is_enabled(dev_priv, cpu_transcoder))
>  		enabled_transcoders |= BIT(cpu_transcoder);
>  
> -	/* bigjoiner slave -> consider the master pipe's transcoder as well */
> -	enabled_bigjoiner_pipes(dev_priv, &master_pipes, &slave_pipes);
> -	if (slave_pipes & BIT(crtc->pipe)) {
> -		cpu_transcoder = (enum transcoder)
> -			get_bigjoiner_master_pipe(crtc->pipe, master_pipes, slave_pipes);
> -		if (transcoder_ddi_func_is_enabled(dev_priv, cpu_transcoder))
> -			enabled_transcoders |= BIT(cpu_transcoder);
> -	}
> -
>  	return enabled_transcoders;
>  }
>  
> @@ -3641,6 +3631,15 @@ static bool hsw_get_transcoder_state(struct intel_crtc *crtc,
>  	u32 tmp;
>  
>  	enabled_transcoders = hsw_enabled_transcoders(crtc);
> +
> +	/* bigjoiner slave -> consider the master pipe's transcoder as well */
> +	if (intel_crtc_is_bigjoiner_slave(pipe_config)) {
> +		unsigned long cpu_transcoder = (enum transcoder)
> +			bigjoiner_master_pipe(pipe_config);
> +		if (transcoder_ddi_func_is_enabled(dev_priv, cpu_transcoder))
> +			enabled_transcoders |= BIT(cpu_transcoder);
> +	}
> +
>  	if (!enabled_transcoders)
>  		return false;
>  
> @@ -3745,6 +3744,8 @@ static bool hsw_get_pipe_config(struct intel_crtc *crtc,
>  
>  	pipe_config->shared_dpll = NULL;
>  
> +	intel_bigjoiner_get_config(pipe_config);
> +
>  	active = hsw_get_transcoder_state(crtc, pipe_config, &crtc->hw_readout_power_domains);
>  
>  	if ((IS_GEMINILAKE(dev_priv) || IS_BROXTON(dev_priv)) &&
> @@ -3756,7 +3757,6 @@ static bool hsw_get_pipe_config(struct intel_crtc *crtc,
>  	if (!active)
>  		goto out;
>  
> -	intel_bigjoiner_get_config(pipe_config);
>  	intel_dsc_get_config(pipe_config);
>  
>  	if (!transcoder_is_dsi(pipe_config->cpu_transcoder) ||
> -- 
> 2.37.3
Stanislav Lisovskiy March 1, 2024, 10:22 a.m. UTC | #2
On Fri, Mar 01, 2024 at 12:10:19PM +0200, Ville Syrjälä wrote:
> On Wed, Feb 21, 2024 at 09:20:08PM +0200, Stanislav Lisovskiy wrote:
> > Don't call enabled_bigjoiner_pipes twice, lets just move
> > intel_get_bigjoiner_config earlier, because it is anyway
> > calling same function.
> > Also cleanup hsw_enabled_transcoders from irrelevant bigjoiner code.
> 
> I still don't like this.

As of current state of things, I didn't touch this since our last discussion.
This is not critical improvement, so lets drop this until the main issues are
solved.

> 
> > 
> > Signed-off-by: Stanislav Lisovskiy <stanislav.lisovskiy@intel.com>
> > ---
> >  drivers/gpu/drm/i915/display/intel_display.c | 22 ++++++++++----------
> >  1 file changed, 11 insertions(+), 11 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/drm/i915/display/intel_display.c
> > index 00ac65a140298..916c13a149fd5 100644
> > --- a/drivers/gpu/drm/i915/display/intel_display.c
> > +++ b/drivers/gpu/drm/i915/display/intel_display.c
> > @@ -3535,7 +3535,6 @@ static u8 hsw_enabled_transcoders(struct intel_crtc *crtc)
> >  	struct drm_i915_private *dev_priv = to_i915(dev);
> >  	u8 panel_transcoder_mask = hsw_panel_transcoders(dev_priv);
> >  	enum transcoder cpu_transcoder;
> > -	u8 master_pipes, slave_pipes;
> >  	u8 enabled_transcoders = 0;
> >  
> >  	/*
> > @@ -3586,15 +3585,6 @@ static u8 hsw_enabled_transcoders(struct intel_crtc *crtc)
> >  	if (transcoder_ddi_func_is_enabled(dev_priv, cpu_transcoder))
> >  		enabled_transcoders |= BIT(cpu_transcoder);
> >  
> > -	/* bigjoiner slave -> consider the master pipe's transcoder as well */
> > -	enabled_bigjoiner_pipes(dev_priv, &master_pipes, &slave_pipes);
> > -	if (slave_pipes & BIT(crtc->pipe)) {
> > -		cpu_transcoder = (enum transcoder)
> > -			get_bigjoiner_master_pipe(crtc->pipe, master_pipes, slave_pipes);
> > -		if (transcoder_ddi_func_is_enabled(dev_priv, cpu_transcoder))
> > -			enabled_transcoders |= BIT(cpu_transcoder);
> > -	}
> > -
> >  	return enabled_transcoders;
> >  }
> >  
> > @@ -3641,6 +3631,15 @@ static bool hsw_get_transcoder_state(struct intel_crtc *crtc,
> >  	u32 tmp;
> >  
> >  	enabled_transcoders = hsw_enabled_transcoders(crtc);
> > +
> > +	/* bigjoiner slave -> consider the master pipe's transcoder as well */
> > +	if (intel_crtc_is_bigjoiner_slave(pipe_config)) {
> > +		unsigned long cpu_transcoder = (enum transcoder)
> > +			bigjoiner_master_pipe(pipe_config);
> > +		if (transcoder_ddi_func_is_enabled(dev_priv, cpu_transcoder))
> > +			enabled_transcoders |= BIT(cpu_transcoder);
> > +	}
> > +
> >  	if (!enabled_transcoders)
> >  		return false;
> >  
> > @@ -3745,6 +3744,8 @@ static bool hsw_get_pipe_config(struct intel_crtc *crtc,
> >  
> >  	pipe_config->shared_dpll = NULL;
> >  
> > +	intel_bigjoiner_get_config(pipe_config);
> > +
> >  	active = hsw_get_transcoder_state(crtc, pipe_config, &crtc->hw_readout_power_domains);
> >  
> >  	if ((IS_GEMINILAKE(dev_priv) || IS_BROXTON(dev_priv)) &&
> > @@ -3756,7 +3757,6 @@ static bool hsw_get_pipe_config(struct intel_crtc *crtc,
> >  	if (!active)
> >  		goto out;
> >  
> > -	intel_bigjoiner_get_config(pipe_config);
> >  	intel_dsc_get_config(pipe_config);
> >  
> >  	if (!transcoder_is_dsi(pipe_config->cpu_transcoder) ||
> > -- 
> > 2.37.3
> 
> -- 
> Ville Syrjälä
> Intel
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 00ac65a140298..916c13a149fd5 100644
--- a/drivers/gpu/drm/i915/display/intel_display.c
+++ b/drivers/gpu/drm/i915/display/intel_display.c
@@ -3535,7 +3535,6 @@  static u8 hsw_enabled_transcoders(struct intel_crtc *crtc)
 	struct drm_i915_private *dev_priv = to_i915(dev);
 	u8 panel_transcoder_mask = hsw_panel_transcoders(dev_priv);
 	enum transcoder cpu_transcoder;
-	u8 master_pipes, slave_pipes;
 	u8 enabled_transcoders = 0;
 
 	/*
@@ -3586,15 +3585,6 @@  static u8 hsw_enabled_transcoders(struct intel_crtc *crtc)
 	if (transcoder_ddi_func_is_enabled(dev_priv, cpu_transcoder))
 		enabled_transcoders |= BIT(cpu_transcoder);
 
-	/* bigjoiner slave -> consider the master pipe's transcoder as well */
-	enabled_bigjoiner_pipes(dev_priv, &master_pipes, &slave_pipes);
-	if (slave_pipes & BIT(crtc->pipe)) {
-		cpu_transcoder = (enum transcoder)
-			get_bigjoiner_master_pipe(crtc->pipe, master_pipes, slave_pipes);
-		if (transcoder_ddi_func_is_enabled(dev_priv, cpu_transcoder))
-			enabled_transcoders |= BIT(cpu_transcoder);
-	}
-
 	return enabled_transcoders;
 }
 
@@ -3641,6 +3631,15 @@  static bool hsw_get_transcoder_state(struct intel_crtc *crtc,
 	u32 tmp;
 
 	enabled_transcoders = hsw_enabled_transcoders(crtc);
+
+	/* bigjoiner slave -> consider the master pipe's transcoder as well */
+	if (intel_crtc_is_bigjoiner_slave(pipe_config)) {
+		unsigned long cpu_transcoder = (enum transcoder)
+			bigjoiner_master_pipe(pipe_config);
+		if (transcoder_ddi_func_is_enabled(dev_priv, cpu_transcoder))
+			enabled_transcoders |= BIT(cpu_transcoder);
+	}
+
 	if (!enabled_transcoders)
 		return false;
 
@@ -3745,6 +3744,8 @@  static bool hsw_get_pipe_config(struct intel_crtc *crtc,
 
 	pipe_config->shared_dpll = NULL;
 
+	intel_bigjoiner_get_config(pipe_config);
+
 	active = hsw_get_transcoder_state(crtc, pipe_config, &crtc->hw_readout_power_domains);
 
 	if ((IS_GEMINILAKE(dev_priv) || IS_BROXTON(dev_priv)) &&
@@ -3756,7 +3757,6 @@  static bool hsw_get_pipe_config(struct intel_crtc *crtc,
 	if (!active)
 		goto out;
 
-	intel_bigjoiner_get_config(pipe_config);
 	intel_dsc_get_config(pipe_config);
 
 	if (!transcoder_is_dsi(pipe_config->cpu_transcoder) ||