Browse Source

disp: msm: update rm topology mapping tables

This change updates resource topology mapping tables and includes
logic to compare compression types for dsc vs vdc.

Change-Id: I1735edeb07aec8ed0065f84ac0824c58158412f3
Signed-off-by: Narendra Muppalla <[email protected]>
Narendra Muppalla 5 years ago
parent
commit
218244e58b
7 changed files with 72 additions and 40 deletions
  1. 1 0
      msm/dp/dp_drm.c
  2. 2 2
      msm/dsi/dsi_drm.c
  3. 2 0
      msm/msm_drv.h
  4. 2 2
      msm/sde/sde_connector.c
  5. 2 1
      msm/sde/sde_encoder.c
  6. 54 31
      msm/sde/sde_rm.c
  7. 9 4
      msm/sde/sde_rm.h

+ 1 - 0
msm/dp/dp_drm.c

@@ -425,6 +425,7 @@ int dp_connector_get_mode_info(struct drm_connector *connector,
 			sizeof(mode_info->comp_info));
 
 		topology->num_enc = topology->num_lm;
+		topology->comp_type = mode_info->comp_info.comp_type;
 	}
 
 	return 0;

+ 2 - 2
msm/dsi/dsi_drm.c

@@ -512,14 +512,14 @@ int dsi_conn_get_mode_info(struct drm_connector *connector,
 	memcpy(&mode_info->topology, &dsi_mode.priv_info->topology,
 			sizeof(struct msm_display_topology));
 
-	mode_info->comp_info.comp_type = MSM_DISPLAY_COMPRESSION_NONE;
-
 	if (dsi_mode.priv_info->dsc_enabled) {
 		mode_info->comp_info.comp_type = MSM_DISPLAY_COMPRESSION_DSC;
+		mode_info->topology.comp_type = MSM_DISPLAY_COMPRESSION_DSC;
 		memcpy(&mode_info->comp_info.dsc_info, &dsi_mode.priv_info->dsc,
 			sizeof(dsi_mode.priv_info->dsc));
 	} else if (dsi_mode.priv_info->vdc_enabled) {
 		mode_info->comp_info.comp_type = MSM_DISPLAY_COMPRESSION_VDC;
+		mode_info->topology.comp_type = MSM_DISPLAY_COMPRESSION_VDC;
 		memcpy(&mode_info->comp_info.vdc_info, &dsi_mode.priv_info->vdc,
 			sizeof(dsi_mode.priv_info->vdc));
 	}

+ 2 - 0
msm/msm_drv.h

@@ -645,11 +645,13 @@ struct msm_compression_info {
  * @num_lm:       number of layer mixers used
  * @num_enc:      number of compression encoder blocks used
  * @num_intf:     number of interfaces the panel is mounted on
+ * @comp_type:    type of compression supported
  */
 struct msm_display_topology {
 	u32 num_lm;
 	u32 num_enc;
 	u32 num_intf;
+	enum msm_display_compression_type comp_type;
 };
 
 /**

+ 2 - 2
msm/sde/sde_connector.c

@@ -2303,8 +2303,8 @@ static int sde_connector_populate_mode_info(struct drm_connector *conn,
 		sde_kms_info_add_keyint(info, "bit_clk_rate",
 					mode_info.clk_rate);
 
-		topology_idx = (int)sde_rm_get_topology_name(
-							mode_info.topology);
+		topology_idx = (int)sde_rm_get_topology_name(&sde_kms->rm,
+					mode_info.topology);
 		if (topology_idx < SDE_RM_TOPOLOGY_MAX) {
 			sde_kms_info_add_keystr(info, "topology",
 					e_topology_name[topology_idx].name);

+ 2 - 1
msm/sde/sde_encoder.c

@@ -877,7 +877,8 @@ static int _sde_encoder_atomic_check_reserve(struct drm_encoder *drm_enc,
 		if (crtc_state->active)
 			topology = &sde_conn_state->mode_info.topology;
 
-		ret = sde_rm_update_topology(conn_state, topology);
+		ret = sde_rm_update_topology(&sde_kms->rm,
+				conn_state, topology);
 		if (ret) {
 			SDE_ERROR_ENC(sde_enc,
 				"RM failed to update topology, rc: %d\n", ret);

+ 54 - 31
msm/sde/sde_rm.c

@@ -31,40 +31,61 @@
 #define RM_RQ_CWB(r) ((r)->top_ctrl & BIT(SDE_RM_TOPCTL_CWB))
 #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)
+				(t).num_intf == (r).num_intf && \
+				(t).comp_type == (r).comp_type)
 
 /**
  * toplogy information to be used when ctl path version does not
  * support driving more than one interface per ctl_path
  */
-static const struct sde_rm_topology_def g_top_table[] = {
-	{   SDE_RM_TOPOLOGY_NONE,                 0, 0, 0, 0, false },
-	{   SDE_RM_TOPOLOGY_SINGLEPIPE,           1, 0, 1, 1, false },
-	{   SDE_RM_TOPOLOGY_SINGLEPIPE_DSC,       1, 1, 1, 1, false },
-	{   SDE_RM_TOPOLOGY_DUALPIPE,             2, 0, 2, 2, true  },
-	{   SDE_RM_TOPOLOGY_DUALPIPE_DSC,         2, 2, 2, 2, true  },
-	{   SDE_RM_TOPOLOGY_DUALPIPE_3DMERGE,     2, 0, 1, 1, false },
-	{   SDE_RM_TOPOLOGY_DUALPIPE_3DMERGE_DSC, 2, 1, 1, 1, false },
-	{   SDE_RM_TOPOLOGY_DUALPIPE_DSCMERGE,    2, 2, 1, 1, false },
-	{   SDE_RM_TOPOLOGY_PPSPLIT,              1, 0, 2, 1, true  },
+static const struct sde_rm_topology_def g_top_table[SDE_RM_TOPOLOGY_MAX] = {
+	{   SDE_RM_TOPOLOGY_NONE,                 0, 0, 0, 0, false,
+			MSM_DISPLAY_COMPRESSION_NONE },
+	{   SDE_RM_TOPOLOGY_SINGLEPIPE,           1, 0, 1, 1, false,
+			MSM_DISPLAY_COMPRESSION_NONE },
+	{   SDE_RM_TOPOLOGY_SINGLEPIPE_DSC,       1, 1, 1, 1, false,
+			MSM_DISPLAY_COMPRESSION_DSC },
+	{   SDE_RM_TOPOLOGY_DUALPIPE,             2, 0, 2, 2, true,
+			MSM_DISPLAY_COMPRESSION_NONE },
+	{   SDE_RM_TOPOLOGY_DUALPIPE_DSC,         2, 2, 2, 2, true,
+			MSM_DISPLAY_COMPRESSION_DSC },
+	{   SDE_RM_TOPOLOGY_DUALPIPE_3DMERGE,     2, 0, 1, 1, false,
+			MSM_DISPLAY_COMPRESSION_NONE },
+	{   SDE_RM_TOPOLOGY_DUALPIPE_3DMERGE_DSC, 2, 1, 1, 1, false,
+			MSM_DISPLAY_COMPRESSION_DSC },
+	{   SDE_RM_TOPOLOGY_DUALPIPE_DSCMERGE,    2, 2, 1, 1, false,
+			MSM_DISPLAY_COMPRESSION_DSC },
+	{   SDE_RM_TOPOLOGY_PPSPLIT,              1, 0, 2, 1, true,
+			MSM_DISPLAY_COMPRESSION_NONE },
 };
 
 /**
  * topology information to be used when the ctl path version
  * is SDE_CTL_CFG_VERSION_1_0_0
  */
-static const struct sde_rm_topology_def g_ctl_ver_1_top_table[] = {
-	{   SDE_RM_TOPOLOGY_NONE,                 0, 0, 0, 0, false },
-	{   SDE_RM_TOPOLOGY_SINGLEPIPE,           1, 0, 1, 1, false },
-	{   SDE_RM_TOPOLOGY_SINGLEPIPE_DSC,       1, 1, 1, 1, false },
-	{   SDE_RM_TOPOLOGY_SINGLEPIPE_VDC,       1, 1, 1, 1, false },
-	{   SDE_RM_TOPOLOGY_DUALPIPE,             2, 0, 2, 1, true  },
-	{   SDE_RM_TOPOLOGY_DUALPIPE_DSC,         2, 2, 2, 1, true  },
-	{   SDE_RM_TOPOLOGY_DUALPIPE_3DMERGE,     2, 0, 1, 1, false },
-	{   SDE_RM_TOPOLOGY_DUALPIPE_3DMERGE_DSC, 2, 1, 1, 1, false },
-	{   SDE_RM_TOPOLOGY_DUALPIPE_3DMERGE_VDC, 2, 1, 1, 1, false },
-	{   SDE_RM_TOPOLOGY_DUALPIPE_DSCMERGE,    2, 2, 1, 1, false },
-	{   SDE_RM_TOPOLOGY_PPSPLIT,              1, 0, 2, 1, true  },
+static const struct sde_rm_topology_def g_top_table_v1[SDE_RM_TOPOLOGY_MAX] = {
+	{   SDE_RM_TOPOLOGY_NONE,                 0, 0, 0, 0, false,
+			MSM_DISPLAY_COMPRESSION_NONE },
+	{   SDE_RM_TOPOLOGY_SINGLEPIPE,           1, 0, 1, 1, false,
+			MSM_DISPLAY_COMPRESSION_NONE },
+	{   SDE_RM_TOPOLOGY_SINGLEPIPE_DSC,       1, 1, 1, 1, false,
+			MSM_DISPLAY_COMPRESSION_DSC },
+	{   SDE_RM_TOPOLOGY_SINGLEPIPE_VDC,       1, 1, 1, 1, false,
+			MSM_DISPLAY_COMPRESSION_VDC },
+	{   SDE_RM_TOPOLOGY_DUALPIPE,             2, 0, 2, 1, true,
+			MSM_DISPLAY_COMPRESSION_NONE },
+	{   SDE_RM_TOPOLOGY_DUALPIPE_DSC,         2, 2, 2, 1, true,
+			MSM_DISPLAY_COMPRESSION_DSC },
+	{   SDE_RM_TOPOLOGY_DUALPIPE_3DMERGE,     2, 0, 1, 1, false,
+			MSM_DISPLAY_COMPRESSION_NONE },
+	{   SDE_RM_TOPOLOGY_DUALPIPE_3DMERGE_DSC, 2, 1, 1, 1, false,
+			MSM_DISPLAY_COMPRESSION_DSC },
+	{   SDE_RM_TOPOLOGY_DUALPIPE_3DMERGE_VDC, 2, 1, 1, 1, false,
+			MSM_DISPLAY_COMPRESSION_VDC },
+	{   SDE_RM_TOPOLOGY_DUALPIPE_DSCMERGE,    2, 2, 1, 1, false,
+			MSM_DISPLAY_COMPRESSION_DSC },
+	{   SDE_RM_TOPOLOGY_PPSPLIT,              1, 0, 2, 1, true,
+			MSM_DISPLAY_COMPRESSION_NONE },
 };
 
 
@@ -308,14 +329,15 @@ void sde_rm_init_hw_iter(
 	iter->type = type;
 }
 
-enum sde_rm_topology_name sde_rm_get_topology_name(
-	struct msm_display_topology topology)
+enum sde_rm_topology_name sde_rm_get_topology_name(struct sde_rm *rm,
+		struct msm_display_topology topology)
 {
 	int i;
 
 	for (i = 0; i < SDE_RM_TOPOLOGY_MAX; i++)
-		if (RM_IS_TOPOLOGY_MATCH(g_top_table[i], topology))
-			return g_top_table[i].top_name;
+		if (RM_IS_TOPOLOGY_MATCH(rm->topology_tbl[i],
+					topology))
+			return rm->topology_tbl[i].top_name;
 
 	return SDE_RM_TOPOLOGY_NONE;
 }
@@ -714,7 +736,7 @@ int sde_rm_init(struct sde_rm *rm,
 	rm->dev = dev;
 
 	if (IS_SDE_CTL_REV_100(cat->ctl_rev))
-		rm->topology_tbl = g_ctl_ver_1_top_table;
+		rm->topology_tbl = g_top_table_v1;
 	else
 		rm->topology_tbl = g_top_table;
 
@@ -2035,7 +2057,8 @@ static struct drm_connector *_sde_rm_get_connector(
 	return conn;
 }
 
-int sde_rm_update_topology(struct drm_connector_state *conn_state,
+int sde_rm_update_topology(struct sde_rm *rm,
+	struct drm_connector_state *conn_state,
 	struct msm_display_topology *topology)
 {
 	int i, ret = 0;
@@ -2048,8 +2071,8 @@ int sde_rm_update_topology(struct drm_connector_state *conn_state,
 	if (topology) {
 		top = *topology;
 		for (i = 0; i < SDE_RM_TOPOLOGY_MAX; i++)
-			if (RM_IS_TOPOLOGY_MATCH(g_top_table[i], top)) {
-				top_name = g_top_table[i].top_name;
+			if (RM_IS_TOPOLOGY_MATCH(rm->topology_tbl[i], top)) {
+				top_name = rm->topology_tbl[i].top_name;
 				break;
 			}
 	}

+ 9 - 4
msm/sde/sde_rm.h

@@ -88,6 +88,7 @@ enum sde_rm_qsync_modes {
  * @num_intf: number of interface used
  * @num_ctl: number of control path used
  * @needs_split_display: If set split display is enabled
+ * @comp_type: type of compression supported
  */
 struct sde_rm_topology_def {
 	enum sde_rm_topology_name top_name;
@@ -95,7 +96,8 @@ struct sde_rm_topology_def {
 	int num_comp_enc;
 	int num_intf;
 	int num_ctl;
-	int needs_split_display;
+	bool needs_split_display;
+	enum msm_display_compression_type comp_type;
 };
 
 /**
@@ -156,11 +158,12 @@ struct sde_rm_hw_request {
 
 /**
  * sde_rm_get_topology_name - get the name of the given topology config
+ * @rm: SDE resource manager handle
  * @topology: msm_display_topology topology config
  * @Return: name of the given topology
  */
-enum sde_rm_topology_name sde_rm_get_topology_name(
-	struct msm_display_topology topology);
+enum sde_rm_topology_name sde_rm_get_topology_name(struct sde_rm *rm,
+		struct msm_display_topology topology);
 
 
 /**
@@ -273,11 +276,13 @@ int sde_rm_cont_splash_res_init(struct msm_drm_private *priv,
 
 /**
  * sde_rm_update_topology - sets topology property of the connector
+ * @rm: SDE resource manager handle
  * @conn_state: drm state of the connector
  * @topology: topology selected for the display
  * @return: 0 on success or error
  */
-int sde_rm_update_topology(struct drm_connector_state *conn_state,
+int sde_rm_update_topology(struct sde_rm *rm,
+	struct drm_connector_state *conn_state,
 	struct msm_display_topology *topology);
 
 /**