disp: msm: sde: refactor topology group check helpers

Refactor topology group check helpers into a single
function to remove duplicate code. This change also
uses atomic state to extract topology information
since those functions can be called during atomic
check phase.

Change-Id: Ia262009e0b8fe9fcdeff05e544d2e59be35c9c54
Signed-off-by: Amine Najahi <anajahi@codeaurora.org>
This commit is contained in:
Amine Najahi
2020-07-07 16:46:39 -04:00
parent 9ec78e3339
commit 2d624f6ab8
3 changed files with 105 additions and 100 deletions

View File

@@ -14,18 +14,25 @@
#define SINGLE_CTL 1
#define DUAL_CTL 2
#define TOPOLOGY_QUADPIPE_MERGE_MODE(x) \
#define TOPOLOGY_SINGLEPIPE_MODE(x) \
(x == SDE_RM_TOPOLOGY_SINGLEPIPE ||\
x == SDE_RM_TOPOLOGY_SINGLEPIPE_DSC ||\
x == SDE_RM_TOPOLOGY_SINGLEPIPE_VDC)
#define TOPOLOGY_DUALPIPE_MODE(x) \
(x == SDE_RM_TOPOLOGY_DUALPIPE ||\
x == SDE_RM_TOPOLOGY_DUALPIPE_DSC ||\
x == SDE_RM_TOPOLOGY_DUALPIPE_DSCMERGE ||\
x == SDE_RM_TOPOLOGY_DUALPIPE_3DMERGE ||\
x == SDE_RM_TOPOLOGY_DUALPIPE_3DMERGE_VDC ||\
x == SDE_RM_TOPOLOGY_DUALPIPE_3DMERGE_DSC)
#define TOPOLOGY_QUADPIPE_MODE(x) \
(x == SDE_RM_TOPOLOGY_QUADPIPE_3DMERGE ||\
x == SDE_RM_TOPOLOGY_QUADPIPE_3DMERGE_DSC ||\
x == SDE_RM_TOPOLOGY_QUADPIPE_DSCMERGE ||\
x == SDE_RM_TOPOLOGY_QUADPIPE_DSC4HSMERGE)
#define TOPOLOGY_DUALPIPE_MERGE_MODE(x) \
(x == SDE_RM_TOPOLOGY_DUALPIPE_DSCMERGE || \
x == SDE_RM_TOPOLOGY_DUALPIPE_3DMERGE || \
x == SDE_RM_TOPOLOGY_DUALPIPE_3DMERGE_VDC || \
x == SDE_RM_TOPOLOGY_DUALPIPE_3DMERGE_DSC)
/**
* enum sde_rm_topology_name - HW resource use case in use by connector
* @SDE_RM_TOPOLOGY_NONE: No topology in use currently
@@ -63,6 +70,27 @@ enum sde_rm_topology_name {
SDE_RM_TOPOLOGY_MAX,
};
/**
* enum sde_rm_topology_group - Topology group selection
* @SDE_RM_TOPOLOGY_GROUP_NONE: No topology group in use currently
* @SDE_RM_TOPOLOGY_GROUP_SINGLEPIPE: Any topology that uses 1 LM
* @SDE_RM_TOPOLOGY_GROUP_DUALPIPE: Any topology that uses 2 LM
* @SDE_RM_TOPOLOGY_GROUP_QUADPIPE: Any topology that uses 4 LM
* @SDE_RM_TOPOLOGY_GROUP_3DMERGE: Any topology that uses 3D merge only
* @SDE_RM_TOPOLOGY_GROUP_3DMERGE_DSC: Any topology that uses 3D merge + DSC
* @SDE_RM_TOPOLOGY_GROUP_DSCMERGE: Any topology that uses DSC merge
*/
enum sde_rm_topology_group {
SDE_RM_TOPOLOGY_GROUP_NONE = 0,
SDE_RM_TOPOLOGY_GROUP_SINGLEPIPE,
SDE_RM_TOPOLOGY_GROUP_DUALPIPE,
SDE_RM_TOPOLOGY_GROUP_QUADPIPE,
SDE_RM_TOPOLOGY_GROUP_3DMERGE,
SDE_RM_TOPOLOGY_GROUP_3DMERGE_DSC,
SDE_RM_TOPOLOGY_GROUP_DSCMERGE,
SDE_RM_TOPOLOGY_GROUP_MAX,
};
/**
* enum sde_rm_topology_control - HW resource use case in use by connector
* @SDE_RM_TOPCTL_RESERVE_LOCK: If set, in AtomicTest phase, after a successful
@@ -350,34 +378,16 @@ static inline int sde_rm_topology_get_num_lm(struct sde_rm *rm,
}
/**
* sde_rm_topology_is_dual_pipe - check if the topology used
* is a dual-pipe mode one
* sde_rm_topology_is_group - check if the topology in use
* is part of the requested group
* @rm: SDE Resource Manager handle
* @state: drm state of the crtc
* @return: true if attached connector is in dual-pipe mode
* @group: topology group to check
* @return: true if attached connector is in the topology group
*/
bool sde_rm_topology_is_dual_pipe(struct sde_rm *rm,
struct drm_crtc_state *state);
/**
* sde_rm_topology_is_3dmux_dsc - check if the topology used
* is a 3dmerge dsc mode one
* @rm: SDE Resource Manager handle
* @state: drm state of the crtc
* @return: true if attached connector is in 3DMERGE DSC mode
*/
bool sde_rm_topology_is_3dmux_dsc(struct sde_rm *rm,
struct drm_crtc_state *state);
/**
* sde_rm_topology_is_quad_pipe - check if the topology used
* is a quad-pipe mode one
* @rm: SDE Resource Manager handle
* @state: drm state of the crtc
* @return: true if attached connector is in quad-pipe mode
*/
bool sde_rm_topology_is_quad_pipe(struct sde_rm *rm,
struct drm_crtc_state *state);
bool sde_rm_topology_is_group(struct sde_rm *rm,
struct drm_crtc_state *state,
enum sde_rm_topology_group group);
/**
* sde_rm_ext_blk_create_reserve - Create external HW blocks