From a8f60081ae426890b968ba8b9b84eff5fbd69f34 Mon Sep 17 00:00:00 2001 From: Abhijit Kulkarni Date: Fri, 10 May 2019 15:45:31 -0700 Subject: [PATCH] disp: msm: sde: add api to query topology details. This change adds new resource manager api to get number of ctl paths, interfaces and compression encoders used in the current topology. This API is required to support both dsc and vdc encoders and make implementation more generic. Change-Id: I6cc25e51574cf71cd39f479049572ee7b7e0ead0 Signed-off-by: Abhijit Kulkarni --- msm/sde/sde_encoder_phys.h | 10 ++++++++-- msm/sde/sde_rm.h | 15 +++++++++------ 2 files changed, 17 insertions(+), 8 deletions(-) diff --git a/msm/sde/sde_encoder_phys.h b/msm/sde/sde_encoder_phys.h index f620ba7bacff..fa887a3f7f2f 100644 --- a/msm/sde/sde_encoder_phys.h +++ b/msm/sde/sde_encoder_phys.h @@ -1,6 +1,6 @@ /* SPDX-License-Identifier: GPL-2.0-only */ /* - * Copyright (c) 2015-2019, The Linux Foundation. All rights reserved. + * Copyright (c) 2015-2020, The Linux Foundation. All rights reserved. */ #ifndef __SDE_ENCODER_PHYS_H__ @@ -693,6 +693,7 @@ static inline bool _sde_encoder_phys_is_dual_ctl( { struct sde_kms *sde_kms; enum sde_rm_topology_name topology; + const struct sde_rm_topology_def* def; if (!phys_enc) { pr_err("invalid phys_enc\n"); @@ -706,8 +707,13 @@ static inline bool _sde_encoder_phys_is_dual_ctl( } topology = sde_connector_get_topology_name(phys_enc->connector); + def = sde_rm_topology_get_topology_def(&sde_kms->rm, topology); + if (IS_ERR_OR_NULL(def)) { + pr_err("invalid topology\n"); + return false; + } - return sde_rm_topology_is_dual_ctl(&sde_kms->rm, topology); + return (def->num_ctl == 2) ? true : false; } /** diff --git a/msm/sde/sde_rm.h b/msm/sde/sde_rm.h index ea5a0e6a3020..01d66dddaa77 100644 --- a/msm/sde/sde_rm.h +++ b/msm/sde/sde_rm.h @@ -1,6 +1,6 @@ /* SPDX-License-Identifier: GPL-2.0-only */ /* - * Copyright (c) 2016-2019, The Linux Foundation. All rights reserved. + * Copyright (c) 2016-2020, The Linux Foundation. All rights reserved. */ #ifndef __SDE_RM_H__ @@ -277,12 +277,15 @@ int sde_rm_update_topology(struct drm_connector_state *conn_state, struct msm_display_topology *topology); /** - * sde_rm_topology_is_dual_ctl - checks if topoloy requires two control paths + * sde_rm_topology_get_topology_def - returns the information about num + * of hw blocks used in this topology * @rm: SDE Resource Manager handle * @topology: topology selected for the display - * @return: true if two control paths are required or false + * @return: pointer to struct containing topology definition */ -static inline bool sde_rm_topology_is_dual_ctl(struct sde_rm *rm, +static inline const struct sde_rm_topology_def* + sde_rm_topology_get_topology_def( + struct sde_rm *rm, enum sde_rm_topology_name topology) { if ((!rm) || (topology <= SDE_RM_TOPOLOGY_NONE) || @@ -290,10 +293,10 @@ static inline bool sde_rm_topology_is_dual_ctl(struct sde_rm *rm, pr_err("invalid arguments: rm:%d topology:%d\n", rm == NULL, topology); - return false; + return ERR_PTR(-EINVAL); } - return rm->topology_tbl[topology].num_ctl == DUAL_CTL; + return &rm->topology_tbl[topology]; } /**