> Subject: [PATCH 02/14] drm/i915/display: Generalize
> intel_hdmi_dsc_get_num_slices helper
> 
> Refactor intel_hdmi_dsc_get_num_slices to remove dependency on
> intel_crtc_state structure by accepting display mode and output format as
> parameters instead.
> 
> This makes the function reusable for mode_valid cases where crtc_state is not
> there.

Nit: *is not present

> 
> Signed-off-by: Ankit Nautiyal <[email protected]>

LGTM,
Reviewed-by: Suraj Kandpal <[email protected]>

> ---
>  drivers/gpu/drm/i915/display/intel_dp.c   |  4 +++-
>  drivers/gpu/drm/i915/display/intel_hdmi.c | 14 ++++++++------
> drivers/gpu/drm/i915/display/intel_hdmi.h |  4 +++-
>  3 files changed, 14 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/display/intel_dp.c
> b/drivers/gpu/drm/i915/display/intel_dp.c
> index 113d767e62e9..db64e6582286 100644
> --- a/drivers/gpu/drm/i915/display/intel_dp.c
> +++ b/drivers/gpu/drm/i915/display/intel_dp.c
> @@ -4316,7 +4316,9 @@ intel_dp_pcon_dsc_enc_slices(struct intel_dp
> *intel_dp,
>       int pcon_max_slices = drm_dp_pcon_dsc_max_slices(intel_dp-
> >pcon_dsc_dpcd);
>       int pcon_max_slice_width =
> drm_dp_pcon_dsc_max_slice_width(intel_dp->pcon_dsc_dpcd);
> 
> -     return intel_hdmi_dsc_get_num_slices(crtc_state, pcon_max_slices,
> +     return intel_hdmi_dsc_get_num_slices(&crtc_state-
> >hw.adjusted_mode,
> +                                          crtc_state->output_format,
> +                                          pcon_max_slices,
>                                            pcon_max_slice_width,
>                                            hdmi_max_slices,
> hdmi_throughput);  } diff --git a/drivers/gpu/drm/i915/display/intel_hdmi.c
> b/drivers/gpu/drm/i915/display/intel_hdmi.c
> index 9af0f3aba0fc..228c5e2be164 100644
> --- a/drivers/gpu/drm/i915/display/intel_hdmi.c
> +++ b/drivers/gpu/drm/i915/display/intel_hdmi.c
> @@ -3216,7 +3216,8 @@ int intel_hdmi_dsc_get_slice_height(int vactive)
>   * intel_hdmi_dsc_get_num_slices - get no. of dsc slices based on dsc encoder
>   * and dsc decoder capabilities
>   *
> - * @crtc_state: intel crtc_state
> + * @mode: drm_display_mode for which num of slices are needed
> + * @output_format : pipe output format
>   * @src_max_slices: maximum slices supported by the DSC encoder
>   * @src_max_slice_width: maximum slice width supported by DSC encoder
>   * @hdmi_max_slices: maximum slices supported by sink DSC decoder @@ -
> 3226,7 +3227,8 @@ int intel_hdmi_dsc_get_slice_height(int vactive)
>   * and decoder.
>   */
>  int
> -intel_hdmi_dsc_get_num_slices(const struct intel_crtc_state *crtc_state,
> +intel_hdmi_dsc_get_num_slices(const struct drm_display_mode *mode,
> +                           enum intel_output_format output_format,
>                             int src_max_slices, int src_max_slice_width,
>                             int hdmi_max_slices, int hdmi_throughput)  { @@ -
> 3248,7 +3250,7 @@ intel_hdmi_dsc_get_num_slices(const struct
> intel_crtc_state *crtc_state,
>       int max_throughput; /* max clock freq. in khz per slice */
>       int max_slice_width;
>       int slice_width;
> -     int pixel_clock = crtc_state->hw.adjusted_mode.crtc_clock;
> +     int pixel_clock = mode->crtc_clock;
> 
>       if (!hdmi_throughput)
>               return 0;
> @@ -3259,8 +3261,8 @@ intel_hdmi_dsc_get_num_slices(const struct
> intel_crtc_state *crtc_state,
>        * for 4:4:4 is 1.0. Multiplying these factors by 10 and later
>        * dividing adjusted clock value by 10.
>        */
> -     if (crtc_state->output_format == INTEL_OUTPUT_FORMAT_YCBCR444
> ||
> -         crtc_state->output_format == INTEL_OUTPUT_FORMAT_RGB)
> +     if (output_format == INTEL_OUTPUT_FORMAT_YCBCR444 ||
> +         output_format == INTEL_OUTPUT_FORMAT_RGB)
>               kslice_adjust = 10;
>       else
>               kslice_adjust = 5;
> @@ -3315,7 +3317,7 @@ intel_hdmi_dsc_get_num_slices(const struct
> intel_crtc_state *crtc_state,
>               else
>                       return 0;
> 
> -             slice_width = DIV_ROUND_UP(crtc_state-
> >hw.adjusted_mode.hdisplay, target_slices);
> +             slice_width = DIV_ROUND_UP(mode->hdisplay, target_slices);
>               if (slice_width >= max_slice_width)
>                       min_slices = target_slices + 1;
>       } while (slice_width >= max_slice_width); diff --git
> a/drivers/gpu/drm/i915/display/intel_hdmi.h
> b/drivers/gpu/drm/i915/display/intel_hdmi.h
> index fb950fdd0e7a..4e2228ca0c5b 100644
> --- a/drivers/gpu/drm/i915/display/intel_hdmi.h
> +++ b/drivers/gpu/drm/i915/display/intel_hdmi.h
> @@ -13,6 +13,7 @@ enum intel_output_format;  enum port;  struct
> drm_connector;  struct drm_connector_state;
> +struct drm_display_mode;
>  struct drm_encoder;
>  struct intel_connector;
>  struct intel_crtc_state;
> @@ -56,7 +57,8 @@ int intel_hdmi_tmds_clock(int clock, int bpc, enum
> intel_output_format sink_form  int intel_hdmi_dsc_get_bpp(int
> src_fractional_bpp, int slice_width,
>                          int num_slices, enum intel_output_format
> output_format,
>                          bool hdmi_all_bpp, int hdmi_max_chunk_bytes); -int
> intel_hdmi_dsc_get_num_slices(const struct intel_crtc_state *crtc_state,
> +int intel_hdmi_dsc_get_num_slices(const struct drm_display_mode *mode,
> +                               enum intel_output_format output_format,
>                                 int src_max_slices, int src_max_slice_width,
>                                 int hdmi_max_slices, int hdmi_throughput);
> int intel_hdmi_dsc_get_slice_height(int vactive);
> --
> 2.50.1

Reply via email to