Message ID | 20230329-rfc-msm-dsc-helper-v10-1-4cb21168c227@quicinc.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | Introduce MSM-specific DSC helpers | expand |
On 2023-05-12 14:32:11, Jessica Zhang wrote: > > Add helpers to calculate det_thresh_flatness and initial_scale_value as > these calculations are defined within the DSC spec. > > Reviewed-by: Marijn Suijten <marijn.suijten@somainline.org> > Signed-off-by: Jessica Zhang <quic_jesszhan@quicinc.com> > --- > include/drm/display/drm_dsc_helper.h | 10 ++++++++++ > 1 file changed, 10 insertions(+) > > diff --git a/include/drm/display/drm_dsc_helper.h b/include/drm/display/drm_dsc_helper.h > index 0bb0c3afd740..060b22ec02eb 100644 > --- a/include/drm/display/drm_dsc_helper.h > +++ b/include/drm/display/drm_dsc_helper.h > @@ -25,5 +25,15 @@ void drm_dsc_set_rc_buf_thresh(struct drm_dsc_config *vdsc_cfg); > int drm_dsc_setup_rc_params(struct drm_dsc_config *vdsc_cfg, enum drm_dsc_params_kind kind); > int drm_dsc_compute_rc_parameters(struct drm_dsc_config *vdsc_cfg); > > +static inline int drm_dsc_initial_scale_value(const struct drm_dsc_config *dsc) Should this truncate and return u8? > +{ > + return 8 * dsc->rc_model_size / (dsc->rc_model_size - dsc->initial_offset); > +} > + > +static inline int drm_dsc_flatness_det_thresh(const struct drm_dsc_config *dsc) Should this return u32? - Marijn > +{ > + return 2 << (dsc->bits_per_component - 8); > +} > + > #endif /* _DRM_DSC_HELPER_H_ */ > > > -- > 2.40.1 >
On 5/13/2023 1:28 PM, Marijn Suijten wrote: > On 2023-05-12 14:32:11, Jessica Zhang wrote: >> >> Add helpers to calculate det_thresh_flatness and initial_scale_value as >> these calculations are defined within the DSC spec. >> >> Reviewed-by: Marijn Suijten <marijn.suijten@somainline.org> >> Signed-off-by: Jessica Zhang <quic_jesszhan@quicinc.com> >> --- >> include/drm/display/drm_dsc_helper.h | 10 ++++++++++ >> 1 file changed, 10 insertions(+) >> >> diff --git a/include/drm/display/drm_dsc_helper.h b/include/drm/display/drm_dsc_helper.h >> index 0bb0c3afd740..060b22ec02eb 100644 >> --- a/include/drm/display/drm_dsc_helper.h >> +++ b/include/drm/display/drm_dsc_helper.h >> @@ -25,5 +25,15 @@ void drm_dsc_set_rc_buf_thresh(struct drm_dsc_config *vdsc_cfg); >> int drm_dsc_setup_rc_params(struct drm_dsc_config *vdsc_cfg, enum drm_dsc_params_kind kind); >> int drm_dsc_compute_rc_parameters(struct drm_dsc_config *vdsc_cfg); >> >> +static inline int drm_dsc_initial_scale_value(const struct drm_dsc_config *dsc) > > Should this truncate and return u8? Hi Marijn, Acked. > >> +{ >> + return 8 * dsc->rc_model_size / (dsc->rc_model_size - dsc->initial_offset); >> +} >> + >> +static inline int drm_dsc_flatness_det_thresh(const struct drm_dsc_config *dsc) > > Should this return u32? Acked. Thanks, Jessica Zhang > > - Marijn > >> +{ >> + return 2 << (dsc->bits_per_component - 8); >> +} >> + >> #endif /* _DRM_DSC_HELPER_H_ */ >> >> >> -- >> 2.40.1 >>
diff --git a/include/drm/display/drm_dsc_helper.h b/include/drm/display/drm_dsc_helper.h index 0bb0c3afd740..060b22ec02eb 100644 --- a/include/drm/display/drm_dsc_helper.h +++ b/include/drm/display/drm_dsc_helper.h @@ -25,5 +25,15 @@ void drm_dsc_set_rc_buf_thresh(struct drm_dsc_config *vdsc_cfg); int drm_dsc_setup_rc_params(struct drm_dsc_config *vdsc_cfg, enum drm_dsc_params_kind kind); int drm_dsc_compute_rc_parameters(struct drm_dsc_config *vdsc_cfg); +static inline int drm_dsc_initial_scale_value(const struct drm_dsc_config *dsc) +{ + return 8 * dsc->rc_model_size / (dsc->rc_model_size - dsc->initial_offset); +} + +static inline int drm_dsc_flatness_det_thresh(const struct drm_dsc_config *dsc) +{ + return 2 << (dsc->bits_per_component - 8); +} + #endif /* _DRM_DSC_HELPER_H_ */