Re: [PATCH v2 03/12] drm/i915/dp: Extract intel_dp_has_audio()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




> -----Original Message-----
> From: Intel-gfx <intel-gfx-bounces@xxxxxxxxxxxxxxxxxxxxx> On Behalf Of Ville Syrjala
> Sent: Tuesday, March 22, 2022 5:30 PM
> To: intel-gfx@xxxxxxxxxxxxxxxxxxxxx
> Subject:  [PATCH v2 03/12] drm/i915/dp: Extract intel_dp_has_audio()
> 
> From: Ville Syrjälä <ville.syrjala@xxxxxxxxxxxxxxx>
> 
> Declutter intel_dp_compute_config() a bit by moving the has_audio computation
> into a helper. HDMI already does the same thing.

Looks Good to me.
Reviewed-by: Uma Shankar <uma.shankar@xxxxxxxxx>

> Signed-off-by: Ville Syrjälä <ville.syrjala@xxxxxxxxxxxxxxx>
> ---
>  drivers/gpu/drm/i915/display/intel_dp.c | 30 ++++++++++++++++---------
>  1 file changed, 20 insertions(+), 10 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/display/intel_dp.c
> b/drivers/gpu/drm/i915/display/intel_dp.c
> index 3394e4951fef..fc50802c9997 100644
> --- a/drivers/gpu/drm/i915/display/intel_dp.c
> +++ b/drivers/gpu/drm/i915/display/intel_dp.c
> @@ -1798,6 +1798,24 @@ intel_dp_compute_hdr_metadata_infoframe_sdp(struct
> intel_dp *intel_dp,
> 
> 	intel_hdmi_infoframe_enable(HDMI_PACKET_TYPE_GAMUT_METADATA);
>  }
> 
> +static bool intel_dp_has_audio(struct intel_encoder *encoder,
> +			       const struct intel_crtc_state *crtc_state,
> +			       const struct drm_connector_state *conn_state) {
> +	struct drm_i915_private *i915 = to_i915(encoder->base.dev);
> +	struct intel_dp *intel_dp = enc_to_intel_dp(encoder);
> +	const struct intel_digital_connector_state *intel_conn_state =
> +		to_intel_digital_connector_state(conn_state);
> +
> +	if (!intel_dp_port_has_audio(i915, encoder->port))
> +		return false;
> +
> +	if (intel_conn_state->force_audio == HDMI_AUDIO_AUTO)
> +		return intel_dp->has_audio;
> +	else
> +		return intel_conn_state->force_audio == HDMI_AUDIO_ON; }
> +
>  int
>  intel_dp_compute_config(struct intel_encoder *encoder,
>  			struct intel_crtc_state *pipe_config, @@ -1807,14
> +1825,11 @@ intel_dp_compute_config(struct intel_encoder *encoder,
>  	struct drm_display_mode *adjusted_mode = &pipe_config-
> >hw.adjusted_mode;
>  	struct intel_dp *intel_dp = enc_to_intel_dp(encoder);
>  	const struct drm_display_mode *fixed_mode;
> -	enum port port = encoder->port;
>  	struct intel_connector *intel_connector = intel_dp->attached_connector;
> -	struct intel_digital_connector_state *intel_conn_state =
> -		to_intel_digital_connector_state(conn_state);
>  	bool constant_n = drm_dp_has_quirk(&intel_dp->desc,
> DP_DPCD_QUIRK_CONSTANT_N);
>  	int ret = 0, output_bpp;
> 
> -	if (HAS_PCH_SPLIT(dev_priv) && !HAS_DDI(dev_priv) && port != PORT_A)
> +	if (HAS_PCH_SPLIT(dev_priv) && !HAS_DDI(dev_priv) && encoder->port !=
> +PORT_A)
>  		pipe_config->has_pch_encoder = true;
> 
>  	pipe_config->output_format = intel_dp_output_format(&intel_connector-
> >base,
> @@ -1826,12 +1841,7 @@ intel_dp_compute_config(struct intel_encoder
> *encoder,
>  			return ret;
>  	}
> 
> -	if (!intel_dp_port_has_audio(dev_priv, port))
> -		pipe_config->has_audio = false;
> -	else if (intel_conn_state->force_audio == HDMI_AUDIO_AUTO)
> -		pipe_config->has_audio = intel_dp->has_audio;
> -	else
> -		pipe_config->has_audio = intel_conn_state->force_audio ==
> HDMI_AUDIO_ON;
> +	pipe_config->has_audio = intel_dp_has_audio(encoder, pipe_config,
> +conn_state);
> 
>  	fixed_mode = intel_panel_fixed_mode(intel_connector, adjusted_mode);
>  	if (intel_dp_is_edp(intel_dp) && fixed_mode) {
> --
> 2.34.1





[Index of Archives]     [AMD Graphics]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux