Sfoglia il codice sorgente

Merge "disp: msm: sde: reduce complexity in _sde_plane_install_properties"

qctecmdr 5 anni fa
parent
commit
34620799ae
1 ha cambiato i file con 181 aggiunte e 166 eliminazioni
  1. 181 166
      msm/sde/sde_plane.c

+ 181 - 166
msm/sde/sde_plane.c

@@ -3489,126 +3489,92 @@ static void _sde_plane_install_master_only_properties(struct sde_plane *psde)
 
 }
 
-/* helper to install properties which are common to planes and crtcs */
-static void _sde_plane_install_properties(struct drm_plane *plane,
-	struct sde_mdss_cfg *catalog, u32 master_plane_id)
+static void _sde_plane_install_colorproc_properties(struct sde_plane *psde,
+		struct sde_kms_info *info)
 {
-	static const struct drm_prop_enum_list e_blend_op[] = {
-		{SDE_DRM_BLEND_OP_NOT_DEFINED,    "not_defined"},
-		{SDE_DRM_BLEND_OP_OPAQUE,         "opaque"},
-		{SDE_DRM_BLEND_OP_PREMULTIPLIED,  "premultiplied"},
-		{SDE_DRM_BLEND_OP_COVERAGE,       "coverage"},
-		{SDE_DRM_BLEND_OP_SKIP,           "skip_blending"},
-	};
-	static const struct drm_prop_enum_list e_src_config[] = {
-		{SDE_DRM_DEINTERLACE, "deinterlace"}
-	};
-	static const struct drm_prop_enum_list e_fb_translation_mode[] = {
-		{SDE_DRM_FB_NON_SEC, "non_sec"},
-		{SDE_DRM_FB_SEC, "sec"},
-		{SDE_DRM_FB_NON_SEC_DIR_TRANS, "non_sec_direct_translation"},
-		{SDE_DRM_FB_SEC_DIR_TRANS, "sec_direct_translation"},
-	};
-	static const struct drm_prop_enum_list e_multirect_mode[] = {
-		{SDE_SSPP_MULTIRECT_NONE, "none"},
-		{SDE_SSPP_MULTIRECT_PARALLEL, "parallel"},
-		{SDE_SSPP_MULTIRECT_TIME_MX,  "serial"},
-	};
-	const struct sde_format_extended *format_list;
-	struct sde_kms_info *info;
-	struct sde_plane *psde = to_sde_plane(plane);
-	bool is_master;
-	int zpos_max = 255;
-	int zpos_def = 0;
 	char feature_name[256];
-	uint32_t index;
+	bool is_master = !psde->is_virtual;
 
-	if (!plane || !psde) {
-		SDE_ERROR("invalid plane\n");
-		return;
-	} else if (!psde->pipe_hw || !psde->pipe_sblk) {
-		SDE_ERROR("invalid plane, pipe_hw %d pipe_sblk %d\n",
-				!psde->pipe_hw, !psde->pipe_sblk);
-		return;
-	} else if (!catalog) {
-		SDE_ERROR("invalid catalog\n");
-		return;
+	if ((is_master &&
+		(psde->features & BIT(SDE_SSPP_INVERSE_PMA))) ||
+		(psde->features & BIT(SDE_SSPP_DGM_INVERSE_PMA))) {
+		msm_property_install_range(&psde->property_info,
+			"inverse_pma", 0x0, 0, 1, 0, PLANE_PROP_INVERSE_PMA);
+		sde_kms_info_add_keyint(info, "inverse_pma", 1);
 	}
 
-	psde->catalog = catalog;
-	is_master = !psde->is_virtual;
-
-	if (sde_is_custom_client()) {
-		if (catalog->mixer_count &&
-				catalog->mixer[0].sblk->maxblendstages) {
-			zpos_max = catalog->mixer[0].sblk->maxblendstages - 1;
-			if (catalog->has_base_layer &&
-					(zpos_max > SDE_STAGE_MAX - 1))
-				zpos_max = SDE_STAGE_MAX - 1;
-			else if (zpos_max > SDE_STAGE_MAX - SDE_STAGE_0 - 1)
-				zpos_max = SDE_STAGE_MAX - SDE_STAGE_0 - 1;
-		}
-	} else if (plane->type != DRM_PLANE_TYPE_PRIMARY) {
-		/* reserve zpos == 0 for primary planes */
-		zpos_def = drm_plane_index(plane) + 1;
+	if (psde->features & BIT(SDE_SSPP_DGM_CSC)) {
+		msm_property_install_volatile_range(
+			&psde->property_info, "csc_dma_v1", 0x0,
+			0, ~0, 0, PLANE_PROP_CSC_DMA_V1);
+		sde_kms_info_add_keyint(info, "csc_dma_v1", 1);
 	}
 
-	msm_property_install_range(&psde->property_info, "zpos",
-		0x0, 0, zpos_max, zpos_def, PLANE_PROP_ZPOS);
-
-	msm_property_install_range(&psde->property_info, "alpha",
-		0x0, 0, 255, 255, PLANE_PROP_ALPHA);
-
-	/* linux default file descriptor range on each process */
-	msm_property_install_range(&psde->property_info, "input_fence",
-		0x0, 0, INR_OPEN_MAX, 0, PLANE_PROP_INPUT_FENCE);
-
-	if (is_master)
-		_sde_plane_install_master_only_properties(psde);
-
-	if (psde->features & BIT(SDE_SSPP_EXCL_RECT))
-		msm_property_install_volatile_range(&psde->property_info,
-			"excl_rect_v1", 0x0, 0, ~0, 0, PLANE_PROP_EXCL_RECT_V1);
-
-	sde_plane_rot_install_properties(plane, catalog);
-
-	msm_property_install_enum(&psde->property_info, "blend_op", 0x0, 0,
-		e_blend_op, ARRAY_SIZE(e_blend_op), PLANE_PROP_BLEND_OP);
+	if (psde->features & BIT(SDE_SSPP_MEMCOLOR)) {
+		snprintf(feature_name, sizeof(feature_name), "%s%d",
+			"SDE_SSPP_SKIN_COLOR_V",
+			psde->pipe_sblk->memcolor_blk.version >> 16);
+		msm_property_install_blob(&psde->property_info, feature_name, 0,
+			PLANE_PROP_SKIN_COLOR);
+		snprintf(feature_name, sizeof(feature_name), "%s%d",
+			"SDE_SSPP_SKY_COLOR_V",
+			psde->pipe_sblk->memcolor_blk.version >> 16);
+		msm_property_install_blob(&psde->property_info, feature_name, 0,
+			PLANE_PROP_SKY_COLOR);
+		snprintf(feature_name, sizeof(feature_name), "%s%d",
+			"SDE_SSPP_FOLIAGE_COLOR_V",
+			psde->pipe_sblk->memcolor_blk.version >> 16);
+		msm_property_install_blob(&psde->property_info, feature_name, 0,
+			PLANE_PROP_FOLIAGE_COLOR);
+	}
 
-	msm_property_install_enum(&psde->property_info, "src_config", 0x0, 1,
-		e_src_config, ARRAY_SIZE(e_src_config), PLANE_PROP_SRC_CONFIG);
+	if (psde->features & BIT(SDE_SSPP_VIG_GAMUT)) {
+		snprintf(feature_name, sizeof(feature_name), "%s%d",
+			"SDE_VIG_3D_LUT_GAMUT_V",
+			psde->pipe_sblk->gamut_blk.version >> 16);
+		msm_property_install_blob(&psde->property_info, feature_name, 0,
+			PLANE_PROP_VIG_GAMUT);
+	}
 
-	if (psde->pipe_hw->ops.setup_solidfill)
-		msm_property_install_range(&psde->property_info, "color_fill",
-				0, 0, 0xFFFFFFFF, 0, PLANE_PROP_COLOR_FILL);
+	if (psde->features & BIT(SDE_SSPP_VIG_IGC)) {
+		snprintf(feature_name, sizeof(feature_name), "%s%d",
+			"SDE_VIG_1D_LUT_IGC_V",
+			psde->pipe_sblk->igc_blk[0].version >> 16);
+		msm_property_install_blob(&psde->property_info, feature_name, 0,
+			PLANE_PROP_VIG_IGC);
+	}
 
-	msm_property_install_range(&psde->property_info,
-			"prefill_size", 0x0, 0, ~0, 0,
-			PLANE_PROP_PREFILL_SIZE);
-	msm_property_install_range(&psde->property_info,
-			"prefill_time", 0x0, 0, ~0, 0,
-			PLANE_PROP_PREFILL_TIME);
+	if (psde->features & BIT(SDE_SSPP_DMA_IGC)) {
+		snprintf(feature_name, sizeof(feature_name), "%s%d",
+			"SDE_DGM_1D_LUT_IGC_V",
+			psde->pipe_sblk->igc_blk[0].version >> 16);
+		msm_property_install_blob(&psde->property_info, feature_name, 0,
+			PLANE_PROP_DMA_IGC);
+	}
 
-	info = kzalloc(sizeof(struct sde_kms_info), GFP_KERNEL);
-	if (!info) {
-		SDE_ERROR("failed to allocate info memory\n");
-		return;
+	if (psde->features & BIT(SDE_SSPP_DMA_GC)) {
+		snprintf(feature_name, sizeof(feature_name), "%s%d",
+			"SDE_DGM_1D_LUT_GC_V",
+			psde->pipe_sblk->gc_blk[0].version >> 16);
+		msm_property_install_blob(&psde->property_info, feature_name, 0,
+			PLANE_PROP_DMA_GC);
 	}
+}
 
-	msm_property_install_blob(&psde->property_info, "capabilities",
-		DRM_MODE_PROP_IMMUTABLE, PLANE_PROP_INFO);
-	sde_kms_info_reset(info);
+static void _sde_plane_setup_capabilities_blob(struct sde_plane *psde,
+		u32 master_plane_id, struct sde_kms_info *info,
+		struct sde_mdss_cfg *catalog)
+{
+	bool is_master = !psde->is_virtual;
+	const struct sde_format_extended *format_list;
+	u32 index;
 
 	if (is_master) {
 		format_list = psde->pipe_sblk->format_list;
 	} else {
 		format_list = psde->pipe_sblk->virt_format_list;
 		sde_kms_info_add_keyint(info, "primary_smart_plane_id",
-						master_plane_id);
-		msm_property_install_enum(&psde->property_info,
-			"multirect_mode", 0x0, 0, e_multirect_mode,
-			ARRAY_SIZE(e_multirect_mode),
-			PLANE_PROP_MULTIRECT_MODE);
+				master_plane_id);
 	}
 
 	if (format_list) {
@@ -3648,21 +3614,6 @@ static void _sde_plane_install_properties(struct drm_plane *plane,
 				psde->pipe - SSPP_DMA0);
 	}
 
-	if ((is_master &&
-		(psde->features & BIT(SDE_SSPP_INVERSE_PMA))) ||
-		(psde->features & BIT(SDE_SSPP_DGM_INVERSE_PMA))) {
-		msm_property_install_range(&psde->property_info,
-			"inverse_pma", 0x0, 0, 1, 0, PLANE_PROP_INVERSE_PMA);
-		sde_kms_info_add_keyint(info, "inverse_pma", 1);
-	}
-
-	if (psde->features & BIT(SDE_SSPP_DGM_CSC)) {
-		msm_property_install_volatile_range(
-			&psde->property_info, "csc_dma_v1", 0x0,
-			0, ~0, 0, PLANE_PROP_CSC_DMA_V1);
-		sde_kms_info_add_keyint(info, "csc_dma_v1", 1);
-	}
-
 	if (psde->features & BIT(SDE_SSPP_SEC_UI_ALLOWED))
 		sde_kms_info_add_keyint(info, "sec_ui_allowed", 1);
 	if (psde->features & BIT(SDE_SSPP_BLOCK_SEC_UI))
@@ -3700,70 +3651,134 @@ static void _sde_plane_install_properties(struct drm_plane *plane,
 			}
 			sde_kms_info_stop(info);
 		}
-
 	}
+}
 
