|
@@ -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 virt_vig_list_size, in_rot_list_size = 0;
|
|
uint32_t cursor_list_size = 0;
|
|
uint32_t cursor_list_size = 0;
|
|
uint32_t index = 0;
|
|
uint32_t index = 0;
|
|
|
|
+ const struct sde_format_extended *inline_fmt_tbl;
|
|
|
|
|
|
-
|
|
|
|
|
|
+ /* cursor input formats */
|
|
if (sde_cfg->has_cursor) {
|
|
if (sde_cfg->has_cursor) {
|
|
cursor_list_size = ARRAY_SIZE(cursor_formats);
|
|
cursor_list_size = ARRAY_SIZE(cursor_formats);
|
|
sde_cfg->cursor_formats = kcalloc(cursor_list_size,
|
|
sde_cfg->cursor_formats = kcalloc(cursor_list_size,
|
|
sizeof(struct sde_format_extended), GFP_KERNEL);
|
|
sizeof(struct sde_format_extended), GFP_KERNEL);
|
|
if (!sde_cfg->cursor_formats) {
|
|
if (!sde_cfg->cursor_formats) {
|
|
rc = -ENOMEM;
|
|
rc = -ENOMEM;
|
|
- goto end;
|
|
|
|
|
|
+ goto out;
|
|
}
|
|
}
|
|
index = sde_copy_formats(sde_cfg->cursor_formats,
|
|
index = sde_copy_formats(sde_cfg->cursor_formats,
|
|
cursor_list_size, 0, cursor_formats,
|
|
cursor_list_size, 0, cursor_formats,
|
|
ARRAY_SIZE(cursor_formats));
|
|
ARRAY_SIZE(cursor_formats));
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /* DMA pipe input formats */
|
|
dma_list_size = ARRAY_SIZE(plane_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,
|
|
sde_cfg->dma_formats = kcalloc(dma_list_size,
|
|
sizeof(struct sde_format_extended), GFP_KERNEL);
|
|
sizeof(struct sde_format_extended), GFP_KERNEL);
|
|
if (!sde_cfg->dma_formats) {
|
|
if (!sde_cfg->dma_formats) {
|
|
rc = -ENOMEM;
|
|
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,
|
|
sde_cfg->vig_formats = kcalloc(vig_list_size,
|
|
sizeof(struct sde_format_extended), GFP_KERNEL);
|
|
sizeof(struct sde_format_extended), GFP_KERNEL);
|
|
if (!sde_cfg->vig_formats) {
|
|
if (!sde_cfg->vig_formats) {
|
|
rc = -ENOMEM;
|
|
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,
|
|
sde_cfg->virt_vig_formats = kcalloc(virt_vig_list_size,
|
|
sizeof(struct sde_format_extended), GFP_KERNEL);
|
|
sizeof(struct sde_format_extended), GFP_KERNEL);
|
|
if (!sde_cfg->virt_vig_formats) {
|
|
if (!sde_cfg->virt_vig_formats) {
|
|
rc = -ENOMEM;
|
|
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,
|
|
sde_cfg->wb_formats = kcalloc(wb2_list_size,
|
|
sizeof(struct sde_format_extended), GFP_KERNEL);
|
|
sizeof(struct sde_format_extended), GFP_KERNEL);
|
|
if (!sde_cfg->wb_formats) {
|
|
if (!sde_cfg->wb_formats) {
|
|
SDE_ERROR("failed to allocate wb format list\n");
|
|
SDE_ERROR("failed to allocate wb format list\n");
|
|
rc = -ENOMEM;
|
|
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) {
|
|
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) {
|
|
if (!sde_cfg->inline_rot_formats) {
|
|
SDE_ERROR("failed to alloc inline rot format list\n");
|
|
SDE_ERROR("failed to alloc inline rot format list\n");
|
|
rc = -ENOMEM;
|
|
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;
|
|
return rc;
|
|
}
|
|
}
|
|
|
|
|