Просмотр исходного кода

disp: msm: sde: new formats added for true inline rotation v2

Advertise the new formats supported with true inline rotation v2 HW
(ABGR8888 compressed and P010).

Change-Id: I0a1b6dfd6bcfd82d9bc61e87680d2c584615e113
Signed-off-by: Steve Cohen <[email protected]>
Steve Cohen 6 лет назад
Родитель
Сommit
5a55e2d121
3 измененных файлов с 75 добавлено и 39 удалено
  1. 58 35
      msm/sde/sde_hw_catalog.c
  2. 5 0
      msm/sde/sde_hw_catalog.h
  3. 12 4
      msm/sde/sde_hw_catalog_format.h

+ 58 - 35
msm/sde/sde_hw_catalog.c

@@ -4049,58 +4049,84 @@ static int sde_hardware_format_caps(struct sde_mdss_cfg *sde_cfg,
 	uint32_t virt_vig_list_size, in_rot_list_size = 0;
 	uint32_t cursor_list_size = 0;
 	uint32_t index = 0;
+	const struct sde_format_extended *inline_fmt_tbl;
 
-
+	/* cursor input formats */
 	if (sde_cfg->has_cursor) {
 		cursor_list_size = ARRAY_SIZE(cursor_formats);
 		sde_cfg->cursor_formats = kcalloc(cursor_list_size,
 			sizeof(struct sde_format_extended), GFP_KERNEL);
 		if (!sde_cfg->cursor_formats) {
 			rc = -ENOMEM;
-			goto end;
+			goto out;
 		}
 		index = sde_copy_formats(sde_cfg->cursor_formats,
 			cursor_list_size, 0, cursor_formats,
 			ARRAY_SIZE(cursor_formats));
 	}
 
+	/* DMA pipe input formats */
 	dma_list_size = ARRAY_SIZE(plane_formats);
-	vig_list_size = ARRAY_SIZE(plane_formats_vig);
-	if (sde_cfg->has_vig_p010)
-		vig_list_size += ARRAY_SIZE(p010_ubwc_formats);
-	virt_vig_list_size = ARRAY_SIZE(plane_formats);
-	wb2_list_size = ARRAY_SIZE(wb2_formats);
-
-	if (IS_SDE_INLINE_ROT_REV_100(sde_cfg->true_inline_rot_rev))
-		in_rot_list_size = ARRAY_SIZE(true_inline_rot_v1_fmts);
-
 	sde_cfg->dma_formats = kcalloc(dma_list_size,
 		sizeof(struct sde_format_extended), GFP_KERNEL);
 	if (!sde_cfg->dma_formats) {
 		rc = -ENOMEM;
-		goto end;
+		goto free_cursor;
 	}
 
+	index = sde_copy_formats(sde_cfg->dma_formats, dma_list_size,
+			0, plane_formats, ARRAY_SIZE(plane_formats));
+
+	/* ViG pipe input formats */
+	vig_list_size = ARRAY_SIZE(plane_formats_vig);
+	if (sde_cfg->has_vig_p010)
+		vig_list_size += ARRAY_SIZE(p010_ubwc_formats);
 	sde_cfg->vig_formats = kcalloc(vig_list_size,
 		sizeof(struct sde_format_extended), GFP_KERNEL);
 	if (!sde_cfg->vig_formats) {
 		rc = -ENOMEM;
-		goto end;
+		goto free_dma;
 	}
 
+	index = sde_copy_formats(sde_cfg->vig_formats, vig_list_size,
+			0, plane_formats_vig, ARRAY_SIZE(plane_formats_vig));
+	if (sde_cfg->has_vig_p010)
+		index += sde_copy_formats(sde_cfg->vig_formats,
+				vig_list_size, index, p010_ubwc_formats,
+				ARRAY_SIZE(p010_ubwc_formats));
+
+	/* Virtual ViG pipe input formats (all virt pipes use DMA formats) */
+	virt_vig_list_size = ARRAY_SIZE(plane_formats);
 	sde_cfg->virt_vig_formats = kcalloc(virt_vig_list_size,
 		sizeof(struct sde_format_extended), GFP_KERNEL);
 	if (!sde_cfg->virt_vig_formats) {
 		rc = -ENOMEM;
-		goto end;
+		goto free_vig;
 	}
 
+	index = sde_copy_formats(sde_cfg->virt_vig_formats, virt_vig_list_size,
+			0, plane_formats, ARRAY_SIZE(plane_formats));
+
+	/* WB output formats */
+	wb2_list_size = ARRAY_SIZE(wb2_formats);
 	sde_cfg->wb_formats = kcalloc(wb2_list_size,
 		sizeof(struct sde_format_extended), GFP_KERNEL);
 	if (!sde_cfg->wb_formats) {
 		SDE_ERROR("failed to allocate wb format list\n");
 		rc = -ENOMEM;
-		goto end;
+		goto free_virt;
+	}
+
+	index = sde_copy_formats(sde_cfg->wb_formats, wb2_list_size,
+			0, wb2_formats, ARRAY_SIZE(wb2_formats));
+
+	/* Rotation enabled input formats */
+	if (IS_SDE_INLINE_ROT_REV_100(sde_cfg->true_inline_rot_rev)) {
+		inline_fmt_tbl = true_inline_rot_v1_fmts;
+		in_rot_list_size = ARRAY_SIZE(true_inline_rot_v1_fmts);
+	} else if (IS_SDE_INLINE_ROT_REV_200(sde_cfg->true_inline_rot_rev)) {
+		inline_fmt_tbl = true_inline_rot_v2_fmts;
+		in_rot_list_size = ARRAY_SIZE(true_inline_rot_v2_fmts);
 	}
 
 	if (in_rot_list_size) {
@@ -4109,30 +4135,27 @@ static int sde_hardware_format_caps(struct sde_mdss_cfg *sde_cfg,
 		if (!sde_cfg->inline_rot_formats) {
 			SDE_ERROR("failed to alloc inline rot format list\n");
 			rc = -ENOMEM;
-			goto end;
+			goto free_wb;
 		}
-	}
-
-	index = sde_copy_formats(sde_cfg->dma_formats, dma_list_size,
-		0, plane_formats, ARRAY_SIZE(plane_formats));
 
-	index = sde_copy_formats(sde_cfg->vig_formats, vig_list_size,
-		0, plane_formats_vig, ARRAY_SIZE(plane_formats_vig));
-	if (sde_cfg->has_vig_p010)
-		index += sde_copy_formats(sde_cfg->vig_formats,
-			vig_list_size, index, p010_ubwc_formats,
-			ARRAY_SIZE(p010_ubwc_formats));
+		index = sde_copy_formats(sde_cfg->inline_rot_formats,
+			in_rot_list_size, 0, inline_fmt_tbl, in_rot_list_size);
+	}
 
-	index = sde_copy_formats(sde_cfg->virt_vig_formats, virt_vig_list_size,
-		0, plane_formats, ARRAY_SIZE(plane_formats));
+	return 0;
 
-	index = sde_copy_formats(sde_cfg->wb_formats, wb2_list_size,
-		0, wb2_formats, ARRAY_SIZE(wb2_formats));
-	if (in_rot_list_size)
-		index = sde_copy_formats(sde_cfg->inline_rot_formats,
-			in_rot_list_size, 0, true_inline_rot_v1_fmts,
-			ARRAY_SIZE(true_inline_rot_v1_fmts));
-end:
+free_wb:
+	kfree(sde_cfg->wb_formats);
+free_virt:
+	kfree(sde_cfg->virt_vig_formats);
+free_vig:
+	kfree(sde_cfg->vig_formats);
+free_dma:
+	kfree(sde_cfg->dma_formats);
+free_cursor:
+	if (sde_cfg->has_cursor)
+		kfree(sde_cfg->cursor_formats);
+out:
 	return rc;
 }
 

