On Fri, 2025-12-12 at 20:17 +0200, Imre Deak wrote: > Add intel_dp_dsc_get_slice_config() to compute the detailed slice > configuration and determine the slices-per-line value (returned by > intel_dp_dsc_get_slice_count()) using this function. > > v2: Fix incorrectly returning false from > intel_dp_dsc_min_slice_count() > due to rebase fail. (Jouni)
Reviewed-by: Jouni Högander <[email protected]> > > Cc: Jouni Högander <[email protected]> > Signed-off-by: Imre Deak <[email protected]> > --- > drivers/gpu/drm/i915/display/intel_dp.c | 31 ++++++++++++++++++++--- > -- > 1 file changed, 25 insertions(+), 6 deletions(-) > > diff --git a/drivers/gpu/drm/i915/display/intel_dp.c > b/drivers/gpu/drm/i915/display/intel_dp.c > index ff776bf3b0366..1808020877d19 100644 > --- a/drivers/gpu/drm/i915/display/intel_dp.c > +++ b/drivers/gpu/drm/i915/display/intel_dp.c > @@ -1018,9 +1018,11 @@ static int intel_dp_dsc_min_slice_count(const > struct intel_connector *connector, > return min_slice_count; > } > > -u8 intel_dp_dsc_get_slice_count(const struct intel_connector > *connector, > - int mode_clock, int mode_hdisplay, > - int num_joined_pipes) > +static bool > +intel_dp_dsc_get_slice_config(const struct intel_connector > *connector, > + int mode_clock, int mode_hdisplay, > + int num_joined_pipes, > + struct intel_dsc_slice_config > *config_ret) > { > struct intel_display *display = to_intel_display(connector); > int min_slice_count = > @@ -1057,8 +1059,11 @@ u8 intel_dp_dsc_get_slice_count(const struct > intel_connector *connector, > if (mode_hdisplay % slices_per_line) > continue; > > - if (min_slice_count <= slices_per_line) > - return slices_per_line; > + if (min_slice_count <= slices_per_line) { > + *config_ret = config; > + > + return true; > + } > } > > /* Print slice count 1,2,4,..24 if bit#0,1,3,..23 is set in > the mask. */ > @@ -1069,7 +1074,21 @@ u8 intel_dp_dsc_get_slice_count(const struct > intel_connector *connector, > min_slice_count, > (int)BITS_PER_TYPE(sink_slice_count_mask), > &sink_slice_count_mask); > > - return 0; > + return false; > +} > + > +u8 intel_dp_dsc_get_slice_count(const struct intel_connector > *connector, > + int mode_clock, int mode_hdisplay, > + int num_joined_pipes) > +{ > + struct intel_dsc_slice_config config; > + > + if (!intel_dp_dsc_get_slice_config(connector, > + mode_clock, > mode_hdisplay, > + num_joined_pipes, > &config)) > + return 0; > + > + return intel_dsc_line_slice_count(&config); > } > > static bool source_can_output(struct intel_dp *intel_dp,
