Эх сурвалжийг харах

disp: msm: sde: add support for virtual sde blocks

This change add support for virtual sde blocks to maintain
the layer mixer id which is used for proper allocation of
dcwb.

Change-Id: I2b21561f72dab3ef833de71ceb1fa6dac886dc04
Signed-off-by: Mahadevan <[email protected]>
Signed-off-by: Akhil Jaiswal <[email protected]>
Akhil Jaiswal 3 жил өмнө
parent
commit
47acac9dbf

+ 55 - 29
msm/sde/sde_hw_catalog.c

@@ -46,6 +46,8 @@
 /* max mixer blend stages */
 #define DEFAULT_SDE_MIXER_BLENDSTAGES 7
 
+/* dummy block base address */
+#define DUMMY_SDE_BLOCK_BASE 0x0f0f
 /*
  * max bank bit for macro tile and ubwc format.
  * this value is left shifted and written to register
@@ -2228,6 +2230,39 @@ u32 sde_hw_mixer_set_preference(struct sde_mdss_cfg *sde_cfg, u32 num_lm,
 	return lm_mask;
 }
 
+static void sde_mixer_helper_parse_dt(struct device_node *np, struct sde_mdss_cfg *sde_cfg,
+				      struct sde_lm_cfg *mixer, int index)
+{
+	const char *disp_pref = NULL;
+	const char *cwb_pref = NULL;
+	const char *dcwb_pref = NULL;
+
+	if (test_bit(SDE_FEATURE_SRC_SPLIT, sde_cfg->features))
+		set_bit(SDE_MIXER_SOURCESPLIT, &mixer->features);
+	if (test_bit(SDE_FEATURE_DIM_LAYER, sde_cfg->features))
+		set_bit(SDE_DIM_LAYER, &mixer->features);
+	if (test_bit(SDE_FEATURE_COMBINED_ALPHA, sde_cfg->features))
+		set_bit(SDE_MIXER_COMBINED_ALPHA, &mixer->features);
+
+	of_property_read_string_index(np,
+		mixer_prop[MIXER_DISP].prop_name, index, &disp_pref);
+	if (disp_pref && !strcmp(disp_pref, "primary"))
+		set_bit(SDE_DISP_PRIMARY_PREF, &mixer->features);
+
+	of_property_read_string_index(np,
+		mixer_prop[MIXER_CWB].prop_name, index, &cwb_pref);
+	if (cwb_pref && !strcmp(cwb_pref, "cwb"))
+		set_bit(SDE_DISP_CWB_PREF, &mixer->features);
+
+	if (BIT(mixer->id - LM_0) & sde_cfg->virtual_mixers_mask)
+		set_bit(SDE_MIXER_IS_VIRTUAL, &mixer->features);
+
+	of_property_read_string_index(np,
+		mixer_prop[MIXER_DCWB].prop_name, index, &dcwb_pref);
+	if (dcwb_pref && !strcmp(dcwb_pref, "dcwb"))
+		set_bit(SDE_DISP_DCWB_PREF, &mixer->features);
+}
+
 static int sde_mixer_parse_dt(struct device_node *np, struct sde_mdss_cfg *sde_cfg)
 {
 	int rc = 0, i, j;
@@ -2278,10 +2313,6 @@ static int sde_mixer_parse_dt(struct device_node *np, struct sde_mdss_cfg *sde_c
 
 	for (i = 0, mixer_count = 0, pp_idx = 0, dspp_idx = 0, ds_idx = 0,
 			merge_3d_idx = 0; i < off_count; i++) {
-		const char *disp_pref = NULL;
-		const char *cwb_pref = NULL;
-		const char *dcwb_pref = NULL;
-		u32 dummy_mixer_base = 0x0f0f;
 
 		mixer_base = PROP_VALUE_ACCESS(props->values, MIXER_OFF, i);
 		if (!mixer_base)
@@ -2318,32 +2349,14 @@ static int sde_mixer_parse_dt(struct device_node *np, struct sde_mdss_cfg *sde_c
 				PROP_VALUE_ACCESS(blend_props->values,
 						MIXER_BLEND_OP_OFF, j);
 
-		if (test_bit(SDE_FEATURE_SRC_SPLIT, sde_cfg->features))
-			set_bit(SDE_MIXER_SOURCESPLIT, &mixer->features);
-		if (test_bit(SDE_FEATURE_DIM_LAYER, sde_cfg->features))
-			set_bit(SDE_DIM_LAYER, &mixer->features);
-		if (test_bit(SDE_FEATURE_COMBINED_ALPHA, sde_cfg->features))
-			set_bit(SDE_MIXER_COMBINED_ALPHA, &mixer->features);
+		sde_mixer_helper_parse_dt(np, sde_cfg, mixer, i);
 
-		of_property_read_string_index(np,
-			mixer_prop[MIXER_DISP].prop_name, i, &disp_pref);
-		if (disp_pref && !strcmp(disp_pref, "primary"))
-			set_bit(SDE_DISP_PRIMARY_PREF, &mixer->features);
-
-		of_property_read_string_index(np,
-			mixer_prop[MIXER_CWB].prop_name, i, &cwb_pref);
-		if (cwb_pref && !strcmp(cwb_pref, "cwb"))
-			set_bit(SDE_DISP_CWB_PREF, &mixer->features);
-
-		of_property_read_string_index(np,
-			mixer_prop[MIXER_DCWB].prop_name, i, &dcwb_pref);
-		if (dcwb_pref && !strcmp(dcwb_pref, "dcwb")) {
-			set_bit(SDE_DISP_DCWB_PREF, &mixer->features);
-			if (mixer->base == dummy_mixer_base) {
-				mixer->base = 0x0;
-				mixer->len = 0;
-				mixer->dummy_mixer = true;
-			}
+		if ((mixer->features & BIT(SDE_MIXER_IS_VIRTUAL) ||
+				mixer->features & BIT(SDE_DISP_DCWB_PREF)) &&
+				(mixer->base == DUMMY_SDE_BLOCK_BASE)) {
+			mixer->base = 0x0;
+			mixer->len = 0;
+			mixer->dummy_mixer = true;
 		}
 
 		mixer->pingpong = pp_count > 0 ? pp_idx + PINGPONG_0
@@ -4081,6 +4094,13 @@ static int sde_pp_parse_dt(struct device_node *np, struct sde_mdss_cfg *sde_cfg)
 			pp->merge_3d_id = PROP_VALUE_ACCESS(prop_value,
 					PP_MERGE_3D_ID, i) + 1;
 		}
+
+		if (pp->base == DUMMY_SDE_BLOCK_BASE) {
+			pp->base = 0x0;
+			pp->len = 0;
+			sblk->dither.base = 0x0;
+			sblk->dither.len = 0;
+		}
 	}
 
 end:
@@ -4786,6 +4806,11 @@ static int sde_parse_merge_3d_dt(struct device_node *np,
 		snprintf(merge_3d->name, SDE_HW_BLK_NAME_LEN, "merge_3d_%u",
 				merge_3d->id -  MERGE_3D_0);
 		merge_3d->len = PROP_VALUE_ACCESS(prop_value, HW_LEN, 0);
+
+		if (merge_3d->base == DUMMY_SDE_BLOCK_BASE) {
+			merge_3d->base = 0x0;
+			merge_3d->len = 0;
+		}
 	}
 
 end:
@@ -5544,6 +5569,7 @@ static int _sde_hardware_pre_caps(struct sde_mdss_cfg *sde_cfg, uint32_t hw_rev)
 		sde_cfg->mdss_hw_block_size = 0x158;
 		sde_cfg->demura_supported[SSPP_DMA1][0] = BIT(DEMURA_0);
 		sde_cfg->has_line_insertion = true;
+		sde_cfg->virtual_mixers_mask = 0x2;
 	} else if (IS_PITTI_TARGET(hw_rev)) {
 		set_bit(SDE_FEATURE_QSYNC, sde_cfg->features);
 		sde_cfg->perf.min_prefill_lines = 40;

+ 5 - 1
msm/sde/sde_hw_catalog.h

@@ -419,6 +419,8 @@ enum {
  * @SDE_DISP_SECONDARY_PREF   Layer mixer preferred for secondary display
  * @SDE_MIXER_COMBINED_ALPHA  Layer mixer bg and fg alpha in single register
  * @SDE_MIXER_NOISE_LAYER     Layer mixer supports noise layer
+ * @SDE_MIXER_IS_VIRTUAL      Layer mixer which is removed but used for proper
+ *                            Dedicated CWB allocation
  * @SDE_MIXER_MAX             maximum value
  */
 enum {
@@ -432,6 +434,7 @@ enum {
 	SDE_DISP_DCWB_PREF,
 	SDE_MIXER_COMBINED_ALPHA,
 	SDE_MIXER_NOISE_LAYER,
+	SDE_MIXER_IS_VIRTUAL,
 	SDE_MIXER_MAX
 };
 
@@ -1899,7 +1902,7 @@ struct sde_perf_cfg {
  * @sspp_count          number of valid SSPP blocks available
  * @sspp                array of pointers to SSPP blocks
  * @mixer_count         number of valid LM blocks available
- * @mixer               array of pointers to LM blocks
+ * @virtual_mixers_mask bitmask of virtual mixers
  * @dspp_top            pointer to common DSPP_TOP block
  * @dspp_count          number of valid DSPP blocks available
  * @dspp                array of pointers to DSPP blocks
@@ -2013,6 +2016,7 @@ struct sde_mdss_cfg {
 	struct sde_sspp_cfg sspp[MAX_BLOCKS];
 	u32 mixer_count;
 	struct sde_lm_cfg mixer[MAX_BLOCKS];
+	u32 virtual_mixers_mask;
 	struct sde_dspp_top_cfg dspp_top;
 	u32 dspp_count;
 	struct sde_dspp_cfg dspp[MAX_BLOCKS];

+ 6 - 0
msm/sde/sde_rm.c

@@ -1209,6 +1209,12 @@ static bool _sde_rm_check_lm_and_get_connected_blks(
 	*ds = NULL;
 	*pp = NULL;
 
+	if (lm_cfg->features & BIT(SDE_MIXER_IS_VIRTUAL)) {
+		SDE_DEBUG("lm %d hw block is removed and it is a virtual mixer",
+				lm_cfg->id);
+		return false;
+	}
+
 	lm_primary_pref = lm_cfg->features & BIT(SDE_DISP_PRIMARY_PREF);
 	lm_secondary_pref = lm_cfg->features & BIT(SDE_DISP_SECONDARY_PREF);
 	cwb_pref = lm_cfg->features & BIT(SDE_DISP_CWB_PREF);