+ 5 - 0
msm/sde/sde_hw_catalog.h

@@ -94,8 +94,13 @@
  * True inline rotation supported versions
  */
 #define SDE_INLINE_ROT_VERSION_1_0_0	0x100
+#define SDE_INLINE_ROT_VERSION_2_0_0	0x200
+
 #define IS_SDE_INLINE_ROT_REV_100(rev) \
 	((rev) == SDE_INLINE_ROT_VERSION_1_0_0)
+#define IS_SDE_INLINE_ROT_REV_200(rev) \
+	((rev) == SDE_INLINE_ROT_VERSION_2_0_0)
+
 
 /*
  * UIDLE supported versions

+ 12 - 4
msm/sde/sde_hw_catalog_format.h

@@ -53,6 +53,8 @@
 
 #define P010_FMTS	{DRM_FORMAT_NV12, DRM_FORMAT_MOD_QCOM_DX}
 
+#define P010_UBWC_FMTS	{DRM_FORMAT_NV12, DRM_FORMAT_MOD_QCOM_DX | \
+		DRM_FORMAT_MOD_QCOM_COMPRESSED}
 
 static const struct sde_format_extended plane_formats[] = {
 	RGB_FMTS,
@@ -146,13 +148,19 @@ static const struct sde_format_extended wb2_formats[] = {
 };
 
 static const struct sde_format_extended p010_ubwc_formats[] = {
-	{DRM_FORMAT_NV12, DRM_FORMAT_MOD_QCOM_DX |
-		DRM_FORMAT_MOD_QCOM_COMPRESSED},
+	P010_UBWC_FMTS,
 };
 
 static const struct sde_format_extended true_inline_rot_v1_fmts[] = {
 	{DRM_FORMAT_NV12, DRM_FORMAT_MOD_QCOM_COMPRESSED},
-	{DRM_FORMAT_NV12, DRM_FORMAT_MOD_QCOM_COMPRESSED |
-		DRM_FORMAT_MOD_QCOM_DX | DRM_FORMAT_MOD_QCOM_TIGHT}, /* tp10 */
+	TP10_UBWC_FMTS,
+	{0, 0},
+};
+
+static const struct sde_format_extended true_inline_rot_v2_fmts[] = {
+	{DRM_FORMAT_ABGR8888, DRM_FORMAT_MOD_QCOM_COMPRESSED},
+	{DRM_FORMAT_NV12, DRM_FORMAT_MOD_QCOM_COMPRESSED},
+	TP10_UBWC_FMTS,
+	P010_UBWC_FMTS,
 	{0, 0},
 };