Browse Source

disp: msm: sde: expose cdm block count through connector

Expose the number of cdm blocks available through the connector
capabilities. Add CDM to the topology_control table, so usermode
can use the property to reserve the CDM block during modeset.
Additionally, fix a error code return during CDM block reservation
failure in sde resource manager.

Change-Id: Ib42ca4e8614076a8e5df77d8abc77a9e73674390
Signed-off-by: Veera Sundaram Sankaran <[email protected]>
Veera Sundaram Sankaran 2 years ago
parent
commit
8602fee9f8
4 changed files with 12 additions and 1 deletions
  1. 1 0
      msm/sde/sde_connector.c
  2. 5 1
      msm/sde/sde_rm.c
  3. 3 0
      msm/sde/sde_rm.h
  4. 3 0
      msm/sde/sde_wb.c

+ 1 - 0
msm/sde/sde_connector.c

@@ -57,6 +57,7 @@ static const struct drm_prop_enum_list e_topology_control[] = {
 	{SDE_RM_TOPCTL_DSPP,		"dspp"},
 	{SDE_RM_TOPCTL_DS,		"ds"},
 	{SDE_RM_TOPCTL_DNSC_BLUR,	"dnsc_blur"},
+	{SDE_RM_TOPCTL_CDM,		"cdm"},
 };
 static const struct drm_prop_enum_list e_power_mode[] = {
 	{SDE_MODE_DPMS_ON,	"ON"},

+ 5 - 1
msm/sde/sde_rm.c

@@ -37,6 +37,7 @@
 #define RM_RQ_CWB(r) ((r)->top_ctrl & BIT(SDE_RM_TOPCTL_CWB))
 #define RM_RQ_DCWB(r) ((r)->top_ctrl & BIT(SDE_RM_TOPCTL_DCWB))
 #define RM_RQ_DNSC_BLUR(r) ((r)->top_ctrl & BIT(SDE_RM_TOPCTL_DNSC_BLUR))
+#define RM_RQ_CDM(r) ((r)->top_ctrl & BIT(SDE_RM_TOPCTL_CDM))
 #define RM_IS_TOPOLOGY_MATCH(t, r) ((t).num_lm == (r).num_lm && \
 				(t).num_comp_enc == (r).num_enc && \
 				(t).num_intf == (r).num_intf && \
@@ -1882,8 +1883,11 @@ static int _sde_rm_reserve_intf_or_wb(struct sde_rm *rm, struct sde_rm_rsvp *rsv
 	}
 
 	/* Expected only one intf or wb will request cdm */
-	if (hw_res->needs_cdm)
+	if (hw_res->needs_cdm || RM_RQ_CDM(reqs)) {
 		ret = _sde_rm_reserve_cdm(rm, rsvp, id, type);
+		if (ret)
+			return ret;
+	}
 
 	if (RM_RQ_DNSC_BLUR(reqs))
 		ret = _sde_rm_reserve_dnsc_blur(rm, rsvp, id, type);

+ 3 - 0
msm/sde/sde_rm.h

@@ -1,5 +1,6 @@
 /* SPDX-License-Identifier: GPL-2.0-only */
 /*
+ * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
  * Copyright (c) 2016-2021, The Linux Foundation. All rights reserved.
  */
 
@@ -114,6 +115,7 @@ enum sde_rm_topology_group {
  * @SDE_RM_TOPCTL_CWB  : Require layer mixers with CWB capabilities
  * @SDE_RM_TOPCTL_DCWB : Require layer mixers with DCWB capabilities
  * @SDE_RM_TOPCTL_DNSC_BLUR : Require writeback with downscale blur capabilities
+ * @SDE_RM_TOPCTL_CDM : Require writeback with CDM capabilities
  */
 enum sde_rm_topology_control {
 	SDE_RM_TOPCTL_RESERVE_LOCK,
@@ -123,6 +125,7 @@ enum sde_rm_topology_control {
 	SDE_RM_TOPCTL_CWB,
 	SDE_RM_TOPCTL_DCWB,
 	SDE_RM_TOPCTL_DNSC_BLUR,
+	SDE_RM_TOPCTL_CDM,
 };
 
 /**

+ 3 - 0
msm/sde/sde_wb.c

@@ -545,6 +545,9 @@ int sde_wb_connector_set_info_blob(struct drm_connector *connector,
 	sde_kms_info_add_keyint(info, "has_cwb_dither", test_bit(SDE_FEATURE_CWB_DITHER,
 				catalog->features));
 
+	if (catalog->cdm_count)
+		sde_kms_info_add_keyint(info, "cdm_count", catalog->cdm_count);
+
 	if (catalog->dnsc_blur_count && catalog->dnsc_blur_filters) {
 		sde_kms_info_add_keyint(info, "dnsc_blur_count", catalog->dnsc_blur_count);