linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v1 0/5] MediaTek DPI: Cleanups and add support for more formats
@ 2025-04-09 13:13 AngeloGioacchino Del Regno
  2025-04-09 13:13 ` [PATCH v1 1/5] drm/mediatek: mtk_dpi: Use switch in mtk_dpi_config_color_format() AngeloGioacchino Del Regno
                   ` (5 more replies)
  0 siblings, 6 replies; 14+ messages in thread
From: AngeloGioacchino Del Regno @ 2025-04-09 13:13 UTC (permalink / raw)
  To: chunkuang.hu
  Cc: p.zabel, airlied, simona, matthias.bgg, angelogioacchino.delregno,
	dri-devel, linux-mediatek, linux-kernel, linux-arm-kernel, kernel,
	lewis.liao, ives.chenjh, tommyyl.chen, jason-jh.lin

This series adds support to configure the MediaTek DPI IP to output
more formats, such as YUV422 8/10/12 bits, YUV444 8/10 bits, BGR 8bits,
and RGB 10 bits, and also performs some cleanups that improve the code
readability when those are added.

Even though some of those formats are also supported by MT8173, MT8183,
MT8186 and MT8192, I am enabling them only for MT8195/MT8188 as those
are the only two that I was able to test.

This was tested on:
 - MT8195 Tomato Chromebook
 - MT8395 Radxa NIO-12L
 - MT8390 MediaTek Genio 700 EVK

AngeloGioacchino Del Regno (5):
  drm/mediatek: mtk_dpi: Use switch in mtk_dpi_config_color_format()
  drm/mediatek: mtk_dpi: Add local helpers for bus format parameters
  drm/mediatek: mtk_dpi: Add support for additional output formats
  drm/mediatek: mtk_dpi: Allow additional output formats on MT8195/88
  drm/mediatek: mtk_dpi: Rename output fmts array for MT8195 DP_INTF

 drivers/gpu/drm/mediatek/mtk_dpi.c | 117 +++++++++++++++++++++++++----
 1 file changed, 102 insertions(+), 15 deletions(-)

-- 
2.49.0



^ permalink raw reply	[flat|nested] 14+ messages in thread

* [PATCH v1 1/5] drm/mediatek: mtk_dpi: Use switch in mtk_dpi_config_color_format()
  2025-04-09 13:13 [PATCH v1 0/5] MediaTek DPI: Cleanups and add support for more formats AngeloGioacchino Del Regno
@ 2025-04-09 13:13 ` AngeloGioacchino Del Regno
  2025-04-22  3:30   ` CK Hu (胡俊光)
  2025-04-09 13:13 ` [PATCH v1 2/5] drm/mediatek: mtk_dpi: Add local helpers for bus format parameters AngeloGioacchino Del Regno
                   ` (4 subsequent siblings)
  5 siblings, 1 reply; 14+ messages in thread
From: AngeloGioacchino Del Regno @ 2025-04-09 13:13 UTC (permalink / raw)
  To: chunkuang.hu
  Cc: p.zabel, airlied, simona, matthias.bgg, angelogioacchino.delregno,
	dri-devel, linux-mediatek, linux-kernel, linux-arm-kernel, kernel,
	lewis.liao, ives.chenjh, tommyyl.chen, jason-jh.lin

In preparation for adding support for an additional color format,
convert the format conditional in mtk_dpi_config_color_format()
to a switch.
This also makes the concept of RGB being the default color format
a little more human readable.

This commit brings no functional differences.

Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
---
 drivers/gpu/drm/mediatek/mtk_dpi.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/mediatek/mtk_dpi.c b/drivers/gpu/drm/mediatek/mtk_dpi.c