-	msm_property_set_blob(&psde->property_info, &psde->blob_info,
-			info->data, SDE_KMS_INFO_DATALEN(info),
-			PLANE_PROP_INFO);
-
-	kfree(info);
+/* helper to install properties which are common to planes and crtcs */
+static void _sde_plane_install_properties(struct drm_plane *plane,
+	struct sde_mdss_cfg *catalog, u32 master_plane_id)
+{
+	static const struct drm_prop_enum_list e_blend_op[] = {
+		{SDE_DRM_BLEND_OP_NOT_DEFINED,    "not_defined"},
+		{SDE_DRM_BLEND_OP_OPAQUE,         "opaque"},
+		{SDE_DRM_BLEND_OP_PREMULTIPLIED,  "premultiplied"},
+		{SDE_DRM_BLEND_OP_COVERAGE,       "coverage"},
+		{SDE_DRM_BLEND_OP_SKIP,           "skip_blending"},
+	};
+	static const struct drm_prop_enum_list e_src_config[] = {
+		{SDE_DRM_DEINTERLACE, "deinterlace"}
+	};
+	static const struct drm_prop_enum_list e_fb_translation_mode[] = {
+		{SDE_DRM_FB_NON_SEC, "non_sec"},
+		{SDE_DRM_FB_SEC, "sec"},
+		{SDE_DRM_FB_NON_SEC_DIR_TRANS, "non_sec_direct_translation"},
+		{SDE_DRM_FB_SEC_DIR_TRANS, "sec_direct_translation"},
+	};
+	static const struct drm_prop_enum_list e_multirect_mode[] = {
+		{SDE_SSPP_MULTIRECT_NONE, "none"},
+		{SDE_SSPP_MULTIRECT_PARALLEL, "parallel"},
+		{SDE_SSPP_MULTIRECT_TIME_MX,  "serial"},
+	};
+	struct sde_kms_info *info;
+	struct sde_plane *psde = to_sde_plane(plane);
+	bool is_master;
+	int zpos_max = 255;
+	int zpos_def = 0;
 
-	if (psde->features & BIT(SDE_SSPP_MEMCOLOR)) {
-		snprintf(feature_name, sizeof(feature_name), "%s%d",
-			"SDE_SSPP_SKIN_COLOR_V",
-			psde->pipe_sblk->memcolor_blk.version >> 16);
-		msm_property_install_blob(&psde->property_info, feature_name, 0,
-			PLANE_PROP_SKIN_COLOR);
-		snprintf(feature_name, sizeof(feature_name), "%s%d",
-			"SDE_SSPP_SKY_COLOR_V",
-			psde->pipe_sblk->memcolor_blk.version >> 16);
-		msm_property_install_blob(&psde->property_info, feature_name, 0,
-			PLANE_PROP_SKY_COLOR);
-		snprintf(feature_name, sizeof(feature_name), "%s%d",
-			"SDE_SSPP_FOLIAGE_COLOR_V",
-			psde->pipe_sblk->memcolor_blk.version >> 16);
-		msm_property_install_blob(&psde->property_info, feature_name, 0,
-			PLANE_PROP_FOLIAGE_COLOR);
+	if (!plane || !psde) {
+		SDE_ERROR("invalid plane\n");
+		return;
+	} else if (!psde->pipe_hw || !psde->pipe_sblk) {
+		SDE_ERROR("invalid plane, pipe_hw %d pipe_sblk %d\n",
+				!psde->pipe_hw, !psde->pipe_sblk);
+		return;
+	} else if (!catalog) {
+		SDE_ERROR("invalid catalog\n");
+		return;
 	}
 
-	if (psde->features & BIT(SDE_SSPP_VIG_GAMUT)) {
-		snprintf(feature_name, sizeof(feature_name), "%s%d",
-			"SDE_VIG_3D_LUT_GAMUT_V",
-			psde->pipe_sblk->gamut_blk.version >> 16);
-		msm_property_install_blob(&psde->property_info, feature_name, 0,
-			PLANE_PROP_VIG_GAMUT);
-	}
+	psde->catalog = catalog;
+	is_master = !psde->is_virtual;
 
-	if (psde->features & BIT(SDE_SSPP_VIG_IGC)) {
-		snprintf(feature_name, sizeof(feature_name), "%s%d",
-			"SDE_VIG_1D_LUT_IGC_V",
-			psde->pipe_sblk->igc_blk[0].version >> 16);
-		msm_property_install_blob(&psde->property_info, feature_name, 0,
-			PLANE_PROP_VIG_IGC);
+	info = kzalloc(sizeof(struct sde_kms_info), GFP_KERNEL);
+	if (!info) {
+		SDE_ERROR("failed to allocate info memory\n");
+		return;
 	}
 
-	if (psde->features & BIT(SDE_SSPP_DMA_IGC)) {
-		snprintf(feature_name, sizeof(feature_name), "%s%d",
-			"SDE_DGM_1D_LUT_IGC_V",
-			psde->pipe_sblk->igc_blk[0].version >> 16);
-		msm_property_install_blob(&psde->property_info, feature_name, 0,
-			PLANE_PROP_DMA_IGC);
+	if (sde_is_custom_client()) {
+		if (catalog->mixer_count &&
+				catalog->mixer[0].sblk->maxblendstages) {
+			zpos_max = catalog->mixer[0].sblk->maxblendstages - 1;
+			if (catalog->has_base_layer &&
+					(zpos_max > SDE_STAGE_MAX - 1))
+				zpos_max = SDE_STAGE_MAX - 1;
+			else if (zpos_max > SDE_STAGE_MAX - SDE_STAGE_0 - 1)
+				zpos_max = SDE_STAGE_MAX - SDE_STAGE_0 - 1;
+		}
+	} else if (plane->type != DRM_PLANE_TYPE_PRIMARY) {
+		/* reserve zpos == 0 for primary planes */
+		zpos_def = drm_plane_index(plane) + 1;
 	}
 
-	if (psde->features & BIT(SDE_SSPP_DMA_GC)) {
-		snprintf(feature_name, sizeof(feature_name), "%s%d",
-			"SDE_DGM_1D_LUT_GC_V",
-			psde->pipe_sblk->gc_blk[0].version >> 16);
-		msm_property_install_blob(&psde->property_info, feature_name, 0,
-			PLANE_PROP_DMA_GC);
-	}
+	msm_property_install_range(&psde->property_info, "zpos",
+		0x0, 0, zpos_max, zpos_def, PLANE_PROP_ZPOS);
+
+	msm_property_install_range(&psde->property_info, "alpha",
+		0x0, 0, 255, 255, PLANE_PROP_ALPHA);
+
+	/* linux default file descriptor range on each process */
+	msm_property_install_range(&psde->property_info, "input_fence",
+		0x0, 0, INR_OPEN_MAX, 0, PLANE_PROP_INPUT_FENCE);
+
+	if (is_master)
+		_sde_plane_install_master_only_properties(psde);
+	else
+		msm_property_install_enum(&psde->property_info,
+				"multirect_mode", 0x0, 0, e_multirect_mode,
+				ARRAY_SIZE(e_multirect_mode),
+				PLANE_PROP_MULTIRECT_MODE);
+
+	if (psde->features & BIT(SDE_SSPP_EXCL_RECT))
+		msm_property_install_volatile_range(&psde->property_info,
+			"excl_rect_v1", 0x0, 0, ~0, 0, PLANE_PROP_EXCL_RECT_V1);
+
+	sde_plane_rot_install_properties(plane, catalog);
+
+	msm_property_install_enum(&psde->property_info, "blend_op", 0x0, 0,
+		e_blend_op, ARRAY_SIZE(e_blend_op), PLANE_PROP_BLEND_OP);
+
+	msm_property_install_enum(&psde->property_info, "src_config", 0x0, 1,
+		e_src_config, ARRAY_SIZE(e_src_config), PLANE_PROP_SRC_CONFIG);
+
+	if (psde->pipe_hw->ops.setup_solidfill)
+		msm_property_install_range(&psde->property_info, "color_fill",
+				0, 0, 0xFFFFFFFF, 0, PLANE_PROP_COLOR_FILL);
+
+	msm_property_install_range(&psde->property_info, "prefill_size", 0x0,
+			0, ~0, 0, PLANE_PROP_PREFILL_SIZE);
+	msm_property_install_range(&psde->property_info, "prefill_time", 0x0,
+			0, ~0, 0, PLANE_PROP_PREFILL_TIME);
+
+	msm_property_install_blob(&psde->property_info, "capabilities",
+			DRM_MODE_PROP_IMMUTABLE, PLANE_PROP_INFO);
+
+	sde_kms_info_reset(info);
+	_sde_plane_setup_capabilities_blob(psde, master_plane_id, info,
+			catalog);
+
+	_sde_plane_install_colorproc_properties(psde, info);
+
+	msm_property_set_blob(&psde->property_info, &psde->blob_info,
+			info->data, SDE_KMS_INFO_DATALEN(info),
+			PLANE_PROP_INFO);
 
 	msm_property_install_enum(&psde->property_info, "fb_translation_mode",
-			0x0,
-			0, e_fb_translation_mode,
+			0x0, 0, e_fb_translation_mode,
 			ARRAY_SIZE(e_fb_translation_mode),
 			PLANE_PROP_FB_TRANSLATION_MODE);
+
+	kfree(info);
 }
 
 static inline void _sde_plane_set_csc_v1(struct sde_plane *psde,