Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm/display/dsc: add helper to set semi-const parameters

Add a helper setting config values which are typically constant across
operating modes (table E-4 of the standard) and mux_word_size (which is
a const according to 3.5.2).

Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Reviewed-by: Marijn Suijten <marijn.suijten@somainline.org>
Signed-off-by: Jessica Zhang <quic_jesszhan@quicinc.com>
Patchwork: https://patchwork.freedesktop.org/patch/539280/
Link: https://lore.kernel.org/r/20230329-rfc-msm-dsc-helper-v14-2-bafc7be95691@quicinc.com
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>

+23
+22
drivers/gpu/drm/display/drm_dsc_helper.c
··· 270 270 } 271 271 EXPORT_SYMBOL(drm_dsc_pps_payload_pack); 272 272 273 + /** 274 + * drm_dsc_set_const_params() - Set DSC parameters considered typically 275 + * constant across operation modes 276 + * 277 + * @vdsc_cfg: 278 + * DSC Configuration data partially filled by driver 279 + */ 280 + void drm_dsc_set_const_params(struct drm_dsc_config *vdsc_cfg) 281 + { 282 + if (!vdsc_cfg->rc_model_size) 283 + vdsc_cfg->rc_model_size = DSC_RC_MODEL_SIZE_CONST; 284 + vdsc_cfg->rc_edge_factor = DSC_RC_EDGE_FACTOR_CONST; 285 + vdsc_cfg->rc_tgt_offset_high = DSC_RC_TGT_OFFSET_HI_CONST; 286 + vdsc_cfg->rc_tgt_offset_low = DSC_RC_TGT_OFFSET_LO_CONST; 287 + 288 + if (vdsc_cfg->bits_per_component <= 10) 289 + vdsc_cfg->mux_word_size = DSC_MUX_WORD_SIZE_8_10_BPC; 290 + else 291 + vdsc_cfg->mux_word_size = DSC_MUX_WORD_SIZE_12_BPC; 292 + } 293 + EXPORT_SYMBOL(drm_dsc_set_const_params); 294 + 273 295 /* From DSC_v1.11 spec, rc_parameter_Set syntax element typically constant */ 274 296 static const u16 drm_dsc_rc_buf_thresh[] = { 275 297 896, 1792, 2688, 3584, 4480, 5376, 6272, 6720, 7168, 7616,
+1
include/drm/display/drm_dsc_helper.h
··· 21 21 int drm_dsc_dp_rc_buffer_size(u8 rc_buffer_block_size, u8 rc_buffer_size); 22 22 void drm_dsc_pps_payload_pack(struct drm_dsc_picture_parameter_set *pps_sdp, 23 23 const struct drm_dsc_config *dsc_cfg); 24 + void drm_dsc_set_const_params(struct drm_dsc_config *vdsc_cfg); 24 25 void drm_dsc_set_rc_buf_thresh(struct drm_dsc_config *vdsc_cfg); 25 26 int drm_dsc_setup_rc_params(struct drm_dsc_config *vdsc_cfg, enum drm_dsc_params_type type); 26 27 int drm_dsc_compute_rc_parameters(struct drm_dsc_config *vdsc_cfg);