index 0fd13e6dd3f1..d735398e97f8 100644
--- a/drivers/gpu/drm/mediatek/mtk_dpi.c
+++ b/drivers/gpu/drm/mediatek/mtk_dpi.c
@@ -452,7 +452,8 @@ static void mtk_dpi_config_color_format(struct mtk_dpi *dpi,
 {
 	mtk_dpi_config_channel_swap(dpi, MTK_DPI_OUT_CHANNEL_SWAP_RGB);
 
-	if (format == MTK_DPI_COLOR_FORMAT_YCBCR_422) {
+	switch (format) {
+	case MTK_DPI_COLOR_FORMAT_YCBCR_422:
 		mtk_dpi_config_yuv422_enable(dpi, true);
 		mtk_dpi_config_csc_enable(dpi, true);
 
@@ -463,11 +464,14 @@ static void mtk_dpi_config_color_format(struct mtk_dpi *dpi,
 		mtk_dpi_mask(dpi, DPI_MATRIX_SET, dpi->mode.hdisplay <= 720 ?
 			     MATRIX_SEL_RGB_TO_BT601 : MATRIX_SEL_RGB_TO_JPEG,
 			     INT_MATRIX_SEL_MASK);
-	} else {
+		break;
+	default:
+	case MTK_DPI_COLOR_FORMAT_RGB:
 		mtk_dpi_config_yuv422_enable(dpi, false);
 		mtk_dpi_config_csc_enable(dpi, false);
 		if (dpi->conf->swap_input_support)
 			mtk_dpi_config_swap_input(dpi, false);
+		break;
 	}
 }
 
-- 
2.49.0



^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH v1 2/5] drm/mediatek: mtk_dpi: Add local helpers for bus format parameters
  2025-04-09 13:13 [PATCH v1 0/5] MediaTek DPI: Cleanups and add support for more formats AngeloGioacchino Del Regno
  2025-04-09 13:13 ` [PATCH v1 1/5] drm/mediatek: mtk_dpi: Use switch in mtk_dpi_config_color_format() AngeloGioacchino Del Regno
@ 2025-04-09 13:13 ` AngeloGioacchino Del Regno
  2025-04-22  4:00   ` CK Hu (胡俊光)
  2025-04-09 13:13 ` [PATCH v1 3/5] drm/mediatek: mtk_dpi: Add support for additional output formats AngeloGioacchino Del Regno
                   ` (3 subsequent siblings)
  5 siblings, 1 reply; 14+ messages in thread
From: AngeloGioacchino Del Regno @ 2025-04-09 13:13 UTC (permalink / raw)
  To: chunkuang.hu
  Cc: p.zabel, airlied, simona, matthias.bgg, angelogioacchino.delregno,
	dri-devel, linux-mediatek, linux-kernel, linux-arm-kernel, kernel,
	lewis.liao, ives.chenjh, tommyyl.chen, jason-jh.lin

In preparation for adding support for additional color formats,
add local helpers to map media bus format parameters to this
driver's bit_num, channel_swap and color_format.

This commit brings no functional changes.

Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
---
 drivers/gpu/drm/mediatek/mtk_dpi.c | 46 ++++++++++++++++++++++++++----
 1 file changed, 40 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/mediatek/mtk_dpi.c b/drivers/gpu/drm/mediatek/mtk_dpi.c
index d735398e97f8..5a66dfe3ad40 100644
--- a/drivers/gpu/drm/mediatek/mtk_dpi.c
+++ b/drivers/gpu/drm/mediatek/mtk_dpi.c
@@ -738,6 +738,43 @@ static u32 *mtk_dpi_bridge_atomic_get_input_bus_fmts(struct drm_bridge *bridge,
 	return input_fmts;
 }
 
+static unsigned int mtk_dpi_bus_fmt_bit_num(unsigned int out_bus_format)
+{
+	switch (out_bus_format) {
+	default:
+	case MEDIA_BUS_FMT_RGB888_1X24:
+	case MEDIA_BUS_FMT_RGB888_2X12_LE:
+	case MEDIA_BUS_FMT_RGB888_2X12_BE:
+	case MEDIA_BUS_FMT_YUYV8_1X16:
+		return MTK_DPI_OUT_BIT_NUM_8BITS;
+	}
+}
+
+static unsigned int mtk_dpi_bus_fmt_channel_swap(unsigned int out_bus_format)
+{
+	switch (out_bus_format) {
+	default:
+	case MEDIA_BUS_FMT_RGB888_1X24:
+	case MEDIA_BUS_FMT_RGB888_2X12_LE:
+	case MEDIA_BUS_FMT_RGB888_2X12_BE:
+	case MEDIA_BUS_FMT_YUYV8_1X16:
+		return MTK_DPI_OUT_CHANNEL_SWAP_RGB;
+	}
+}
+
+static unsigned int mtk_dpi_bus_fmt_color_format(unsigned int out_bus_format)
+{
+	switch (out_bus_format) {
+	default:
+	case MEDIA_BUS_FMT_RGB888_1X24:
+	case MEDIA_BUS_FMT_RGB888_2X12_LE:
+	case MEDIA_BUS_FMT_RGB888_2X12_BE:
+		return MTK_DPI_COLOR_FORMAT_RGB;
+	case MEDIA_BUS_FMT_YUYV8_1X16:
+		return MTK_DPI_COLOR_FORMAT_YCBCR_422;
+	}
+}
+
 static int mtk_dpi_bridge_atomic_check(struct drm_bridge *bridge,
 				       struct drm_bridge_state *bridge_state,
 				       struct drm_crtc_state *crtc_state,
@@ -757,13 +794,10 @@ static int mtk_dpi_bridge_atomic_check(struct drm_bridge *bridge,
 		bridge_state->output_bus_cfg.format);
 
 	dpi->output_fmt = out_bus_format;
-	dpi->bit_num = MTK_DPI_OUT_BIT_NUM_8BITS;
-	dpi->channel_swap = MTK_DPI_OUT_CHANNEL_SWAP_RGB;
+	dpi->bit_num = mtk_dpi_bus_fmt_bit_num(out_bus_format);
+	dpi->channel_swap = mtk_dpi_bus_fmt_channel_swap(out_bus_format);
 	dpi->yc_map = MTK_DPI_OUT_YC_MAP_RGB;
-	if (out_bus_format == MEDIA_BUS_FMT_YUYV8_1X16)
-		dpi->color_format = MTK_DPI_COLOR_FORMAT_YCBCR_422;
-	else
-		dpi->color_format = MTK_DPI_COLOR_FORMAT_RGB;
+	dpi->color_format = mtk_dpi_bus_fmt_color_format(out_bus_format);
 
 	return 0;
 }
-- 
2.49.0



^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH v1 3/5] drm/mediatek: mtk_dpi: Add support for additional output formats
  2025-04-09 13:13 [PATCH v1 0/5] MediaTek DPI: Cleanups and add support for more formats AngeloGioacchino Del Regno
  2025-04-09 13:13 ` [PATCH v1 1/5] drm/mediatek: mtk_dpi: Use switch in mtk_dpi_config_color_format() AngeloGioacchino Del Regno
  2025-04-09 13:13 ` [PATCH v1 2/5] drm/mediatek: mtk_dpi: Add local helpers for bus format parameters AngeloGioacchino Del Regno
@ 2025-04-09 13:13 ` AngeloGioacchino Del Regno
  2025-04-22  5:50   ` CK Hu (胡俊光)
  2025-04-09 13:13 ` [PATCH v1 4/5] drm/mediatek: mtk_dpi: Allow additional output formats on MT8195/88 AngeloGioacchino Del Regno
                   ` (2 subsequent siblings)
  5 siblings, 1 reply; 14+ messages in thread
From: AngeloGioacchino Del Regno @ 2025-04-09 13:13 UTC (permalink / raw)
  To: chunkuang.hu
  Cc: p.zabel, airlied, simona, matthias.bgg, angelogioacchino.delregno,
	dri-devel, linux-mediatek, linux-kernel, linux-arm-kernel, kernel,
	lewis.liao, ives.chenjh, tommyyl.chen, jason-jh.lin

Add support for configuring the Display Parallel Interface block
to output YUV444 8/10 bits, YUV422 10/12 bits (8 bits support is
already present), BGR 8-bits, and RGB 10-bits.

The enablement of the various additional output formats in SoCs
platform data will be done in a different change.

Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
---
 drivers/gpu/drm/mediatek/mtk_dpi.c | 33 ++++++++++++++++++++++++++++--
 1 file changed, 31 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/mediatek/mtk_dpi.c b/drivers/gpu/drm/mediatek/mtk_dpi.c
index 5a66dfe3ad40..a9e8113a1618 100644
--- a/drivers/gpu/drm/mediatek/mtk_dpi.c
+++ b/drivers/gpu/drm/mediatek/mtk_dpi.c
@@ -59,7 +59,8 @@ enum mtk_dpi_out_channel_swap {
 
 enum mtk_dpi_out_color_format {
 	MTK_DPI_COLOR_FORMAT_RGB,
-	MTK_DPI_COLOR_FORMAT_YCBCR_422
+	MTK_DPI_COLOR_FORMAT_YCBCR_422,
+	MTK_DPI_COLOR_FORMAT_YCBCR_444
 };
 
 struct mtk_dpi {
@@ -450,9 +451,15 @@ static void mtk_dpi_config_disable_edge(struct mtk_dpi *dpi)
 static void mtk_dpi_config_color_format(struct mtk_dpi *dpi,
 					enum mtk_dpi_out_color_format format)
 {
-	mtk_dpi_config_channel_swap(dpi, MTK_DPI_OUT_CHANNEL_SWAP_RGB);
+	mtk_dpi_config_channel_swap(dpi, dpi->channel_swap);
 
 	switch (format) {
+	case MTK_DPI_COLOR_FORMAT_YCBCR_444:
+		mtk_dpi_config_yuv422_enable(dpi, false);
+		mtk_dpi_config_csc_enable(dpi, true);
+		if (dpi->conf->swap_input_support)
+			mtk_dpi_config_swap_input(dpi, false);
+		break;
 	case MTK_DPI_COLOR_FORMAT_YCBCR_422:
 		mtk_dpi_config_yuv422_enable(dpi, true);
 		mtk_dpi_config_csc_enable(dpi, true);
@@ -743,10 +750,18 @@ static unsigned int mtk_dpi_bus_fmt_bit_num(unsigned int out_bus_format)
 	switch (out_bus_format) {
 	default:
 	case MEDIA_BUS_FMT_RGB888_1X24:
+	case MEDIA_BUS_FMT_BGR888_1X24:
 	case MEDIA_BUS_FMT_RGB888_2X12_LE:
 	case MEDIA_BUS_FMT_RGB888_2X12_BE:
 	case MEDIA_BUS_FMT_YUYV8_1X16:
+	case MEDIA_BUS_FMT_YUV8_1X24:
 		return MTK_DPI_OUT_BIT_NUM_8BITS;
+	case MEDIA_BUS_FMT_RGB101010_1X30:
+	case MEDIA_BUS_FMT_YUYV10_1X20:
+	case MEDIA_BUS_FMT_YUV10_1X30:
+		return MTK_DPI_OUT_BIT_NUM_10BITS;
+	case MEDIA_BUS_FMT_YUYV12_1X24:
+		return MTK_DPI_OUT_BIT_NUM_12BITS;
 	}
 }
 
@@ -757,8 +772,15 @@ static unsigned int mtk_dpi_bus_fmt_channel_swap(unsigned int out_bus_format)
 	case MEDIA_BUS_FMT_RGB888_1X24:
 	case MEDIA_BUS_FMT_RGB888_2X12_LE:
 	case MEDIA_BUS_FMT_RGB888_2X12_BE:
+	case MEDIA_BUS_FMT_RGB101010_1X30:
 	case MEDIA_BUS_FMT_YUYV8_1X16:
+	case MEDIA_BUS_FMT_YUYV10_1X20:
+	case MEDIA_BUS_FMT_YUYV12_1X24:
 		return MTK_DPI_OUT_CHANNEL_SWAP_RGB;
+	case MEDIA_BUS_FMT_BGR888_1X24:
+	case MEDIA_BUS_FMT_YUV8_1X24:
+	case MEDIA_BUS_FMT_YUV10_1X30:
+		return MTK_DPI_OUT_CHANNEL_SWAP_BGR;
 	}
 }
 
@@ -767,11 +789,18 @@ static unsigned int mtk_dpi_bus_fmt_color_format(unsigned int out_bus_format)
 	switch (out_bus_format) {
 	default:
 	case MEDIA_BUS_FMT_RGB888_1X24:
+	case MEDIA_BUS_FMT_BGR888_1X24:
 	case MEDIA_BUS_FMT_RGB888_2X12_LE:
 	case MEDIA_BUS_FMT_RGB888_2X12_BE:
+	case MEDIA_BUS_FMT_RGB101010_1X30:
 		return MTK_DPI_COLOR_FORMAT_RGB;
 	case MEDIA_BUS_FMT_YUYV8_1X16:
+	case MEDIA_BUS_FMT_YUYV10_1X20:
+	case MEDIA_BUS_FMT_YUYV12_1X24:
 		return MTK_DPI_COLOR_FORMAT_YCBCR_422;
+	case MEDIA_BUS_FMT_YUV8_1X24:
+	case MEDIA_BUS_FMT_YUV10_1X30:
+		return MTK_DPI_COLOR_FORMAT_YCBCR_444;
 	}
 }
 
-- 
2.49.0



^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH v1 4/5] drm/mediatek: mtk_dpi: Allow additional output formats on MT8195/88
  2025-04-09 13:13 [PATCH v1 0/5] MediaTek DPI: Cleanups and add support for more formats AngeloGioacchino Del Regno
                   ` (2 preceding siblings ...)
  2025-04-09 13:13 ` [PATCH v1 3/5] drm/mediatek: mtk_dpi: Add support for additional output formats AngeloGioacchino Del Regno
@ 2025-04-09 13:13 ` AngeloGioacchino Del Regno
  2025-04-22  6:01   ` CK Hu (胡俊光)
  2025-04-09 13:13 ` [PATCH v1 5/5] drm/mediatek: mtk_dpi: Rename output fmts array for MT8195 DP_INTF AngeloGioacchino Del Regno
  2025-04-27  1:47 ` [PATCH v1 0/5] MediaTek DPI: Cleanups and add support for more formats Chun-Kuang Hu
  5 siblings, 1 reply; 14+ messages in thread
From: AngeloGioacchino Del Regno @ 2025-04-09 13:13 UTC (permalink / raw)
  To: chunkuang.hu
  Cc: p.zabel, airlied, simona, matthias.bgg, angelogioacchino.delregno,
	dri-devel, linux-mediatek, linux-kernel, linux-arm-kernel, kernel,
	lewis.liao, ives.chenjh, tommyyl.chen, jason-jh.lin

Allow additional output formats in both DPI and DP_INTF blocks of
the MT8195 and MT8188 SoCs (as the latter is fully compatible with,
hence reuses, the former's platform data for both blocks) by adding:

1. New formats to the `mt8195_output_fmts` array for dp_intf,
   lacking YUV422 12-bits support, and adding RGB888 2X12_LE/BE
   (8-bits), BGR888 (8-bits) RGB101010 1x30 (10-bits), and YUV
   formats, including YUV422 8/10 bits, and YUV444 8/10 bits; and
2. A new `mt8195_dpi_output_fmts` array for DPI only, with all of
   for formats added to dp_intf and with the addition of the
   YUYV12_1X24 (YUV422 12-bits) output format.

Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
---
 drivers/gpu/drm/mediatek/mtk_dpi.c | 24 ++++++++++++++++++++++--
 1 file changed, 22 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/mediatek/mtk_dpi.c b/drivers/gpu/drm/mediatek/mtk_dpi.c
index a9e8113a1618..9de537a77493 100644
--- a/drivers/gpu/drm/mediatek/mtk_dpi.c
+++ b/drivers/gpu/drm/mediatek/mtk_dpi.c
@@ -1093,9 +1093,29 @@ static const u32 mt8183_output_fmts[] = {
 	MEDIA_BUS_FMT_RGB888_2X12_BE,
 };
 
+static const u32 mt8195_dpi_output_fmts[] = {
+	MEDIA_BUS_FMT_RGB888_1X24,
+	MEDIA_BUS_FMT_RGB888_2X12_LE,
+	MEDIA_BUS_FMT_RGB888_2X12_BE,
+	MEDIA_BUS_FMT_RGB101010_1X30,
+	MEDIA_BUS_FMT_YUYV8_1X16,
+	MEDIA_BUS_FMT_YUYV10_1X20,
+	MEDIA_BUS_FMT_YUYV12_1X24,
+	MEDIA_BUS_FMT_BGR888_1X24,
+	MEDIA_BUS_FMT_YUV8_1X24,
+	MEDIA_BUS_FMT_YUV10_1X30,
+};
+
 static const u32 mt8195_output_fmts[] = {
 	MEDIA_BUS_FMT_RGB888_1X24,
+	MEDIA_BUS_FMT_RGB888_2X12_LE,
+	MEDIA_BUS_FMT_RGB888_2X12_BE,
+	MEDIA_BUS_FMT_RGB101010_1X30,
 	MEDIA_BUS_FMT_YUYV8_1X16,
+	MEDIA_BUS_FMT_YUYV10_1X20,
+	MEDIA_BUS_FMT_BGR888_1X24,
+	MEDIA_BUS_FMT_YUV8_1X24,
+	MEDIA_BUS_FMT_YUV10_1X30,
 };
 
 static const struct mtk_dpi_factor dpi_factor_mt2701[] = {
@@ -1208,8 +1228,8 @@ static const struct mtk_dpi_conf mt8192_conf = {
 
 static const struct mtk_dpi_conf mt8195_conf = {
 	.max_clock_khz = 594000,
-	.output_fmts = mt8183_output_fmts,
-	.num_output_fmts = ARRAY_SIZE(mt8183_output_fmts),
+	.output_fmts = mt8195_dpi_output_fmts,
+	.num_output_fmts = ARRAY_SIZE(mt8195_dpi_output_fmts),
 	.pixels_per_iter = 1,
 	.is_ck_de_pol = true,
 	.swap_input_support = true,
-- 
2.49.0



^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH v1 5/5] drm/mediatek: mtk_dpi: Rename output fmts array for MT8195 DP_INTF
  2025-04-09 13:13 [PATCH v1 0/5] MediaTek DPI: Cleanups and add support for more formats AngeloGioacchino Del Regno
                   ` (3 preceding siblings ...)
  2025-04-09 13:13 ` [PATCH v1 4/5] drm/mediatek: mtk_dpi: Allow additional output formats on MT8195/88 AngeloGioacchino Del Regno
@ 2025-04-09 13:13 ` AngeloGioacchino Del Regno
  2025-04-22  6:04   ` CK Hu (胡俊光)
  2025-04-27  1:47 ` [PATCH v1 0/5] MediaTek DPI: Cleanups and add support for more formats Chun-Kuang Hu
  5 siblings, 1 reply; 14+ messages in thread
From: AngeloGioacchino Del Regno @ 2025-04-09 13:13 UTC (permalink / raw)
  To: chunkuang.hu
  Cc: p.zabel, airlied, simona, matthias.bgg, angelogioacchino.delregno,
	dri-devel, linux-mediatek, linux-kernel, linux-arm-kernel, kernel,
	lewis.liao, ives.chenjh, tommyyl.chen, jason-jh.lin

For the sake of increasing human readability and avoid possible
confusion between DPI and DP_INTF output formats (as the two are
ever so slightly different), rename the mt8195_output_fmts array
to mt8195_dp_intf_output_fmts.

This commit brings no functional changes.

Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
---
 drivers/gpu/drm/mediatek/mtk_dpi.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/mediatek/mtk_dpi.c b/drivers/gpu/drm/mediatek/mtk_dpi.c
index 9de537a77493..0b7f91fb519f 100644
--- a/drivers/gpu/drm/mediatek/mtk_dpi.c
+++ b/drivers/gpu/drm/mediatek/mtk_dpi.c
@@ -1106,7 +1106,7 @@ static const u32 mt8195_dpi_output_fmts[] = {
 	MEDIA_BUS_FMT_YUV10_1X30,
 };
 
-static const u32 mt8195_output_fmts[] = {
+static const u32 mt8195_dp_intf_output_fmts[] = {
 	MEDIA_BUS_FMT_RGB888_1X24,
 	MEDIA_BUS_FMT_RGB888_2X12_LE,
 	MEDIA_BUS_FMT_RGB888_2X12_BE,
@@ -1248,8 +1248,8 @@ static const struct mtk_dpi_conf mt8195_dpintf_conf = {
 	.dpi_factor = dpi_factor_mt8195_dp_intf,
 	.num_dpi_factor = ARRAY_SIZE(dpi_factor_mt8195_dp_intf),
 	.max_clock_khz = 600000,
-	.output_fmts = mt8195_output_fmts,
-	.num_output_fmts = ARRAY_SIZE(mt8195_output_fmts),
+	.output_fmts = mt8195_dp_intf_output_fmts,
+	.num_output_fmts = ARRAY_SIZE(mt8195_dp_intf_output_fmts),
 	.pixels_per_iter = 4,
 	.dimension_mask = DPINTF_HPW_MASK,
 	.hvsize_mask = DPINTF_HSIZE_MASK,
-- 
2.49.0



^ permalink raw reply related	[flat|nested] 14+ messages in thread

* Re: [PATCH v1 1/5] drm/mediatek: mtk_dpi: Use switch in mtk_dpi_config_color_format()
  2025-04-09 13:13 ` [PATCH v1 1/5] drm/mediatek: mtk_dpi: Use switch in mtk_dpi_config_color_format() AngeloGioacchino Del Regno
@ 2025-04-22  3:30   ` CK Hu (胡俊光)
  0 siblings, 0 replies; 14+ messages in thread
From: CK Hu (胡俊光) @ 2025-04-22  3:30 UTC (permalink / raw)
  To: AngeloGioacchino Del Regno, chunkuang.hu@kernel.org
  Cc: Lewis Liao (廖柏鈞),
	Jason-JH Lin (林睿祥),
	Ives Chenjh (陳俊弘), simona@ffwll.ch,
	TommyYL Chen (陳彥良),
	dri-devel@lists.freedesktop.org, airlied@gmail.com,
	linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org, p.zabel@pengutronix.de,
	matthias.bgg@gmail.com, linux-mediatek@lists.infradead.org,
	kernel@collabora.com

On Wed, 2025-04-09 at 15:13 +0200, AngeloGioacchino Del Regno wrote:
> External email : Please do not click links or open attachments until you have verified the sender or the content.
> 
> 
> In preparation for adding support for an additional color format,
> convert the format conditional in mtk_dpi_config_color_format()
> to a switch.
> This also makes the concept of RGB being the default color format
> a little more human readable.
> 
> This commit brings no functional differences.

Reviewed-by: CK Hu <ck.hu@mediatek.com>

> 
> Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
> ---
>  drivers/gpu/drm/mediatek/mtk_dpi.c | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/mediatek/mtk_dpi.c b/drivers/gpu/drm/mediatek/mtk_dpi.c
> index 0fd13e6dd3f1..d735398e97f8 100644
> --- a/drivers/gpu/drm/mediatek/mtk_dpi.c
> +++ b/drivers/gpu/drm/mediatek/mtk_dpi.c
> @@ -452,7 +452,8 @@ static void mtk_dpi_config_color_format(struct mtk_dpi *dpi,
>  {
>         mtk_dpi_config_channel_swap(dpi, MTK_DPI_OUT_CHANNEL_SWAP_RGB);
> 
> -       if (format == MTK_DPI_COLOR_FORMAT_YCBCR_422) {
> +       switch (format) {
> +       case MTK_DPI_COLOR_FORMAT_YCBCR_422:
>                 mtk_dpi_config_yuv422_enable(dpi, true);
>                 mtk_dpi_config_csc_enable(dpi, true);
> 
> @@ -463,11 +464,14 @@ static void mtk_dpi_config_color_format(struct mtk_dpi *dpi,
>                 mtk_dpi_mask(dpi, DPI_MATRIX_SET, dpi->mode.hdisplay <= 720 ?
>                              MATRIX_SEL_RGB_TO_BT601 : MATRIX_SEL_RGB_TO_JPEG,
>                              INT_MATRIX_SEL_MASK);
> -       } else {
> +               break;
> +       default:
> +       case MTK_DPI_COLOR_FORMAT_RGB:
>                 mtk_dpi_config_yuv422_enable(dpi, false);
>                 mtk_dpi_config_csc_enable(dpi, false);
>                 if (dpi->conf->swap_input_support)
>                         mtk_dpi_config_swap_input(dpi, false);
> +               break;
>         }
>  }
> 
> --
> 2.49.0
> 


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH v1 2/5] drm/mediatek: mtk_dpi: Add local helpers for bus format parameters
  2025-04-09 13:13 ` [PATCH v1 2/5] drm/mediatek: mtk_dpi: Add local helpers for bus format parameters AngeloGioacchino Del Regno
@ 2025-04-22  4:00   ` CK Hu (胡俊光)
  0 siblings, 0 replies; 14+ messages in thread
From: CK Hu (胡俊光) @ 2025-04-22  4:00 UTC (permalink / raw)
  To: AngeloGioacchino Del Regno, chunkuang.hu@kernel.org
  Cc: Lewis Liao (廖柏鈞),
	Jason-JH Lin (林睿祥),
	Ives Chenjh (陳俊弘), simona@ffwll.ch,
	TommyYL Chen (陳彥良),
	dri-devel@lists.freedesktop.org, airlied@gmail.com,
	linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org, p.zabel@pengutronix.de,
	matthias.bgg@gmail.com, linux-mediatek@lists.infradead.org,
	kernel@collabora.com

On Wed, 2025-04-09 at 15:13 +0200, AngeloGioacchino Del Regno wrote:
> External email : Please do not click links or open attachments until you have verified the sender or the content.
> 
> 
> In preparation for adding support for additional color formats,
> add local helpers to map media bus format parameters to this
> driver's bit_num, channel_swap and color_format.
> 
> This commit brings no functional changes.

Reviewed-by: CK Hu <ck.hu@mediatek.com>

> 
> Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
> ---
>  drivers/gpu/drm/mediatek/mtk_dpi.c | 46 ++++++++++++++++++++++++++----
>  1 file changed, 40 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/gpu/drm/mediatek/mtk_dpi.c b/drivers/gpu/drm/mediatek/mtk_dpi.c
> index d735398e97f8..5a66dfe3ad40 100644
> --- a/drivers/gpu/drm/mediatek/mtk_dpi.c
> +++ b/drivers/gpu/drm/mediatek/mtk_dpi.c
> @@ -738,6 +738,43 @@ static u32 *mtk_dpi_bridge_atomic_get_input_bus_fmts(struct drm_bridge *bridge,
>         return input_fmts;
>  }
> 
> +static unsigned int mtk_dpi_bus_fmt_bit_num(unsigned int out_bus_format)
> +{
> +       switch (out_bus_format) {
> +       default:
> +       case MEDIA_BUS_FMT_RGB888_1X24:
> +       case MEDIA_BUS_FMT_RGB888_2X12_LE:
> +       case MEDIA_BUS_FMT_RGB888_2X12_BE:
> +       case MEDIA_BUS_FMT_YUYV8_1X16:
> +               return MTK_DPI_OUT_BIT_NUM_8BITS;
> +       }
> +}
> +
> +static unsigned int mtk_dpi_bus_fmt_channel_swap(unsigned int out_bus_format)
> +{
> +       switch (out_bus_format) {
> +       default:
> +       case MEDIA_BUS_FMT_RGB888_1X24:
> +       case MEDIA_BUS_FMT_RGB888_2X12_LE:
> +       case MEDIA_BUS_FMT_RGB888_2X12_BE:
> +       case MEDIA_BUS_FMT_YUYV8_1X16:
> +               return MTK_DPI_OUT_CHANNEL_SWAP_RGB;
> +       }
> +}
> +
> +static unsigned int mtk_dpi_bus_fmt_color_format(unsigned int out_bus_format)
> +{
> +       switch (out_bus_format) {
> +       default:
> +       case MEDIA_BUS_FMT_RGB888_1X24:
> +       case MEDIA_BUS_FMT_RGB888_2X12_LE:
> +       case MEDIA_BUS_FMT_RGB888_2X12_BE:
> +               return MTK_DPI_COLOR_FORMAT_RGB;
> +       case MEDIA_BUS_FMT_YUYV8_1X16:
> +               return MTK_DPI_COLOR_FORMAT_YCBCR_422;
> +       }
> +}
> +
>  static int mtk_dpi_bridge_atomic_check(struct drm_bridge *bridge,
>                                        struct drm_bridge_state *bridge_state,
>                                        struct drm_crtc_state *crtc_state,
> @@ -757,13 +794,10 @@ static int mtk_dpi_bridge_atomic_check(struct drm_bridge *bridge,
>                 bridge_state->output_bus_cfg.format);
> 
>         dpi->output_fmt = out_bus_format;
> -       dpi->bit_num = MTK_DPI_OUT_BIT_NUM_8BITS;
> -       dpi->channel_swap = MTK_DPI_OUT_CHANNEL_SWAP_RGB;
> +       dpi->bit_num = mtk_dpi_bus_fmt_bit_num(out_bus_format);
> +       dpi->channel_swap = mtk_dpi_bus_fmt_channel_swap(out_bus_format);
>         dpi->yc_map = MTK_DPI_OUT_YC_MAP_RGB;
> -       if (out_bus_format == MEDIA_BUS_FMT_YUYV8_1X16)
> -               dpi->color_format = MTK_DPI_COLOR_FORMAT_YCBCR_422;
> -       else
> -               dpi->color_format = MTK_DPI_COLOR_FORMAT_RGB;
> +       dpi->color_format = mtk_dpi_bus_fmt_color_format(out_bus_format);
> 
>         return 0;
>  }
> --
> 2.49.0
> 


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH v1 3/5] drm/mediatek: mtk_dpi: Add support for additional output formats
  2025-04-09 13:13 ` [PATCH v1 3/5] drm/mediatek: mtk_dpi: Add support for additional output formats AngeloGioacchino Del Regno
@ 2025-04-22  5:50   ` CK Hu (胡俊光)
  0 siblings, 0 replies; 14+ messages in thread
From: CK Hu (胡俊光) @ 2025-04-22  5:50 UTC (permalink / raw)
  To: AngeloGioacchino Del Regno, chunkuang.hu@kernel.org
  Cc: Lewis Liao (廖柏鈞),
	Jason-JH Lin (林睿祥),
	Ives Chenjh (陳俊弘), simona@ffwll.ch,
	TommyYL Chen (陳彥良),
	dri-devel@lists.freedesktop.org, airlied@gmail.com,
	linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org, p.zabel@pengutronix.de,
	matthias.bgg@gmail.com, linux-mediatek@lists.infradead.org,
	kernel@collabora.com

Hi, Angelo:

On Wed, 2025-04-09 at 15:13 +0200, AngeloGioacchino Del Regno wrote:
> External email : Please do not click links or open attachments until you have verified the sender or the content.
> 
> 
> Add support for configuring the Display Parallel Interface block
> to output YUV444 8/10 bits, YUV422 10/12 bits (8 bits support is
> already present), BGR 8-bits, and RGB 10-bits.
> 
> The enablement of the various additional output formats in SoCs
> platform data will be done in a different change.

Reviewed-by: CK Hu <ck.hu@mediatek.com>

> 
> Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
> ---
>  drivers/gpu/drm/mediatek/mtk_dpi.c | 33 ++++++++++++++++++++++++++++--
>  1 file changed, 31 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/mediatek/mtk_dpi.c b/drivers/gpu/drm/mediatek/mtk_dpi.c
> index 5a66dfe3ad40..a9e8113a1618 100644
> --- a/drivers/gpu/drm/mediatek/mtk_dpi.c
> +++ b/drivers/gpu/drm/mediatek/mtk_dpi.c
> @@ -59,7 +59,8 @@ enum mtk_dpi_out_channel_swap {
> 
>  enum mtk_dpi_out_color_format {
>         MTK_DPI_COLOR_FORMAT_RGB,
> -       MTK_DPI_COLOR_FORMAT_YCBCR_422
> +       MTK_DPI_COLOR_FORMAT_YCBCR_422,
> +       MTK_DPI_COLOR_FORMAT_YCBCR_444
>  };
> 
>  struct mtk_dpi {
> @@ -450,9 +451,15 @@ static void mtk_dpi_config_disable_edge(struct mtk_dpi *dpi)
>  static void mtk_dpi_config_color_format(struct mtk_dpi *dpi,
>                                         enum mtk_dpi_out_color_format format)
>  {
> -       mtk_dpi_config_channel_swap(dpi, MTK_DPI_OUT_CHANNEL_SWAP_RGB);
> +       mtk_dpi_config_channel_swap(dpi, dpi->channel_swap);
> 
>         switch (format) {
> +       case MTK_DPI_COLOR_FORMAT_YCBCR_444:
> +               mtk_dpi_config_yuv422_enable(dpi, false);
> +               mtk_dpi_config_csc_enable(dpi, true);
> +               if (dpi->conf->swap_input_support)
> +                       mtk_dpi_config_swap_input(dpi, false);
> +               break;
>         case MTK_DPI_COLOR_FORMAT_YCBCR_422:
>                 mtk_dpi_config_yuv422_enable(dpi, true);
>                 mtk_dpi_config_csc_enable(dpi, true);
> @@ -743,10 +750,18 @@ static unsigned int mtk_dpi_bus_fmt_bit_num(unsigned int out_bus_format)
>         switch (out_bus_format) {
>         default:
>         case MEDIA_BUS_FMT_RGB888_1X24:
> +       case MEDIA_BUS_FMT_BGR888_1X24:
>         case MEDIA_BUS_FMT_RGB888_2X12_LE:
>         case MEDIA_BUS_FMT_RGB888_2X12_BE:
>         case MEDIA_BUS_FMT_YUYV8_1X16:
> +       case MEDIA_BUS_FMT_YUV8_1X24:
>                 return MTK_DPI_OUT_BIT_NUM_8BITS;
> +       case MEDIA_BUS_FMT_RGB101010_1X30:
> +       case MEDIA_BUS_FMT_YUYV10_1X20:
> +       case MEDIA_BUS_FMT_YUV10_1X30:
> +               return MTK_DPI_OUT_BIT_NUM_10BITS;
> +       case MEDIA_BUS_FMT_YUYV12_1X24:
> +               return MTK_DPI_OUT_BIT_NUM_12BITS;
>         }
>  }
> 
> @@ -757,8 +772,15 @@ static unsigned int mtk_dpi_bus_fmt_channel_swap(unsigned int out_bus_format)
>         case MEDIA_BUS_FMT_RGB888_1X24:
>         case MEDIA_BUS_FMT_RGB888_2X12_LE:
>         case MEDIA_BUS_FMT_RGB888_2X12_BE:
> +       case MEDIA_BUS_FMT_RGB101010_1X30:
>         case MEDIA_BUS_FMT_YUYV8_1X16:
> +       case MEDIA_BUS_FMT_YUYV10_1X20:
> +       case MEDIA_BUS_FMT_YUYV12_1X24:
>                 return MTK_DPI_OUT_CHANNEL_SWAP_RGB;
> +       case MEDIA_BUS_FMT_BGR888_1X24:
> +       case MEDIA_BUS_FMT_YUV8_1X24:
> +       case MEDIA_BUS_FMT_YUV10_1X30:
> +               return MTK_DPI_OUT_CHANNEL_SWAP_BGR;
>         }
>  }
> 
> @@ -767,11 +789,18 @@ static unsigned int mtk_dpi_bus_fmt_color_format(unsigned int out_bus_format)
>         switch (out_bus_format) {
>         default:
>         case MEDIA_BUS_FMT_RGB888_1X24:
> +       case MEDIA_BUS_FMT_BGR888_1X24:
>         case MEDIA_BUS_FMT_RGB888_2X12_LE:
>         case MEDIA_BUS_FMT_RGB888_2X12_BE:
> +       case MEDIA_BUS_FMT_RGB101010_1X30:
>                 return MTK_DPI_COLOR_FORMAT_RGB;
>         case MEDIA_BUS_FMT_YUYV8_1X16:
> +       case MEDIA_BUS_FMT_YUYV10_1X20:
> +       case MEDIA_BUS_FMT_YUYV12_1X24:
>                 return MTK_DPI_COLOR_FORMAT_YCBCR_422;
> +       case MEDIA_BUS_FMT_YUV8_1X24:
> +       case MEDIA_BUS_FMT_YUV10_1X30:
> +               return MTK_DPI_COLOR_FORMAT_YCBCR_444;
>         }
>  }
> 
> --
> 2.49.0
> 


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH v1 4/5] drm/mediatek: mtk_dpi: Allow additional output formats on MT8195/88
  2025-04-09 13:13 ` [PATCH v1 4/5] drm/mediatek: mtk_dpi: Allow additional output formats on MT8195/88 AngeloGioacchino Del Regno
@ 2025-04-22  6:01   ` CK Hu (胡俊光)
  2025-04-22 13:42     ` AngeloGioacchino Del Regno
  0 siblings, 1 reply; 14+ messages in thread
From: CK Hu (胡俊光) @ 2025-04-22  6:01 UTC (permalink / raw)
  To: AngeloGioacchino Del Regno, chunkuang.hu@kernel.org
  Cc: Lewis Liao (廖柏鈞),
	Jason-JH Lin (林睿祥),
	Ives Chenjh (陳俊弘), simona@ffwll.ch,
	TommyYL Chen (陳彥良),
	dri-devel@lists.freedesktop.org, airlied@gmail.com,
	linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org, p.zabel@pengutronix.de,
	matthias.bgg@gmail.com, linux-mediatek@lists.infradead.org,
	kernel@collabora.com

Hi, Angelo:

On Wed, 2025-04-09 at 15:13 +0200, AngeloGioacchino Del Regno wrote:
> External email : Please do not click links or open attachments until you have verified the sender or the content.
> 
> 
> Allow additional output formats in both DPI and DP_INTF blocks of
> the MT8195 and MT8188 SoCs (as the latter is fully compatible with,
> hence reuses, the former's platform data for both blocks) by adding:
> 
> 1. New formats to the `mt8195_output_fmts` array for dp_intf,
>    lacking YUV422 12-bits support, and adding RGB888 2X12_LE/BE
>    (8-bits), BGR888 (8-bits) RGB101010 1x30 (10-bits), and YUV
>    formats, including YUV422 8/10 bits, and YUV444 8/10 bits; and
> 2. A new `mt8195_dpi_output_fmts` array for DPI only, with all of
>    for formats added to dp_intf and with the addition of the
>    YUYV12_1X24 (YUV422 12-bits) output format.
> 
> Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
> ---
>  drivers/gpu/drm/mediatek/mtk_dpi.c | 24 ++++++++++++++++++++++--
>  1 file changed, 22 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/mediatek/mtk_dpi.c b/drivers/gpu/drm/mediatek/mtk_dpi.c
> index a9e8113a1618..9de537a77493 100644
> --- a/drivers/gpu/drm/mediatek/mtk_dpi.c
> +++ b/drivers/gpu/drm/mediatek/mtk_dpi.c
> @@ -1093,9 +1093,29 @@ static const u32 mt8183_output_fmts[] = {
>         MEDIA_BUS_FMT_RGB888_2X12_BE,
>  };
> 
> +static const u32 mt8195_dpi_output_fmts[] = {
> +       MEDIA_BUS_FMT_RGB888_1X24,
> +       MEDIA_BUS_FMT_RGB888_2X12_LE,
> +       MEDIA_BUS_FMT_RGB888_2X12_BE,
> +       MEDIA_BUS_FMT_RGB101010_1X30,
> +       MEDIA_BUS_FMT_YUYV8_1X16,
> +       MEDIA_BUS_FMT_YUYV10_1X20,
> +       MEDIA_BUS_FMT_YUYV12_1X24,
> +       MEDIA_BUS_FMT_BGR888_1X24,

What's the order you follow?
I would like RGB together and YUV together.

Regards,
CK

> +       MEDIA_BUS_FMT_YUV8_1X24,
> +       MEDIA_BUS_FMT_YUV10_1X30,
> +};
> +
>  static const u32 mt8195_output_fmts[] = {
>         MEDIA_BUS_FMT_RGB888_1X24,
> +       MEDIA_BUS_FMT_RGB888_2X12_LE,
> +       MEDIA_BUS_FMT_RGB888_2X12_BE,
> +       MEDIA_BUS_FMT_RGB101010_1X30,
>         MEDIA_BUS_FMT_YUYV8_1X16,
> +       MEDIA_BUS_FMT_YUYV10_1X20,
> +       MEDIA_BUS_FMT_BGR888_1X24,
> +       MEDIA_BUS_FMT_YUV8_1X24,
> +       MEDIA_BUS_FMT_YUV10_1X30,
>  };
> 
>  static const struct mtk_dpi_factor dpi_factor_mt2701[] = {
> @@ -1208,8 +1228,8 @@ static const struct mtk_dpi_conf mt8192_conf = {
> 
>  static const struct mtk_dpi_conf mt8195_conf = {
>         .max_clock_khz = 594000,
> -       .output_fmts = mt8183_output_fmts,
> -       .num_output_fmts = ARRAY_SIZE(mt8183_output_fmts),
> +       .output_fmts = mt8195_dpi_output_fmts,
> +       .num_output_fmts = ARRAY_SIZE(mt8195_dpi_output_fmts),
>         .pixels_per_iter = 1,
>         .is_ck_de_pol = true,
>         .swap_input_support = true,
> --
> 2.49.0
> 


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH v1 5/5] drm/mediatek: mtk_dpi: Rename output fmts array for MT8195 DP_INTF
  2025-04-09 13:13 ` [PATCH v1 5/5] drm/mediatek: mtk_dpi: Rename output fmts array for MT8195 DP_INTF AngeloGioacchino Del Regno
@ 2025-04-22  6:04   ` CK Hu (胡俊光)
  0 siblings, 0 replies; 14+ messages in thread
From: CK Hu (胡俊光) @ 2025-04-22  6:04 UTC (permalink / raw)
  To: AngeloGioacchino Del Regno, chunkuang.hu@kernel.org
  Cc: Lewis Liao (廖柏鈞),
	Jason-JH Lin (林睿祥),
	Ives Chenjh (陳俊弘), simona@ffwll.ch,
	TommyYL Chen (陳彥良),
	dri-devel@lists.freedesktop.org, airlied@gmail.com,
	linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org, p.zabel@pengutronix.de,
	matthias.bgg@gmail.com, linux-mediatek@lists.infradead.org,
	kernel@collabora.com

On Wed, 2025-04-09 at 15:13 +0200, AngeloGioacchino Del Regno wrote:
> External email : Please do not click links or open attachments until you have verified the sender or the content.
> 
> 
> For the sake of increasing human readability and avoid possible
> confusion between DPI and DP_INTF output formats (as the two are
> ever so slightly different), rename the mt8195_output_fmts array
> to mt8195_dp_intf_output_fmts.
> 
> This commit brings no functional changes.

Reviewed-by: CK Hu <ck.hu@mediatek.com>

> 
> Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
> ---
>  drivers/gpu/drm/mediatek/mtk_dpi.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/gpu/drm/mediatek/mtk_dpi.c b/drivers/gpu/drm/mediatek/mtk_dpi.c
> index 9de537a77493..0b7f91fb519f 100644
> --- a/drivers/gpu/drm/mediatek/mtk_dpi.c
> +++ b/drivers/gpu/drm/mediatek/mtk_dpi.c
> @@ -1106,7 +1106,7 @@ static const u32 mt8195_dpi_output_fmts[] = {
>         MEDIA_BUS_FMT_YUV10_1X30,
>  };
> 
> -static const u32 mt8195_output_fmts[] = {
> +static const u32 mt8195_dp_intf_output_fmts[] = {
>         MEDIA_BUS_FMT_RGB888_1X24,
>         MEDIA_BUS_FMT_RGB888_2X12_LE,
>         MEDIA_BUS_FMT_RGB888_2X12_BE,
> @@ -1248,8 +1248,8 @@ static const struct mtk_dpi_conf mt8195_dpintf_conf = {
>         .dpi_factor = dpi_factor_mt8195_dp_intf,
>         .num_dpi_factor = ARRAY_SIZE(dpi_factor_mt8195_dp_intf),
>         .max_clock_khz = 600000,
> -       .output_fmts = mt8195_output_fmts,
> -       .num_output_fmts = ARRAY_SIZE(mt8195_output_fmts),
> +       .output_fmts = mt8195_dp_intf_output_fmts,
> +       .num_output_fmts = ARRAY_SIZE(mt8195_dp_intf_output_fmts),
>         .pixels_per_iter = 4,
>         .dimension_mask = DPINTF_HPW_MASK,
>         .hvsize_mask = DPINTF_HSIZE_MASK,
> --
> 2.49.0
> 


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH v1 4/5] drm/mediatek: mtk_dpi: Allow additional output formats on MT8195/88
  2025-04-22  6:01   ` CK Hu (胡俊光)
@ 2025-04-22 13:42     ` AngeloGioacchino Del Regno
  2025-04-23  3:45       ` CK Hu (胡俊光)
  0 siblings, 1 reply; 14+ messages in thread
From: AngeloGioacchino Del Regno @ 2025-04-22 13:42 UTC (permalink / raw)
  To: CK Hu (胡俊光), chunkuang.hu@kernel.org
  Cc: Lewis Liao (廖柏鈞),
	Jason-JH Lin (林睿祥),
	Ives Chenjh (陳俊弘), simona@ffwll.ch,
	TommyYL Chen (陳彥良),
	dri-devel@lists.freedesktop.org, airlied@gmail.com,
	linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org, p.zabel@pengutronix.de,
	matthias.bgg@gmail.com, linux-mediatek@lists.infradead.org,
	kernel@collabora.com

Il 22/04/25 08:01, CK Hu (胡俊光) ha scritto:
> Hi, Angelo:
> 
> On Wed, 2025-04-09 at 15:13 +0200, AngeloGioacchino Del Regno wrote:
>> External email : Please do not click links or open attachments until you have verified the sender or the content.
>>
>>
>> Allow additional output formats in both DPI and DP_INTF blocks of
>> the MT8195 and MT8188 SoCs (as the latter is fully compatible with,
>> hence reuses, the former's platform data for both blocks) by adding:
>>
>> 1. New formats to the `mt8195_output_fmts` array for dp_intf,
>>     lacking YUV422 12-bits support, and adding RGB888 2X12_LE/BE
>>     (8-bits), BGR888 (8-bits) RGB101010 1x30 (10-bits), and YUV
>>     formats, including YUV422 8/10 bits, and YUV444 8/10 bits; and
>> 2. A new `mt8195_dpi_output_fmts` array for DPI only, with all of
>>     for formats added to dp_intf and with the addition of the
>>     YUYV12_1X24 (YUV422 12-bits) output format.
>>
>> Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
>> ---
>>   drivers/gpu/drm/mediatek/mtk_dpi.c | 24 ++++++++++++++++++++++--
>>   1 file changed, 22 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/mediatek/mtk_dpi.c b/drivers/gpu/drm/mediatek/mtk_dpi.c
>> index a9e8113a1618..9de537a77493 100644
>> --- a/drivers/gpu/drm/mediatek/mtk_dpi.c
>> +++ b/drivers/gpu/drm/mediatek/mtk_dpi.c
>> @@ -1093,9 +1093,29 @@ static const u32 mt8183_output_fmts[] = {
>>          MEDIA_BUS_FMT_RGB888_2X12_BE,
>>   };
>>
>> +static const u32 mt8195_dpi_output_fmts[] = {
>> +       MEDIA_BUS_FMT_RGB888_1X24,
>> +       MEDIA_BUS_FMT_RGB888_2X12_LE,
>> +       MEDIA_BUS_FMT_RGB888_2X12_BE,
>> +       MEDIA_BUS_FMT_RGB101010_1X30,
>> +       MEDIA_BUS_FMT_YUYV8_1X16,
>> +       MEDIA_BUS_FMT_YUYV10_1X20,
>> +       MEDIA_BUS_FMT_YUYV12_1X24,
>> +       MEDIA_BUS_FMT_BGR888_1X24,
> 
> What's the order you follow?
> I would like RGB together and YUV together.
> 

Actually, BGR888_1X24 should come before RGB888_1X24 now that you make me notice..!

Those are ordered by preference (and the order won't be respected in the actual
code anyway).... as in:
- For RGB 8-bits, RGB888_1X24 is the one that should be preferred
- For RGB 10 bits there's only one so ...
- For yuv modes - YUYV is preferred to YUV
   - there's only one for each, so in that case it's alphabetical
     meaning that yuyv8 comes before yuyv10

If you want, you can reorder them as you wish anyway - there's no strong reason
against any kind of ordering.

Besides, if you can change to the order that you prefer while applying this commit
that's great - otherwise just tell me what order you precisely want and I'll send
a v2 for the entire series :-)

Cheers,
Angelo

> Regards,
> CK
> 
>> +       MEDIA_BUS_FMT_YUV8_1X24,
>> +       MEDIA_BUS_FMT_YUV10_1X30,
>> +};
>> +
>>   static const u32 mt8195_output_fmts[] = {
>>          MEDIA_BUS_FMT_RGB888_1X24,
>> +       MEDIA_BUS_FMT_RGB888_2X12_LE,
>> +       MEDIA_BUS_FMT_RGB888_2X12_BE,
>> +       MEDIA_BUS_FMT_RGB101010_1X30,
>>          MEDIA_BUS_FMT_YUYV8_1X16,
>> +       MEDIA_BUS_FMT_YUYV10_1X20,
>> +       MEDIA_BUS_FMT_BGR888_1X24,
>> +       MEDIA_BUS_FMT_YUV8_1X24,
>> +       MEDIA_BUS_FMT_YUV10_1X30,
>>   };
>>
>>   static const struct mtk_dpi_factor dpi_factor_mt2701[] = {
>> @@ -1208,8 +1228,8 @@ static const struct mtk_dpi_conf mt8192_conf = {
>>
>>   static const struct mtk_dpi_conf mt8195_conf = {
>>          .max_clock_khz = 594000,
>> -       .output_fmts = mt8183_output_fmts,
>> -       .num_output_fmts = ARRAY_SIZE(mt8183_output_fmts),
>> +       .output_fmts = mt8195_dpi_output_fmts,
>> +       .num_output_fmts = ARRAY_SIZE(mt8195_dpi_output_fmts),
>>          .pixels_per_iter = 1,
>>          .is_ck_de_pol = true,
>>          .swap_input_support = true,
>> --
>> 2.49.0
>>
> 



^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH v1 4/5] drm/mediatek: mtk_dpi: Allow additional output formats on MT8195/88
  2025-04-22 13:42     ` AngeloGioacchino Del Regno
@ 2025-04-23  3:45       ` CK Hu (胡俊光)
  0 siblings, 0 replies; 14+ messages in thread
From: CK Hu (胡俊光) @ 2025-04-23  3:45 UTC (permalink / raw)
  To: AngeloGioacchino Del Regno, chunkuang.hu@kernel.org
  Cc: Lewis Liao (廖柏鈞),
	Ives Chenjh (陳俊弘),
	TommyYL Chen (陳彥良), simona@ffwll.ch,
	dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org,
	Jason-JH Lin (林睿祥),
	linux-arm-kernel@lists.infradead.org, airlied@gmail.com,
	p.zabel@pengutronix.de, matthias.bgg@gmail.com,
	kernel@collabora.com, linux-mediatek@lists.infradead.org

On Tue, 2025-04-22 at 15:42 +0200, AngeloGioacchino Del Regno wrote:
> External email : Please do not click links or open attachments until you have verified the sender or the content.
> 
> 
> Il 22/04/25 08:01, CK Hu (胡俊光) ha scritto:
> > Hi, Angelo:
> > 
> > On Wed, 2025-04-09 at 15:13 +0200, AngeloGioacchino Del Regno wrote:
> > > External email : Please do not click links or open attachments until you have verified the sender or the content.
> > > 
> > > 
> > > Allow additional output formats in both DPI and DP_INTF blocks of
> > > the MT8195 and MT8188 SoCs (as the latter is fully compatible with,
> > > hence reuses, the former's platform data for both blocks) by adding:
> > > 
> > > 1. New formats to the `mt8195_output_fmts` array for dp_intf,
> > >     lacking YUV422 12-bits support, and adding RGB888 2X12_LE/BE
> > >     (8-bits), BGR888 (8-bits) RGB101010 1x30 (10-bits), and YUV
> > >     formats, including YUV422 8/10 bits, and YUV444 8/10 bits; and
> > > 2. A new `mt8195_dpi_output_fmts` array for DPI only, with all of
> > >     for formats added to dp_intf and with the addition of the
> > >     YUYV12_1X24 (YUV422 12-bits) output format.
> > > 
> > > Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
> > > ---
> > >   drivers/gpu/drm/mediatek/mtk_dpi.c | 24 ++++++++++++++++++++++--
> > >   1 file changed, 22 insertions(+), 2 deletions(-)
> > > 
> > > diff --git a/drivers/gpu/drm/mediatek/mtk_dpi.c b/drivers/gpu/drm/mediatek/mtk_dpi.c
> > > index a9e8113a1618..9de537a77493 100644
> > > --- a/drivers/gpu/drm/mediatek/mtk_dpi.c
> > > +++ b/drivers/gpu/drm/mediatek/mtk_dpi.c
> > > @@ -1093,9 +1093,29 @@ static const u32 mt8183_output_fmts[] = {
> > >          MEDIA_BUS_FMT_RGB888_2X12_BE,
> > >   };
> > > 
> > > +static const u32 mt8195_dpi_output_fmts[] = {
> > > +       MEDIA_BUS_FMT_RGB888_1X24,
> > > +       MEDIA_BUS_FMT_RGB888_2X12_LE,
> > > +       MEDIA_BUS_FMT_RGB888_2X12_BE,
> > > +       MEDIA_BUS_FMT_RGB101010_1X30,
> > > +       MEDIA_BUS_FMT_YUYV8_1X16,
> > > +       MEDIA_BUS_FMT_YUYV10_1X20,
> > > +       MEDIA_BUS_FMT_YUYV12_1X24,
> > > +       MEDIA_BUS_FMT_BGR888_1X24,
> > 
> > What's the order you follow?
> > I would like RGB together and YUV together.
> > 
> 
> Actually, BGR888_1X24 should come before RGB888_1X24 now that you make me notice..!

I will change as this when I apply this patch.

Regards,
CK

> 
> Those are ordered by preference (and the order won't be respected in the actual
> code anyway).... as in:
> - For RGB 8-bits, RGB888_1X24 is the one that should be preferred
> - For RGB 10 bits there's only one so ...
> - For yuv modes - YUYV is preferred to YUV
>    - there's only one for each, so in that case it's alphabetical
>      meaning that yuyv8 comes before yuyv10
> 
> If you want, you can reorder them as you wish anyway - there's no strong reason
> against any kind of ordering.
> 
> Besides, if you can change to the order that you prefer while applying this commit
> that's great - otherwise just tell me what order you precisely want and I'll send
> a v2 for the entire series :-)
> 
> Cheers,
> Angelo
> 
> > Regards,
> > CK
> > 
> > > +       MEDIA_BUS_FMT_YUV8_1X24,
> > > +       MEDIA_BUS_FMT_YUV10_1X30,
> > > +};
> > > +
> > >   static const u32 mt8195_output_fmts[] = {
> > >          MEDIA_BUS_FMT_RGB888_1X24,
> > > +       MEDIA_BUS_FMT_RGB888_2X12_LE,
> > > +       MEDIA_BUS_FMT_RGB888_2X12_BE,
> > > +       MEDIA_BUS_FMT_RGB101010_1X30,
> > >          MEDIA_BUS_FMT_YUYV8_1X16,
> > > +       MEDIA_BUS_FMT_YUYV10_1X20,
> > > +       MEDIA_BUS_FMT_BGR888_1X24,
> > > +       MEDIA_BUS_FMT_YUV8_1X24,
> > > +       MEDIA_BUS_FMT_YUV10_1X30,
> > >   };
> > > 
> > >   static const struct mtk_dpi_factor dpi_factor_mt2701[] = {
> > > @@ -1208,8 +1228,8 @@ static const struct mtk_dpi_conf mt8192_conf = {
> > > 
> > >   static const struct mtk_dpi_conf mt8195_conf = {
> > >          .max_clock_khz = 594000,
> > > -       .output_fmts = mt8183_output_fmts,
> > > -       .num_output_fmts = ARRAY_SIZE(mt8183_output_fmts),
> > > +       .output_fmts = mt8195_dpi_output_fmts,
> > > +       .num_output_fmts = ARRAY_SIZE(mt8195_dpi_output_fmts),
> > >          .pixels_per_iter = 1,
> > >          .is_ck_de_pol = true,
> > >          .swap_input_support = true,
> > > --
> > > 2.49.0
> > > 
> > 
> 


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH v1 0/5] MediaTek DPI: Cleanups and add support for more formats
  2025-04-09 13:13 [PATCH v1 0/5] MediaTek DPI: Cleanups and add support for more formats AngeloGioacchino Del Regno
                   ` (4 preceding siblings ...)
  2025-04-09 13:13 ` [PATCH v1 5/5] drm/mediatek: mtk_dpi: Rename output fmts array for MT8195 DP_INTF AngeloGioacchino Del Regno
@ 2025-04-27  1:47 ` Chun-Kuang Hu
  5 siblings, 0 replies; 14+ messages in thread
From: Chun-Kuang Hu @ 2025-04-27  1:47 UTC (permalink / raw)
  To: AngeloGioacchino Del Regno
  Cc: chunkuang.hu, p.zabel, airlied, simona, matthias.bgg, dri-devel,
	linux-mediatek, linux-kernel, linux-arm-kernel, kernel,
	lewis.liao, ives.chenjh, tommyyl.chen, jason-jh.lin

Hi, Angelo:

AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com> 於
2025年4月9日 週三 下午9:13寫道:
>
> This series adds support to configure the MediaTek DPI IP to output
> more formats, such as YUV422 8/10/12 bits, YUV444 8/10 bits, BGR 8bits,
> and RGB 10 bits, and also performs some cleanups that improve the code
> readability when those are added.
>
> Even though some of those formats are also supported by MT8173, MT8183,
> MT8186 and MT8192, I am enabling them only for MT8195/MT8188 as those
> are the only two that I was able to test.

The whole series is applied to mediatek-drm-next [1], thanks.

[1] https://git.kernel.org/pub/scm/linux/kernel/git/chunkuang.hu/linux.git/log/?h=mediatek-drm-next

Regards,
Chun-Kuang.

>
> This was tested on:
>  - MT8195 Tomato Chromebook
>  - MT8395 Radxa NIO-12L
>  - MT8390 MediaTek Genio 700 EVK
>
> AngeloGioacchino Del Regno (5):
>   drm/mediatek: mtk_dpi: Use switch in mtk_dpi_config_color_format()
>   drm/mediatek: mtk_dpi: Add local helpers for bus format parameters
>   drm/mediatek: mtk_dpi: Add support for additional output formats
>   drm/mediatek: mtk_dpi: Allow additional output formats on MT8195/88
>   drm/mediatek: mtk_dpi: Rename output fmts array for MT8195 DP_INTF
>
>  drivers/gpu/drm/mediatek/mtk_dpi.c | 117 +++++++++++++++++++++++++----
>  1 file changed, 102 insertions(+), 15 deletions(-)
>
> --
> 2.49.0
>


^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2025-04-27  1:48 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-09 13:13 [PATCH v1 0/5] MediaTek DPI: Cleanups and add support for more formats AngeloGioacchino Del Regno
2025-04-09 13:13 ` [PATCH v1 1/5] drm/mediatek: mtk_dpi: Use switch in mtk_dpi_config_color_format() AngeloGioacchino Del Regno
2025-04-22  3:30   ` CK Hu (胡俊光)
2025-04-09 13:13 ` [PATCH v1 2/5] drm/mediatek: mtk_dpi: Add local helpers for bus format parameters AngeloGioacchino Del Regno
2025-04-22  4:00   ` CK Hu (胡俊光)
2025-04-09 13:13 ` [PATCH v1 3/5] drm/mediatek: mtk_dpi: Add support for additional output formats AngeloGioacchino Del Regno
2025-04-22  5:50   ` CK Hu (胡俊光)
2025-04-09 13:13 ` [PATCH v1 4/5] drm/mediatek: mtk_dpi: Allow additional output formats on MT8195/88 AngeloGioacchino Del Regno
2025-04-22  6:01   ` CK Hu (胡俊光)
2025-04-22 13:42     ` AngeloGioacchino Del Regno
2025-04-23  3:45       ` CK Hu (胡俊光)
2025-04-09 13:13 ` [PATCH v1 5/5] drm/mediatek: mtk_dpi: Rename output fmts array for MT8195 DP_INTF AngeloGioacchino Del Regno
2025-04-22  6:04   ` CK Hu (胡俊光)
2025-04-27  1:47 ` [PATCH v1 0/5] MediaTek DPI: Cleanups and add support for more formats Chun-Kuang Hu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).