RE: [PATCH 10/14] drm/i915/hdmi: Add helper to check if DSC chunksize fits the sink limits
"Kandpal, Suraj" <[email protected]> Mon, 3 Aug 2026 05:28:24 +0000
| Newsgroups | org.freedesktop.lists.intel-gfx,org.freedesktop.lists.intel-xe |
|---|---|
| Message-ID | <DS4PPFE901A304F06DB45DFEB63A3919B32E3D52@DS4PPFE901A304F.namprd11.prod.outlook.com> |
> Subject: [PATCH 10/14] drm/i915/hdmi: Add helper to check if DSC chunksiz= e > fits the sink limits >=20 > Introduce the helper intel_hdmi_dsc_bpp_fits_chunk_bytes() to check wheth= er > the chunksize computed for the given slice configuration is with in the s= ink's > max chunksize limits. >=20 > Signed-off-by: Ankit Nautiyal <[email protected]> LGTM, Reviewed-by: Suraj Kandpal <[email protected]> > --- > drivers/gpu/drm/i915/display/intel_hdmi.c | 25 ++++++++++++++++++++--- > drivers/gpu/drm/i915/display/intel_hdmi.h | 2 ++ > 2 files changed, 24 insertions(+), 3 deletions(-) >=20 > diff --git a/drivers/gpu/drm/i915/display/intel_hdmi.c > b/drivers/gpu/drm/i915/display/intel_hdmi.c > index c58c9202fc10..c26a3d0b2d2e 100644 > --- a/drivers/gpu/drm/i915/display/intel_hdmi.c > +++ b/drivers/gpu/drm/i915/display/intel_hdmi.c > @@ -3370,11 +3370,30 @@ intel_hdmi_dsc_get_min_max_bpp(enum > intel_output_format output_format, u8 bpc, > *max_dsc_bpp =3D min(*max_dsc_bpp, 12); } >=20 > +/* > + * intel_hdmi_dsc_bpp_fits_chunk_bytes - check if a given compressed > +bpp keeps > + * the per-scanline chunk size within the sink's max_chunk_bytes limit. > + * > + * @bpp: compressed bits per pixel to test > + * @num_slices: num of slices supported by the source and sink > + * @slice_width: dsc slice width supported by the source and sink > + * @hdmi_max_chunk_bytes: max bytes in a line of chunks supported by > +sink > + * > + * @return: true if the resulting chunk size fits the sink limit */ > +bool intel_hdmi_dsc_bpp_fits_chunk_bytes(int bpp, int num_slices, int > +slice_width, > + int hdmi_max_chunk_bytes) > +{ > + int target_bytes =3D DIV_ROUND_UP((num_slices * slice_width * bpp), 8); > + > + return target_bytes <=3D hdmi_max_chunk_bytes; } > + > static int > get_dsc_compressed_bpp(int num_slices, int slice_width, int > hdmi_max_chunk_bytes, > int src_fractional_bpp, int min_dsc_bpp, int max_dsc_bpp) > { > - int target_bytes; > bool bpp_found =3D false; > int bpp_decrement_x16; > int bpp_target; > @@ -3409,8 +3428,8 @@ get_dsc_compressed_bpp(int num_slices, int > slice_width, int hdmi_max_chunk_bytes > int bpp; >=20 > bpp =3D DIV_ROUND_UP(bpp_target_x16, 16); > - target_bytes =3D DIV_ROUND_UP((num_slices * slice_width * > bpp), 8); > - if (target_bytes <=3D hdmi_max_chunk_bytes) { > + if (intel_hdmi_dsc_bpp_fits_chunk_bytes(bpp, num_slices, > slice_width, > + > hdmi_max_chunk_bytes)) { > bpp_found =3D true; > break; > } > diff --git a/drivers/gpu/drm/i915/display/intel_hdmi.h > b/drivers/gpu/drm/i915/display/intel_hdmi.h > index dc81a62aac5e..e7d0cd5bc293 100644 > --- a/drivers/gpu/drm/i915/display/intel_hdmi.h > +++ b/drivers/gpu/drm/i915/display/intel_hdmi.h > @@ -59,6 +59,8 @@ int intel_hdmi_dsc_get_bpp(int src_fractional_bpp, int > slice_width, > int bpc, bool hdmi_all_bpp, int > hdmi_max_chunk_bytes); void intel_hdmi_dsc_get_min_max_bpp(enum > intel_output_format output_format, u8 bpc, > bool hdmi_all_bpp, int *min_dsc_bpp, int > *max_dsc_bpp); > +bool intel_hdmi_dsc_bpp_fits_chunk_bytes(int bpp, int num_slices, int > slice_width, > + int hdmi_max_chunk_bytes); > 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, > -- > 2.50.1