[Intel-gfx] [PATCH v2 05/12] drm/i915: Factor out set_encoder_for_connector()

Ville Syrjälä ville.syrjala at linux.intel.com
Thu May 4 14:48:31 UTC 2023


On Thu, May 04, 2023 at 02:10:41AM +0300, Imre Deak wrote:
> Factor out a function setting the encoder and CRTC in the connector
> atomic state, required by a follow up patch.
> 
> No functional changes.
> 
> Signed-off-by: Imre Deak <imre.deak at intel.com>

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

> ---
>  .../drm/i915/display/intel_modeset_setup.c    | 28 +++++++++++++------
>  1 file changed, 19 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/display/intel_modeset_setup.c b/drivers/gpu/drm/i915/display/intel_modeset_setup.c
> index 922ea5ddd0c5b..9848d20582963 100644
> --- a/drivers/gpu/drm/i915/display/intel_modeset_setup.c
> +++ b/drivers/gpu/drm/i915/display/intel_modeset_setup.c
> @@ -87,6 +87,24 @@ static void intel_crtc_disable_noatomic_begin(struct intel_crtc *crtc,
>  	}
>  }
>  
> +static void set_encoder_for_connector(struct intel_connector *connector,
> +				      struct intel_encoder *encoder)
> +{
> +	struct drm_connector_state *conn_state = connector->base.state;
> +
> +	if (conn_state->crtc)
> +		drm_connector_put(&connector->base);
> +
> +	if (encoder) {
> +		conn_state->best_encoder = &encoder->base;
> +		conn_state->crtc = encoder->base.crtc;
> +		drm_connector_get(&connector->base);
> +	} else {
> +		conn_state->best_encoder = NULL;
> +		conn_state->crtc = NULL;
> +	}
> +}
> +
>  static void intel_crtc_disable_noatomic_complete(struct intel_crtc *crtc)
>  {
>  	struct intel_encoder *encoder;
> @@ -141,8 +159,7 @@ static void intel_modeset_update_connector_atomic_state(struct drm_i915_private
>  		struct intel_encoder *encoder =
>  			to_intel_encoder(connector->base.encoder);
>  
> -		if (conn_state->crtc)
> -			drm_connector_put(&connector->base);
> +		set_encoder_for_connector(connector, encoder);
>  
>  		if (encoder) {
>  			struct intel_crtc *crtc =
> @@ -150,14 +167,7 @@ static void intel_modeset_update_connector_atomic_state(struct drm_i915_private
>  			const struct intel_crtc_state *crtc_state =
>  				to_intel_crtc_state(crtc->base.state);
>  
> -			conn_state->best_encoder = &encoder->base;
> -			conn_state->crtc = &crtc->base;
>  			conn_state->max_bpc = (crtc_state->pipe_bpp ?: 24) / 3;
> -
> -			drm_connector_get(&connector->base);
> -		} else {
> -			conn_state->best_encoder = NULL;
> -			conn_state->crtc = NULL;
>  		}
>  	}
>  	drm_connector_list_iter_end(&conn_iter);
> -- 
> 2.37.2

-- 
Ville Syrjälä
Intel


More information about the Intel-gfx mailing list