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

drm/msm: Add MSM-specific DSC helper methods

Introduce MSM-specific DSC helper methods, as some calculations are
common between DP and DSC.

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

authored by

Jessica Zhang and committed by
Dmitry Baryshkov
b50f06f8 49fd30a7

+38
+38
drivers/gpu/drm/msm/msm_dsc_helper.h
··· 1 + /* SPDX-License-Identifier: GPL-2.0-only */ 2 + /* 3 + * Copyright (c) 2023 Qualcomm Innovation Center, Inc. All rights reserved 4 + * 5 + * Helper methods for MSM-specific DSC calculations that are common between timing engine, 6 + * DSI, and DP. 7 + */ 8 + 9 + #ifndef MSM_DSC_HELPER_H_ 10 + #define MSM_DSC_HELPER_H_ 11 + 12 + #include <linux/math.h> 13 + #include <drm/display/drm_dsc_helper.h> 14 + 15 + /** 16 + * msm_dsc_get_slices_per_intf() - calculate number of slices per interface 17 + * @dsc: Pointer to drm dsc config struct 18 + * @intf_width: interface width in pixels 19 + * Returns: Integer representing the number of slices for the given interface 20 + */ 21 + static inline u32 msm_dsc_get_slices_per_intf(const struct drm_dsc_config *dsc, u32 intf_width) 22 + { 23 + return DIV_ROUND_UP(intf_width, dsc->slice_width); 24 + } 25 + 26 + /** 27 + * msm_dsc_get_bytes_per_line() - calculate bytes per line 28 + * @dsc: Pointer to drm dsc config struct 29 + * Returns: Integer value representing bytes per line. DSI and DP need 30 + * to perform further calculations to turn this into pclk_per_intf, 31 + * such as dividing by different values depending on if widebus is enabled. 32 + */ 33 + static inline u32 msm_dsc_get_bytes_per_line(const struct drm_dsc_config *dsc) 34 + { 35 + return dsc->slice_count * dsc->slice_chunk_size; 36 + } 37 + 38 + #endif /* MSM_DSC_HELPER_H_ */