]> Git Repo - linux.git/blob - drivers/gpu/drm/msm/msm_dsc_helper.h
Merge tag 'irq-urgent-2025-02-08' of git://git.kernel.org/pub/scm/linux/kernel/git...
[linux.git] / 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_ */
This page took 0.030666 seconds and 4 git commands to generate.