1 /* SPDX-License-Identifier: GPL-2.0-only */
3 * Copyright (c) 2023 Qualcomm Innovation Center, Inc. All rights reserved
5 * Helper methods for MSM-specific DSC calculations that are common between timing engine,
9 #ifndef MSM_DSC_HELPER_H_
10 #define MSM_DSC_HELPER_H_
12 #include <linux/math.h>
13 #include <drm/display/drm_dsc_helper.h>
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
21 static inline u32 msm_dsc_get_slices_per_intf(const struct drm_dsc_config *dsc, u32 intf_width)
23 return DIV_ROUND_UP(intf_width, dsc->slice_width);
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.
33 static inline u32 msm_dsc_get_bytes_per_line(const struct drm_dsc_config *dsc)
35 return dsc->slice_count * dsc->slice_chunk_size;
38 #endif /* MSM_DSC_HELPER_H_ */