[PATCH 3/5] drm/i915/dp: Return int from dsc_max/min_src_input_bpc helpers

Kandpal, Suraj suraj.kandpal at intel.com
Thu Sep 26 08:53:41 UTC 2024



> -----Original Message-----
> From: Intel-gfx <intel-gfx-bounces at lists.freedesktop.org> On Behalf Of Ankit
> Nautiyal
> Sent: Wednesday, December 13, 2023 2:47 PM
> To: intel-gfx at lists.freedesktop.org
> Cc: Nikula, Jani <jani.nikula at intel.com>
> Subject: [PATCH 3/5] drm/i915/dp: Return int from
> dsc_max/min_src_input_bpc helpers
> 
> Use ints for dsc_max/min_bpc instead of u8 in dsc_max/min_src_input_bpc
> helpers and their callers.
> This will also help replace min_t/max_t macros with min/max ones.
> 
> Signed-off-by: Ankit Nautiyal <ankit.k.nautiyal at intel.com>

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

> ---
>  drivers/gpu/drm/i915/display/intel_dp.c | 18 +++++++++---------
>  1 file changed, 9 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/display/intel_dp.c
> b/drivers/gpu/drm/i915/display/intel_dp.c
> index b2e767a87476..1f95ba9cf5fd 100644
> --- a/drivers/gpu/drm/i915/display/intel_dp.c
> +++ b/drivers/gpu/drm/i915/display/intel_dp.c
> @@ -1627,7 +1627,7 @@ intel_dp_compute_link_config_wide(struct
> intel_dp *intel_dp,  }
> 
>  static
> -u8 intel_dp_dsc_max_src_input_bpc(struct drm_i915_private *i915)
> +int intel_dp_dsc_max_src_input_bpc(struct drm_i915_private *i915)
>  {
>  	if (!HAS_DSC(i915))
>  		return 0;
> @@ -1645,14 +1645,14 @@ int intel_dp_dsc_compute_max_bpp(const
> struct intel_connector *connector,
>  	struct drm_i915_private *i915 = to_i915(connector->base.dev);
>  	int i, num_bpc;
>  	u8 dsc_bpc[3] = {};
> -	u8 dsc_max_bpc;
> +	int dsc_max_bpc;
> 
>  	dsc_max_bpc = intel_dp_dsc_max_src_input_bpc(i915);
> 
>  	if (!dsc_max_bpc)
>  		return dsc_max_bpc;
> 
> -	dsc_max_bpc = min_t(u8, dsc_max_bpc, max_req_bpc);
> +	dsc_max_bpc = min(dsc_max_bpc, max_req_bpc);
> 
>  	num_bpc = drm_dp_dsc_sink_supported_input_bpcs(connector-
> >dp.dsc_dpcd,
>  						       dsc_bpc);
> @@ -2027,7 +2027,7 @@ static int dsc_compute_compressed_bpp(struct
> intel_dp *intel_dp,  }
> 
>  static
> -u8 intel_dp_dsc_min_src_input_bpc(struct drm_i915_private *i915)
> +int intel_dp_dsc_min_src_input_bpc(struct drm_i915_private *i915)
>  {
>  	/* Min DSC Input BPC for ICL+ is 8 */
>  	return HAS_DSC(i915) ? 8 : 0;
> @@ -2039,7 +2039,7 @@ bool is_dsc_pipe_bpp_sufficient(struct
> drm_i915_private *i915,
>  				struct link_config_limits *limits,
>  				int pipe_bpp)
>  {
> -	u8 dsc_max_bpc, dsc_min_bpc, dsc_max_pipe_bpp,
> dsc_min_pipe_bpp;
> +	int dsc_max_bpc, dsc_min_bpc, dsc_max_pipe_bpp,
> dsc_min_pipe_bpp;
> 
>  	dsc_max_bpc = min(intel_dp_dsc_max_src_input_bpc(i915),
> conn_state->max_requested_bpc);
>  	dsc_min_bpc = intel_dp_dsc_min_src_input_bpc(i915);
> @@ -2084,9 +2084,9 @@ static int intel_dp_dsc_compute_pipe_bpp(struct
> intel_dp *intel_dp,
>  	struct drm_i915_private *i915 = dp_to_i915(intel_dp);
>  	const struct intel_connector *connector =
>  		to_intel_connector(conn_state->connector);
> -	u8 max_req_bpc = conn_state->max_requested_bpc;
> -	u8 dsc_max_bpc, dsc_max_bpp;
> -	u8 dsc_min_bpc, dsc_min_bpp;
> +	int max_req_bpc = conn_state->max_requested_bpc;
> +	int dsc_max_bpc, dsc_max_bpp;
> +	int dsc_min_bpc, dsc_min_bpp;
>  	u8 dsc_bpc[3] = {};
>  	int forced_bpp, pipe_bpp;
>  	int num_bpc, i, ret;
> @@ -2106,7 +2106,7 @@ static int intel_dp_dsc_compute_pipe_bpp(struct
> intel_dp *intel_dp,
>  	if (!dsc_max_bpc)
>  		return -EINVAL;
> 
> -	dsc_max_bpc = min_t(u8, dsc_max_bpc, max_req_bpc);
> +	dsc_max_bpc = min(dsc_max_bpc, max_req_bpc);
>  	dsc_max_bpp = min(dsc_max_bpc * 3, limits->pipe.max_bpp);
> 
>  	dsc_min_bpc = intel_dp_dsc_min_src_input_bpc(i915);
> --
> 2.40.1



More information about the Intel-gfx mailing list