[PATCH 14/14] drm/i915/dp: Set the DSC link limits intel_dp_compute_config_link_bpp_limits

Kandpal, Suraj suraj.kandpal at intel.com
Wed Dec 11 04:49:38 UTC 2024



> -----Original Message-----
> From: Nautiyal, Ankit K <ankit.k.nautiyal at intel.com>
> Sent: Wednesday, December 4, 2024 2:57 PM
> To: intel-gfx at lists.freedesktop.org
> Cc: intel-xe at lists.freedesktop.org; Kandpal, Suraj <suraj.kandpal at intel.com>;
> jani.nikula at linux.intel.com; Deak, Imre <imre.deak at intel.com>
> Subject: [PATCH 14/14] drm/i915/dp: Set the DSC link limits
> intel_dp_compute_config_link_bpp_limits
> 
> The helper intel_dp_compute_config_link_bpp_limits is the correct place to
> set the DSC link limits. Move the code to this function and remove the #TODO
> item.
> 
> v2: Add argument intel_connector to the helper to get correct connector for
> DP MST. (Imre)
> 

LGTM,
Reviewed-by: Suraj Kandpal <suraj.kandpal at intel.com>

> Signed-off-by: Ankit Nautiyal <ankit.k.nautiyal at intel.com>
> ---
>  drivers/gpu/drm/i915/display/intel_dp.c     | 60 +++++++++++----------
>  drivers/gpu/drm/i915/display/intel_dp.h     |  1 +
>  drivers/gpu/drm/i915/display/intel_dp_mst.c |  1 +
>  3 files changed, 34 insertions(+), 28 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/display/intel_dp.c
> b/drivers/gpu/drm/i915/display/intel_dp.c
> index 60693c301c3d..1500b99ddb95 100644
> --- a/drivers/gpu/drm/i915/display/intel_dp.c
> +++ b/drivers/gpu/drm/i915/display/intel_dp.c
> @@ -2153,21 +2153,16 @@ static int dsc_compute_compressed_bpp(struct
> intel_dp *intel_dp,  {
>  	const struct drm_display_mode *adjusted_mode = &pipe_config-
> >hw.adjusted_mode;
>  	struct drm_i915_private *i915 = dp_to_i915(intel_dp);
> -	int dsc_src_min_bpp, dsc_sink_min_bpp, dsc_min_bpp;
> -	int dsc_src_max_bpp, dsc_sink_max_bpp, dsc_max_bpp;
> +	int dsc_min_bpp;
> +	int dsc_max_bpp;
>  	int dsc_joiner_max_bpp;
>  	int num_joined_pipes = intel_crtc_num_joined_pipes(pipe_config);
> 
> -	dsc_src_min_bpp = dsc_src_min_compressed_bpp();
> -	dsc_sink_min_bpp =
> intel_dp_dsc_sink_min_compressed_bpp(pipe_config);
> -	dsc_min_bpp = max(dsc_src_min_bpp, dsc_sink_min_bpp);
> -	dsc_min_bpp = max(dsc_min_bpp, fxp_q4_to_int_roundup(limits-
> >link.min_bpp_x16));
> +	dsc_min_bpp = fxp_q4_to_int_roundup(limits->link.min_bpp_x16);
> 
> -	dsc_src_max_bpp = dsc_src_max_compressed_bpp(intel_dp);
> -	dsc_sink_max_bpp =
> intel_dp_dsc_sink_max_compressed_bpp(connector,
> -								pipe_config,
> -								pipe_bpp / 3);
> -	dsc_max_bpp = dsc_sink_max_bpp ? min(dsc_sink_max_bpp,
> dsc_src_max_bpp) : dsc_src_max_bpp;
> +	dsc_max_bpp = intel_dp_dsc_sink_max_compressed_bpp(connector,
> +							   pipe_config,
> +							   pipe_bpp / 3);
> 
>  	dsc_joiner_max_bpp = get_max_compressed_bpp_with_joiner(i915,
> adjusted_mode->clock,
> 
> 	adjusted_mode->hdisplay,
> @@ -2278,8 +2273,8 @@ static int intel_edp_dsc_compute_pipe_bpp(struct
> intel_dp *intel_dp,
>  	struct intel_connector *connector =
>  		to_intel_connector(conn_state->connector);
>  	int pipe_bpp, forced_bpp;
> -	int dsc_src_min_bpp, dsc_sink_min_bpp, dsc_min_bpp;
> -	int dsc_src_max_bpp, dsc_sink_max_bpp, dsc_max_bpp;
> +	int dsc_min_bpp;
> +	int dsc_max_bpp;
> 
>  	forced_bpp = intel_dp_force_dsc_pipe_bpp(intel_dp, limits);
> 
> @@ -2299,16 +2294,12 @@ static int
> intel_edp_dsc_compute_pipe_bpp(struct intel_dp *intel_dp,
>  	pipe_config->port_clock = limits->max_rate;
>  	pipe_config->lane_count = limits->max_lane_count;
> 
> -	dsc_src_min_bpp = dsc_src_min_compressed_bpp();
> -	dsc_sink_min_bpp =
> intel_dp_dsc_sink_min_compressed_bpp(pipe_config);
> -	dsc_min_bpp = max(dsc_src_min_bpp, dsc_sink_min_bpp);
> -	dsc_min_bpp = max(dsc_min_bpp, fxp_q4_to_int_roundup(limits-
> >link.min_bpp_x16));
> +	dsc_min_bpp = fxp_q4_to_int_roundup(limits->link.min_bpp_x16);
> +
> +	dsc_max_bpp = intel_dp_dsc_sink_max_compressed_bpp(connector,
> +							   pipe_config,
> +							   pipe_bpp / 3);
> 
> -	dsc_src_max_bpp = dsc_src_max_compressed_bpp(intel_dp);
> -	dsc_sink_max_bpp =
> intel_dp_dsc_sink_max_compressed_bpp(connector,
> -								pipe_config,
> -								pipe_bpp / 3);
> -	dsc_max_bpp = dsc_sink_max_bpp ? min(dsc_sink_max_bpp,
> dsc_src_max_bpp) : dsc_src_max_bpp;
>  	dsc_max_bpp = min(dsc_max_bpp, fxp_q4_to_int(limits-
> >link.max_bpp_x16));
> 
>  	/* Compressed BPP should be less than the Input DSC bpp */ @@ -
> 2447,6 +2438,7 @@ int intel_dp_dsc_compute_config(struct intel_dp
> *intel_dp,
>  /**
>   * intel_dp_compute_config_link_bpp_limits - compute output link bpp limits
>   * @intel_dp: intel DP
> + * @connector: intel connector
>   * @crtc_state: crtc state
>   * @dsc: DSC compression mode
>   * @limits: link configuration limits
> @@ -2458,6 +2450,7 @@ int intel_dp_dsc_compute_config(struct intel_dp
> *intel_dp,
>   */
>  bool
>  intel_dp_compute_config_link_bpp_limits(struct intel_dp *intel_dp,
> +					const struct intel_connector
> *connector,
>  					const struct intel_crtc_state
> *crtc_state,
>  					bool dsc,
>  					struct link_config_limits *limits) @@ -
> 2480,12 +2473,22 @@ intel_dp_compute_config_link_bpp_limits(struct
> intel_dp *intel_dp,
> 
>  		limits->link.min_bpp_x16 = fxp_q4_from_int(limits-
> >pipe.min_bpp);
>  	} else {
> -		/*
> -		 * TODO: set the DSC link limits already here, atm these are
> -		 * initialized only later in intel_edp_dsc_compute_pipe_bpp()
> /
> -		 * intel_dp_dsc_compute_pipe_bpp()
> -		 */
> -		limits->link.min_bpp_x16 = 0;
> +		int dsc_src_min_bpp, dsc_sink_min_bpp, dsc_min_bpp;
> +		int dsc_src_max_bpp, dsc_sink_max_bpp, dsc_max_bpp;
> +
> +		dsc_src_min_bpp = dsc_src_min_compressed_bpp();
> +		dsc_sink_min_bpp =
> intel_dp_dsc_sink_min_compressed_bpp(crtc_state);
> +		dsc_min_bpp = max(dsc_src_min_bpp, dsc_sink_min_bpp);
> +		limits->link.min_bpp_x16 = fxp_q4_from_int(dsc_min_bpp);
> +
> +		dsc_src_max_bpp = dsc_src_max_compressed_bpp(intel_dp);
> +		dsc_sink_max_bpp =
> intel_dp_dsc_sink_max_compressed_bpp(connector,
> +
> 	crtc_state,
> +									limits-
> >pipe.max_bpp / 3);
> +		dsc_max_bpp = dsc_sink_max_bpp ?
> +			      min(dsc_sink_max_bpp, dsc_src_max_bpp) :
> dsc_src_max_bpp;
> +
> +		max_link_bpp_x16 = min(max_link_bpp_x16,
> +fxp_q4_from_int(dsc_max_bpp));
>  	}
> 
>  	limits->link.max_bpp_x16 = max_link_bpp_x16; @@ -2558,6 +2561,7
> @@ intel_dp_compute_config_limits(struct intel_dp *intel_dp,
>  	intel_dp_test_compute_config(intel_dp, crtc_state, limits);
> 
>  	return intel_dp_compute_config_link_bpp_limits(intel_dp,
> +						       intel_dp-
> >attached_connector,
>  						       crtc_state,
>  						       dsc,
>  						       limits);
> diff --git a/drivers/gpu/drm/i915/display/intel_dp.h
> b/drivers/gpu/drm/i915/display/intel_dp.h
> index 1488e18ea8b0..90e8b8672ce0 100644
> --- a/drivers/gpu/drm/i915/display/intel_dp.h
> +++ b/drivers/gpu/drm/i915/display/intel_dp.h
> @@ -197,6 +197,7 @@ int intel_dp_output_bpp(enum intel_output_format
> output_format, int bpp);
> 
>  bool
>  intel_dp_compute_config_link_bpp_limits(struct intel_dp *intel_dp,
> +					const struct intel_connector
> *connector,
>  					const struct intel_crtc_state
> *crtc_state,
>  					bool dsc,
>  					struct link_config_limits *limits); diff --
> git a/drivers/gpu/drm/i915/display/intel_dp_mst.c
> b/drivers/gpu/drm/i915/display/intel_dp_mst.c
> index 667006918bfd..47eed76b136f 100644
> --- a/drivers/gpu/drm/i915/display/intel_dp_mst.c
> +++ b/drivers/gpu/drm/i915/display/intel_dp_mst.c
> @@ -574,6 +574,7 @@ mst_stream_compute_config_limits(struct intel_dp
> *intel_dp,
>  		intel_dp_dsc_compute_pipe_bpp_limits(intel_dp, limits);
> 
>  	if (!intel_dp_compute_config_link_bpp_limits(intel_dp,
> +						     connector,
>  						     crtc_state,
>  						     dsc,
>  						     limits))
> --
> 2.45.2



More information about the Intel-gfx mailing list