Message ID | 20230329-rfc-msm-dsc-helper-v12-3-9cdb7401f614@quicinc.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | Introduce MSM-specific DSC helpers | expand |
On 18/05/2023 01:27, Jessica Zhang wrote: > Add helper to get the integer value of drm_dsc_config.bits_per_pixel > > Reviewed-by: Marijn Suijten <marijn.suijten@somainline.org> > Signed-off-by: Jessica Zhang <quic_jesszhan@quicinc.com> > --- > include/drm/display/drm_dsc_helper.h | 7 +++++++ > 1 file changed, 7 insertions(+) Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
On Wed, 17 May 2023, Jessica Zhang <quic_jesszhan@quicinc.com> wrote: > Add helper to get the integer value of drm_dsc_config.bits_per_pixel > > Reviewed-by: Marijn Suijten <marijn.suijten@somainline.org> > Signed-off-by: Jessica Zhang <quic_jesszhan@quicinc.com> > --- > include/drm/display/drm_dsc_helper.h | 7 +++++++ > 1 file changed, 7 insertions(+) > > diff --git a/include/drm/display/drm_dsc_helper.h b/include/drm/display/drm_dsc_helper.h > index e0cbc38ada26..7bf7e8ff8eb4 100644 > --- a/include/drm/display/drm_dsc_helper.h > +++ b/include/drm/display/drm_dsc_helper.h > @@ -9,6 +9,7 @@ > #define DRM_DSC_HELPER_H_ > > #include <drm/display/drm_dsc.h> > +#include <linux/bug.h> Seems like a small thing, adding static inlines in headers usually leads to more header dependencies like this, and gradually slows down build. Does it need to be a static inline? BR, Jani. > > enum drm_dsc_params_type { > DRM_DSC_1_2_444, > @@ -26,6 +27,12 @@ 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_type type); > int drm_dsc_compute_rc_parameters(struct drm_dsc_config *vdsc_cfg); > > +static inline u32 drm_dsc_get_bpp_int(const struct drm_dsc_config *dsc) > +{ > + WARN_ON_ONCE(dsc->bits_per_pixel & 0xf); > + return dsc->bits_per_pixel >> 4; > +} > + > static inline u8 drm_dsc_initial_scale_value(const struct drm_dsc_config *dsc) > { > return 8 * dsc->rc_model_size / (dsc->rc_model_size - dsc->initial_offset);
On 5/22/2023 2:35 AM, Jani Nikula wrote: > On Wed, 17 May 2023, Jessica Zhang <quic_jesszhan@quicinc.com> wrote: >> Add helper to get the integer value of drm_dsc_config.bits_per_pixel >> >> Reviewed-by: Marijn Suijten <marijn.suijten@somainline.org> >> Signed-off-by: Jessica Zhang <quic_jesszhan@quicinc.com> >> --- >> include/drm/display/drm_dsc_helper.h | 7 +++++++ >> 1 file changed, 7 insertions(+) >> >> diff --git a/include/drm/display/drm_dsc_helper.h b/include/drm/display/drm_dsc_helper.h >> index e0cbc38ada26..7bf7e8ff8eb4 100644 >> --- a/include/drm/display/drm_dsc_helper.h >> +++ b/include/drm/display/drm_dsc_helper.h >> @@ -9,6 +9,7 @@ >> #define DRM_DSC_HELPER_H_ >> >> #include <drm/display/drm_dsc.h> >> +#include <linux/bug.h> > > Seems like a small thing, adding static inlines in headers usually leads > to more header dependencies like this, and gradually slows down build. > > Does it need to be a static inline? Hi Jani, Good point about the dependencies. Will make this a non-inline function. Thanks, Jessica Zhang > > BR, > Jani. > >> >> enum drm_dsc_params_type { >> DRM_DSC_1_2_444, >> @@ -26,6 +27,12 @@ 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_type type); >> int drm_dsc_compute_rc_parameters(struct drm_dsc_config *vdsc_cfg); >> >> +static inline u32 drm_dsc_get_bpp_int(const struct drm_dsc_config *dsc) >> +{ >> + WARN_ON_ONCE(dsc->bits_per_pixel & 0xf); >> + return dsc->bits_per_pixel >> 4; >> +} >> + >> static inline u8 drm_dsc_initial_scale_value(const struct drm_dsc_config *dsc) >> { >> return 8 * dsc->rc_model_size / (dsc->rc_model_size - dsc->initial_offset); > > -- > Jani Nikula, Intel Open Source Graphics Center
diff --git a/include/drm/display/drm_dsc_helper.h b/include/drm/display/drm_dsc_helper.h index e0cbc38ada26..7bf7e8ff8eb4 100644 --- a/include/drm/display/drm_dsc_helper.h +++ b/include/drm/display/drm_dsc_helper.h @@ -9,6 +9,7 @@ #define DRM_DSC_HELPER_H_ #include <drm/display/drm_dsc.h> +#include <linux/bug.h> enum drm_dsc_params_type { DRM_DSC_1_2_444, @@ -26,6 +27,12 @@ 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_type type); int drm_dsc_compute_rc_parameters(struct drm_dsc_config *vdsc_cfg); +static inline u32 drm_dsc_get_bpp_int(const struct drm_dsc_config *dsc) +{ + WARN_ON_ONCE(dsc->bits_per_pixel & 0xf); + return dsc->bits_per_pixel >> 4; +} + static inline u8 drm_dsc_initial_scale_value(const struct drm_dsc_config *dsc) { return 8 * dsc->rc_model_size / (dsc->rc_model_size - dsc->initial_offset);