linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v4 0/5] Support alpha blending in MTK display driver
@ 2024-07-17  5:24 Hsiao Chien Sung via B4 Relay
  2024-07-17  5:24 ` [PATCH v4 1/5] drm/mediatek: Support "None" blending in OVL Hsiao Chien Sung via B4 Relay
                   ` (5 more replies)
  0 siblings, 6 replies; 20+ messages in thread
From: Hsiao Chien Sung via B4 Relay @ 2024-07-17  5:24 UTC (permalink / raw)
  To: Chun-Kuang Hu, Philipp Zabel, David Airlie, Daniel Vetter,
	Matthias Brugger, AngeloGioacchino Del Regno
  Cc: dri-devel, linux-mediatek, linux-kernel, linux-arm-kernel,
	Hsiao Chien Sung, CK Hu, Hsiao Chien Sung

Support "Pre-multiplied" and "None" blend mode on MediaTek's chips by
adding correct blend mode property when the planes init.
Before this patch, only the "Coverage" mode (default) is supported.

Signed-off-by: Hsiao Chien Sung <shawn.sung@mediatek.corp-partner.google.com>
---
Changes in v4:
- Add more information to the commit message
- Link to v3: https://lore.kernel.org/r/20240710-alpha-blending-v3-0-289c187f9c6f@mediatek.com

Changes in v3:
- Remove the Change-Id
- Link to v2: https://lore.kernel.org/r/20240710-alpha-blending-v2-0-d4b505e6980a@mediatek.com

Changes in v2:
- Remove unnecessary codes
- Add more information to the commit message
- Link to v1: https://lore.kernel.org/r/20240620-blend-v1-0-72670072ca20@mediatek.com

---
Hsiao Chien Sung (5):
      drm/mediatek: Support "None" blending in OVL
      drm/mediatek: Support "None" blending in Mixer
      drm/mediatek: Support "Pre-multiplied" blending in OVL
      drm/mediatek: Support "Pre-multiplied" blending in Mixer
      drm/mediatek: Support alpha blending in display driver

 drivers/gpu/drm/mediatek/mtk_disp_ovl.c | 36 +++++++++++++++++++++++++--------
 drivers/gpu/drm/mediatek/mtk_ethdr.c    | 13 +++++++++---
 drivers/gpu/drm/mediatek/mtk_plane.c    | 11 ++++++++++
 3 files changed, 49 insertions(+), 11 deletions(-)
---
base-commit: 8ad49a92cff4bab13eb2f2725243f5f31eff3f3b
change-id: 20240710-alpha-blending-067295570863

Best regards,
-- 
Hsiao Chien Sung <shawn.sung@mediatek.com>




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

* [PATCH v4 1/5] drm/mediatek: Support "None" blending in OVL
  2024-07-17  5:24 [PATCH v4 0/5] Support alpha blending in MTK display driver Hsiao Chien Sung via B4 Relay
@ 2024-07-17  5:24 ` Hsiao Chien Sung via B4 Relay
  2024-07-17 13:49   ` AngeloGioacchino Del Regno
  2024-07-17  5:24 ` [PATCH v4 2/5] drm/mediatek: Support "None" blending in Mixer Hsiao Chien Sung via B4 Relay
                   ` (4 subsequent siblings)
  5 siblings, 1 reply; 20+ messages in thread
From: Hsiao Chien Sung via B4 Relay @ 2024-07-17  5:24 UTC (permalink / raw)
  To: Chun-Kuang Hu, Philipp Zabel, David Airlie, Daniel Vetter,
	Matthias Brugger, AngeloGioacchino Del Regno
  Cc: dri-devel, linux-mediatek, linux-kernel, linux-arm-kernel,
	Hsiao Chien Sung, CK Hu, Hsiao Chien Sung

From: Hsiao Chien Sung <shawn.sung@mediatek.com>

Support "None" alpha blending mode on MediaTek's chips.

Reviewed-by: CK Hu <ck.hu@mediatek.com>
Signed-off-by: Hsiao Chien Sung <shawn.sung@mediatek.com>
---
 drivers/gpu/drm/mediatek/mtk_disp_ovl.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/mediatek/mtk_disp_ovl.c b/drivers/gpu/drm/mediatek/mtk_disp_ovl.c
index 9d6d9fd8342e..add671c38613 100644
--- a/drivers/gpu/drm/mediatek/mtk_disp_ovl.c
+++ b/drivers/gpu/drm/mediatek/mtk_disp_ovl.c
@@ -434,6 +434,7 @@ void mtk_ovl_layer_config(struct device *dev, unsigned int idx,
 	unsigned int fmt = pending->format;
 	unsigned int offset = (pending->y << 16) | pending->x;
 	unsigned int src_size = (pending->height << 16) | pending->width;
+	unsigned int blend_mode = state->base.pixel_blend_mode;
 	unsigned int ignore_pixel_alpha = 0;
 	unsigned int con;
 	bool is_afbc = pending->modifier != DRM_FORMAT_MOD_LINEAR;
@@ -463,7 +464,8 @@ void mtk_ovl_layer_config(struct device *dev, unsigned int idx,
 	 * For RGB888 related formats, whether CONST_BLD is enabled or not won't
 	 * affect the result. Therefore we use !has_alpha as the condition.
 	 */
-	if (state->base.fb && !state->base.fb->format->has_alpha)
+	if ((state->base.fb && !state->base.fb->format->has_alpha) ||
+	    blend_mode == DRM_MODE_BLEND_PIXEL_NONE)
 		ignore_pixel_alpha = OVL_CONST_BLEND;
 
 	if (pending->rotation & DRM_MODE_REFLECT_Y) {

-- 
2.43.0




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

* [PATCH v4 2/5] drm/mediatek: Support "None" blending in Mixer
  2024-07-17  5:24 [PATCH v4 0/5] Support alpha blending in MTK display driver Hsiao Chien Sung via B4 Relay
  2024-07-17  5:24 ` [PATCH v4 1/5] drm/mediatek: Support "None" blending in OVL Hsiao Chien Sung via B4 Relay
@ 2024-07-17  5:24 ` Hsiao Chien Sung via B4 Relay
  2024-07-17  5:58   ` CK Hu (胡俊光)
  2024-07-17  5:24 ` [PATCH v4 3/5] drm/mediatek: Support "Pre-multiplied" blending in OVL Hsiao Chien Sung via B4 Relay
                   ` (3 subsequent siblings)
  5 siblings, 1 reply; 20+ messages in thread
From: Hsiao Chien Sung via B4 Relay @ 2024-07-17  5:24 UTC (permalink / raw)
  To: Chun-Kuang Hu, Philipp Zabel, David Airlie, Daniel Vetter,
	Matthias Brugger, AngeloGioacchino Del Regno
  Cc: dri-devel, linux-mediatek, linux-kernel, linux-arm-kernel,
	Hsiao Chien Sung, Hsiao Chien Sung

From: Hsiao Chien Sung <shawn.sung@mediatek.com>

Support "None" alpha blending mode on MediaTek's chips.

Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Signed-off-by: Hsiao Chien Sung <shawn.sung@mediatek.com>
---
 drivers/gpu/drm/mediatek/mtk_ethdr.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/mediatek/mtk_ethdr.c b/drivers/gpu/drm/mediatek/mtk_ethdr.c
index 9dfd13d32dfa..80ccdad3741b 100644
--- a/drivers/gpu/drm/mediatek/mtk_ethdr.c
+++ b/drivers/gpu/drm/mediatek/mtk_ethdr.c
@@ -3,6 +3,7 @@
  * Copyright (c) 2021 MediaTek Inc.
  */
 
+#include <drm/drm_blend.h>
 #include <drm/drm_fourcc.h>
 #include <drm/drm_framebuffer.h>
 #include <linux/clk.h>
@@ -175,7 +176,8 @@ void mtk_ethdr_layer_config(struct device *dev, unsigned int idx,
 		alpha_con |= state->base.alpha & MIXER_ALPHA;
 	}
 
-	if (state->base.fb && !state->base.fb->format->has_alpha) {
+	if ((state->base.fb && !state->base.fb->format->has_alpha) ||
+	    state->base.pixel_blend_mode == DRM_MODE_BLEND_PIXEL_NONE) {
 		/*
 		 * Mixer doesn't support CONST_BLD mode,
 		 * use a trick to make the output equivalent

-- 
2.43.0




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

* [PATCH v4 3/5] drm/mediatek: Support "Pre-multiplied" blending in OVL
  2024-07-17  5:24 [PATCH v4 0/5] Support alpha blending in MTK display driver Hsiao Chien Sung via B4 Relay
  2024-07-17  5:24 ` [PATCH v4 1/5] drm/mediatek: Support "None" blending in OVL Hsiao Chien Sung via B4 Relay
  2024-07-17  5:24 ` [PATCH v4 2/5] drm/mediatek: Support "None" blending in Mixer Hsiao Chien Sung via B4 Relay
@ 2024-07-17  5:24 ` Hsiao Chien Sung via B4 Relay
  2024-07-17 13:49   ` AngeloGioacchino Del Regno
  2024-07-17  5:24 ` [PATCH v4 4/5] drm/mediatek: Support "Pre-multiplied" blending in Mixer Hsiao Chien Sung via B4 Relay
                   ` (2 subsequent siblings)
  5 siblings, 1 reply; 20+ messages in thread
From: Hsiao Chien Sung via B4 Relay @ 2024-07-17  5:24 UTC (permalink / raw)
  To: Chun-Kuang Hu, Philipp Zabel, David Airlie, Daniel Vetter,
	Matthias Brugger, AngeloGioacchino Del Regno
  Cc: dri-devel, linux-mediatek, linux-kernel, linux-arm-kernel,
	Hsiao Chien Sung, CK Hu, Hsiao Chien Sung

From: Hsiao Chien Sung <shawn.sung@mediatek.com>

Support "Pre-multiplied" alpha blending mode on in OVL.
Before this patch, only the "coverage" mode is supported.

As whether OVL_CON_CLRFMT_MAN bit is enabled, (3 << 12)
means different formats in the datasheet. To prevent
misunderstandings going forward, instead of reusing
OVL_CON_CLRFMT_RGBA8888, we intetionally defined
OVL_CON_CLRFMT_PARGB8888 with bit operation again.

Reviewed-by: CK Hu <ck.hu@mediatek.com>
Signed-off-by: Hsiao Chien Sung <shawn.sung@mediatek.com>
---
 drivers/gpu/drm/mediatek/mtk_disp_ovl.c | 32 +++++++++++++++++++++++++-------
 1 file changed, 25 insertions(+), 7 deletions(-)

diff --git a/drivers/gpu/drm/mediatek/mtk_disp_ovl.c b/drivers/gpu/drm/mediatek/mtk_disp_ovl.c
index add671c38613..89b439dcf3a6 100644
--- a/drivers/gpu/drm/mediatek/mtk_disp_ovl.c
+++ b/drivers/gpu/drm/mediatek/mtk_disp_ovl.c
@@ -56,8 +56,12 @@
 #define GMC_THRESHOLD_HIGH	((1 << GMC_THRESHOLD_BITS) / 4)
 #define GMC_THRESHOLD_LOW	((1 << GMC_THRESHOLD_BITS) / 8)
 
+#define OVL_CON_CLRFMT_MAN	BIT(23)
 #define OVL_CON_BYTE_SWAP	BIT(24)
-#define OVL_CON_MTX_YUV_TO_RGB	(6 << 16)
+
+/* OVL_CON_RGB_SWAP works only if OVL_CON_CLRFMT_MAN is enabled */
+#define OVL_CON_RGB_SWAP	BIT(25)
+
 #define OVL_CON_CLRFMT_RGB	(1 << 12)
 #define OVL_CON_CLRFMT_ARGB8888	(2 << 12)
 #define OVL_CON_CLRFMT_RGBA8888	(3 << 12)
@@ -65,6 +69,11 @@
 #define OVL_CON_CLRFMT_BGRA8888	(OVL_CON_CLRFMT_ARGB8888 | OVL_CON_BYTE_SWAP)
 #define OVL_CON_CLRFMT_UYVY	(4 << 12)
 #define OVL_CON_CLRFMT_YUYV	(5 << 12)
+#define OVL_CON_MTX_YUV_TO_RGB	(6 << 16)
+#define OVL_CON_CLRFMT_PARGB8888 ((3 << 12) | OVL_CON_CLRFMT_MAN)
+#define OVL_CON_CLRFMT_PABGR8888 (OVL_CON_CLRFMT_PARGB8888 | OVL_CON_RGB_SWAP)
+#define OVL_CON_CLRFMT_PBGRA8888 (OVL_CON_CLRFMT_PARGB8888 | OVL_CON_BYTE_SWAP)
+#define OVL_CON_CLRFMT_PRGBA8888 (OVL_CON_CLRFMT_PABGR8888 | OVL_CON_BYTE_SWAP)
 #define OVL_CON_CLRFMT_RGB565(ovl)	((ovl)->data->fmt_rgb565_is_0 ? \
 					0 : OVL_CON_CLRFMT_RGB)
 #define OVL_CON_CLRFMT_RGB888(ovl)	((ovl)->data->fmt_rgb565_is_0 ? \
@@ -377,7 +386,8 @@ void mtk_ovl_layer_off(struct device *dev, unsigned int idx,
 		      DISP_REG_OVL_RDMA_CTRL(idx));
 }
 
-static unsigned int ovl_fmt_convert(struct mtk_disp_ovl *ovl, unsigned int fmt)
+static unsigned int ovl_fmt_convert(struct mtk_disp_ovl *ovl, unsigned int fmt,
+				    unsigned int blend_mode)
 {
 	/* The return value in switch "MEM_MODE_INPUT_FORMAT_XXX"
 	 * is defined in mediatek HW data sheet.
@@ -398,22 +408,30 @@ static unsigned int ovl_fmt_convert(struct mtk_disp_ovl *ovl, unsigned int fmt)
 	case DRM_FORMAT_RGBA8888:
 	case DRM_FORMAT_RGBX1010102:
 	case DRM_FORMAT_RGBA1010102:
-		return OVL_CON_CLRFMT_RGBA8888;
+		return blend_mode == DRM_MODE_BLEND_COVERAGE ?
+		       OVL_CON_CLRFMT_RGBA8888 :
+		       OVL_CON_CLRFMT_PRGBA8888;
 	case DRM_FORMAT_BGRX8888:
 	case DRM_FORMAT_BGRA8888:
 	case DRM_FORMAT_BGRX1010102:
 	case DRM_FORMAT_BGRA1010102:
-		return OVL_CON_CLRFMT_BGRA8888;
+		return blend_mode == DRM_MODE_BLEND_COVERAGE ?
+		       OVL_CON_CLRFMT_BGRA8888 :
+		       OVL_CON_CLRFMT_PBGRA8888;
 	case DRM_FORMAT_XRGB8888:
 	case DRM_FORMAT_ARGB8888:
 	case DRM_FORMAT_XRGB2101010:
 	case DRM_FORMAT_ARGB2101010:
-		return OVL_CON_CLRFMT_ARGB8888;
+		return blend_mode == DRM_MODE_BLEND_COVERAGE ?
+		       OVL_CON_CLRFMT_ARGB8888 :
+		       OVL_CON_CLRFMT_PARGB8888;
 	case DRM_FORMAT_XBGR8888:
 	case DRM_FORMAT_ABGR8888:
 	case DRM_FORMAT_XBGR2101010:
 	case DRM_FORMAT_ABGR2101010:
-		return OVL_CON_CLRFMT_ABGR8888;
+		return blend_mode == DRM_MODE_BLEND_COVERAGE ?
+		       OVL_CON_CLRFMT_ABGR8888 :
+		       OVL_CON_CLRFMT_PABGR8888;
 	case DRM_FORMAT_UYVY:
 		return OVL_CON_CLRFMT_UYVY | OVL_CON_MTX_YUV_TO_RGB;
 	case DRM_FORMAT_YUYV:
@@ -453,7 +471,7 @@ void mtk_ovl_layer_config(struct device *dev, unsigned int idx,
 		return;
 	}
 
-	con = ovl_fmt_convert(ovl, fmt);
+	con = ovl_fmt_convert(ovl, fmt, blend_mode);
 	if (state->base.fb) {
 		con |= OVL_CON_AEN;
 		con |= state->base.alpha & OVL_CON_ALPHA;

-- 
2.43.0




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

* [PATCH v4 4/5] drm/mediatek: Support "Pre-multiplied" blending in Mixer
  2024-07-17  5:24 [PATCH v4 0/5] Support alpha blending in MTK display driver Hsiao Chien Sung via B4 Relay
                   ` (2 preceding siblings ...)
  2024-07-17  5:24 ` [PATCH v4 3/5] drm/mediatek: Support "Pre-multiplied" blending in OVL Hsiao Chien Sung via B4 Relay
@ 2024-07-17  5:24 ` Hsiao Chien Sung via B4 Relay
  2024-07-17  6:05   ` CK Hu (胡俊光)
  2024-07-17  5:24 ` [PATCH v4 5/5] drm/mediatek: Support alpha blending in display driver Hsiao Chien Sung via B4 Relay
  2024-07-31 13:34 ` [PATCH v4 0/5] Support alpha blending in MTK " Chun-Kuang Hu
  5 siblings, 1 reply; 20+ messages in thread
From: Hsiao Chien Sung via B4 Relay @ 2024-07-17  5:24 UTC (permalink / raw)
  To: Chun-Kuang Hu, Philipp Zabel, David Airlie, Daniel Vetter,
	Matthias Brugger, AngeloGioacchino Del Regno
  Cc: dri-devel, linux-mediatek, linux-kernel, linux-arm-kernel,
	Hsiao Chien Sung, Hsiao Chien Sung

From: Hsiao Chien Sung <shawn.sung@mediatek.com>

Support "Pre-multiplied" alpha blending mode in Mixer.
Before this patch, only the coverage mode is supported.

To replace the default setting that is set in mtk_ethdr_config(),
we change mtk_ddp_write_mask() to mtk_ddp_write(), and this change will
also reset the NON_PREMULTI_SOURCE bit that was assigned in
mtk_ethdr_config(). Therefore, we must still set NON_PREMULTI_SOURCE bit
if the blend mode is not DRM_MODE_BLEND_PREMULTI.

Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Signed-off-by: Hsiao Chien Sung <shawn.sung@mediatek.com>
---
 drivers/gpu/drm/mediatek/mtk_ethdr.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/mediatek/mtk_ethdr.c b/drivers/gpu/drm/mediatek/mtk_ethdr.c
index 80ccdad3741b..d1d9cf8b10e1 100644
--- a/drivers/gpu/drm/mediatek/mtk_ethdr.c
+++ b/drivers/gpu/drm/mediatek/mtk_ethdr.c
@@ -36,6 +36,7 @@
 #define MIX_SRC_L0_EN				BIT(0)
 #define MIX_L_SRC_CON(n)		(0x28 + 0x18 * (n))
 #define NON_PREMULTI_SOURCE			(2 << 12)
+#define PREMULTI_SOURCE				(3 << 12)
 #define MIX_L_SRC_SIZE(n)		(0x30 + 0x18 * (n))
 #define MIX_L_SRC_OFFSET(n)		(0x34 + 0x18 * (n))
 #define MIX_FUNC_DCM0			0x120
@@ -176,6 +177,11 @@ void mtk_ethdr_layer_config(struct device *dev, unsigned int idx,
 		alpha_con |= state->base.alpha & MIXER_ALPHA;
 	}
 
+	if (state->base.pixel_blend_mode == DRM_MODE_BLEND_PREMULTI)
+		alpha_con |= PREMULTI_SOURCE;
+	else
+		alpha_con |= NON_PREMULTI_SOURCE;
+
 	if ((state->base.fb && !state->base.fb->format->has_alpha) ||
 	    state->base.pixel_blend_mode == DRM_MODE_BLEND_PIXEL_NONE) {
 		/*
@@ -193,8 +199,7 @@ void mtk_ethdr_layer_config(struct device *dev, unsigned int idx,
 	mtk_ddp_write(cmdq_pkt, pending->height << 16 | align_width, &mixer->cmdq_base,
 		      mixer->regs, MIX_L_SRC_SIZE(idx));
 	mtk_ddp_write(cmdq_pkt, offset, &mixer->cmdq_base, mixer->regs, MIX_L_SRC_OFFSET(idx));
-	mtk_ddp_write_mask(cmdq_pkt, alpha_con, &mixer->cmdq_base, mixer->regs, MIX_L_SRC_CON(idx),
-			   0x1ff);
+	mtk_ddp_write(cmdq_pkt, alpha_con, &mixer->cmdq_base, mixer->regs, MIX_L_SRC_CON(idx));
 	mtk_ddp_write_mask(cmdq_pkt, BIT(idx), &mixer->cmdq_base, mixer->regs, MIX_SRC_CON,
 			   BIT(idx));
 }

-- 
2.43.0




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

* [PATCH v4 5/5] drm/mediatek: Support alpha blending in display driver
  2024-07-17  5:24 [PATCH v4 0/5] Support alpha blending in MTK display driver Hsiao Chien Sung via B4 Relay
                   ` (3 preceding siblings ...)
  2024-07-17  5:24 ` [PATCH v4 4/5] drm/mediatek: Support "Pre-multiplied" blending in Mixer Hsiao Chien Sung via B4 Relay
@ 2024-07-17  5:24 ` Hsiao Chien Sung via B4 Relay
  2024-07-31 13:34 ` [PATCH v4 0/5] Support alpha blending in MTK " Chun-Kuang Hu
  5 siblings, 0 replies; 20+ messages in thread
From: Hsiao Chien Sung via B4 Relay @ 2024-07-17  5:24 UTC (permalink / raw)
  To: Chun-Kuang Hu, Philipp Zabel, David Airlie, Daniel Vetter,
	Matthias Brugger, AngeloGioacchino Del Regno
  Cc: dri-devel, linux-mediatek, linux-kernel, linux-arm-kernel,
	Hsiao Chien Sung, CK Hu, Hsiao Chien Sung

From: Hsiao Chien Sung <shawn.sung@mediatek.com>

Support "Pre-multiplied" and "None" blend mode on MediaTek's chips by
adding correct blend mode property when the planes init.
Before this patch, only the "Coverage" mode (default) is supported.

For more information, there are three pixel blend modes in DRM driver:
"None", "Pre-multiplied", and "Coverage".

To understand the difference between these modes, let's take a look at
the following two approaches to do alpha blending:

1. Straight:
dst.RGB = src.RGB * src.A + dst.RGB * (1 - src.A)
This is straightforward and easy to understand, when the source layer is
compositing with the destination layer, it's alpha will affect the
result. This is also known as "post-multiplied", or "Coverage" mode.

2. Pre-multiplied:
dst.RGB = src.RGB + dst.RGB * (1 - src.A)
Since the source RGB have already multiplied its alpha, only destination
RGB need to multiply it. This is the "Pre-multiplied" mode in DRM.

For the "None" blend mode in DRM, it means the pixel alpha is ignored
when compositing the layers, only the constant alpha for the composited
layer will take effects.

Reviewed-by: CK Hu <ck.hu@mediatek.com>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Signed-off-by: Hsiao Chien Sung <shawn.sung@mediatek.com>
---
 drivers/gpu/drm/mediatek/mtk_plane.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/drivers/gpu/drm/mediatek/mtk_plane.c b/drivers/gpu/drm/mediatek/mtk_plane.c
index 1723d4333f37..5bf757a3ef20 100644
--- a/drivers/gpu/drm/mediatek/mtk_plane.c
+++ b/drivers/gpu/drm/mediatek/mtk_plane.c
@@ -346,6 +346,17 @@ int mtk_plane_init(struct drm_device *dev, struct drm_plane *plane,
 			DRM_INFO("Create rotation property failed\n");
 	}
 
+	err = drm_plane_create_alpha_property(plane);
+	if (err)
+		DRM_ERROR("failed to create property: alpha\n");
+
+	err = drm_plane_create_blend_mode_property(plane,
+						   BIT(DRM_MODE_BLEND_PREMULTI) |
+						   BIT(DRM_MODE_BLEND_COVERAGE) |
+						   BIT(DRM_MODE_BLEND_PIXEL_NONE));
+	if (err)
+		DRM_ERROR("failed to create property: blend_mode\n");
+
 	drm_plane_helper_add(plane, &mtk_plane_helper_funcs);
 
 	return 0;

-- 
2.43.0




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

* Re: [PATCH v4 2/5] drm/mediatek: Support "None" blending in Mixer
  2024-07-17  5:24 ` [PATCH v4 2/5] drm/mediatek: Support "None" blending in Mixer Hsiao Chien Sung via B4 Relay
@ 2024-07-17  5:58   ` CK Hu (胡俊光)
  0 siblings, 0 replies; 20+ messages in thread
From: CK Hu (胡俊光) @ 2024-07-17  5:58 UTC (permalink / raw)
  To: p.zabel@pengutronix.de, Shawn Sung (宋孝謙),
	airlied@gmail.com, daniel@ffwll.ch, chunkuang.hu@kernel.org,
	angelogioacchino.delregno@collabora.com, matthias.bgg@gmail.com
  Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org,
	linux-mediatek@lists.infradead.org,
	linux-arm-kernel@lists.infradead.org,
	shawn.sung@mediatek.corp-partner.google.com

Hi, Shawn:

On Wed, 2024-07-17 at 13:24 +0800, Hsiao Chien Sung via B4 Relay wrote:
>  	 
> External email : Please do not click links or open attachments until you have verified the sender or the content.
>  From: Hsiao Chien Sung <shawn.sung@mediatek.com>
> 
> Support "None" alpha blending mode on MediaTek's chips.

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

> 
> Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
> Signed-off-by: Hsiao Chien Sung <shawn.sung@mediatek.com>
> ---
>  drivers/gpu/drm/mediatek/mtk_ethdr.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/mediatek/mtk_ethdr.c b/drivers/gpu/drm/mediatek/mtk_ethdr.c
> index 9dfd13d32dfa..80ccdad3741b 100644
> --- a/drivers/gpu/drm/mediatek/mtk_ethdr.c
> +++ b/drivers/gpu/drm/mediatek/mtk_ethdr.c
> @@ -3,6 +3,7 @@
>   * Copyright (c) 2021 MediaTek Inc.
>   */
>  
> +#include <drm/drm_blend.h>
>  #include <drm/drm_fourcc.h>
>  #include <drm/drm_framebuffer.h>
>  #include <linux/clk.h>
> @@ -175,7 +176,8 @@ void mtk_ethdr_layer_config(struct device *dev, unsigned int idx,
>  alpha_con |= state->base.alpha & MIXER_ALPHA;
>  }
>  
> -if (state->base.fb && !state->base.fb->format->has_alpha) {
> +if ((state->base.fb && !state->base.fb->format->has_alpha) ||
> +    state->base.pixel_blend_mode == DRM_MODE_BLEND_PIXEL_NONE) {
>  /*
>   * Mixer doesn't support CONST_BLD mode,
>   * use a trick to make the output equivalent
> 
> -- 
> 2.43.0
> 
> 

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

* Re: [PATCH v4 4/5] drm/mediatek: Support "Pre-multiplied" blending in Mixer
  2024-07-17  5:24 ` [PATCH v4 4/5] drm/mediatek: Support "Pre-multiplied" blending in Mixer Hsiao Chien Sung via B4 Relay
@ 2024-07-17  6:05   ` CK Hu (胡俊光)
  0 siblings, 0 replies; 20+ messages in thread
From: CK Hu (胡俊光) @ 2024-07-17  6:05 UTC (permalink / raw)
  To: p.zabel@pengutronix.de, Shawn Sung (宋孝謙),
	airlied@gmail.com, daniel@ffwll.ch, chunkuang.hu@kernel.org,
	angelogioacchino.delregno@collabora.com, matthias.bgg@gmail.com
  Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org,
	linux-mediatek@lists.infradead.org,
	linux-arm-kernel@lists.infradead.org,
	shawn.sung@mediatek.corp-partner.google.com

Hi, Shawn:

On Wed, 2024-07-17 at 13:24 +0800, Hsiao Chien Sung via B4 Relay wrote:
>  	 
> External email : Please do not click links or open attachments until you have verified the sender or the content.
>  From: Hsiao Chien Sung <shawn.sung@mediatek.com>
> 
> Support "Pre-multiplied" alpha blending mode in Mixer.
> Before this patch, only the coverage mode is supported.
> 
> To replace the default setting that is set in mtk_ethdr_config(),
> we change mtk_ddp_write_mask() to mtk_ddp_write(), and this change will
> also reset the NON_PREMULTI_SOURCE bit that was assigned in
> mtk_ethdr_config(). Therefore, we must still set NON_PREMULTI_SOURCE bit
> if the blend mode is not DRM_MODE_BLEND_PREMULTI.

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

> 
> Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
> Signed-off-by: Hsiao Chien Sung <shawn.sung@mediatek.com>
> ---
>  drivers/gpu/drm/mediatek/mtk_ethdr.c | 9 +++++++--
>  1 file changed, 7 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/mediatek/mtk_ethdr.c b/drivers/gpu/drm/mediatek/mtk_ethdr.c
> index 80ccdad3741b..d1d9cf8b10e1 100644
> --- a/drivers/gpu/drm/mediatek/mtk_ethdr.c
> +++ b/drivers/gpu/drm/mediatek/mtk_ethdr.c
> @@ -36,6 +36,7 @@
>  #define MIX_SRC_L0_ENBIT(0)
>  #define MIX_L_SRC_CON(n)(0x28 + 0x18 * (n))
>  #define NON_PREMULTI_SOURCE(2 << 12)
> +#define PREMULTI_SOURCE(3 << 12)
>  #define MIX_L_SRC_SIZE(n)(0x30 + 0x18 * (n))
>  #define MIX_L_SRC_OFFSET(n)(0x34 + 0x18 * (n))
>  #define MIX_FUNC_DCM00x120
> @@ -176,6 +177,11 @@ void mtk_ethdr_layer_config(struct device *dev, unsigned int idx,
>  alpha_con |= state->base.alpha & MIXER_ALPHA;
>  }
>  
> +if (state->base.pixel_blend_mode == DRM_MODE_BLEND_PREMULTI)
> +alpha_con |= PREMULTI_SOURCE;
> +else
> +alpha_con |= NON_PREMULTI_SOURCE;
> +
>  if ((state->base.fb && !state->base.fb->format->has_alpha) ||
>      state->base.pixel_blend_mode == DRM_MODE_BLEND_PIXEL_NONE) {
>  /*
> @@ -193,8 +199,7 @@ void mtk_ethdr_layer_config(struct device *dev, unsigned int idx,
>  mtk_ddp_write(cmdq_pkt, pending->height << 16 | align_width, &mixer->cmdq_base,
>        mixer->regs, MIX_L_SRC_SIZE(idx));
>  mtk_ddp_write(cmdq_pkt, offset, &mixer->cmdq_base, mixer->regs, MIX_L_SRC_OFFSET(idx));
> -mtk_ddp_write_mask(cmdq_pkt, alpha_con, &mixer->cmdq_base, mixer->regs, MIX_L_SRC_CON(idx),
> -   0x1ff);
> +mtk_ddp_write(cmdq_pkt, alpha_con, &mixer->cmdq_base, mixer->regs, MIX_L_SRC_CON(idx));
>  mtk_ddp_write_mask(cmdq_pkt, BIT(idx), &mixer->cmdq_base, mixer->regs, MIX_SRC_CON,
>     BIT(idx));
>  }
> 
> -- 
> 2.43.0
> 
> 

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

* Re: [PATCH v4 3/5] drm/mediatek: Support "Pre-multiplied" blending in OVL
  2024-07-17  5:24 ` [PATCH v4 3/5] drm/mediatek: Support "Pre-multiplied" blending in OVL Hsiao Chien Sung via B4 Relay
@ 2024-07-17 13:49   ` AngeloGioacchino Del Regno
  0 siblings, 0 replies; 20+ messages in thread
From: AngeloGioacchino Del Regno @ 2024-07-17 13:49 UTC (permalink / raw)
  To: shawn.sung, Chun-Kuang Hu, Philipp Zabel, David Airlie,
	Daniel Vetter, Matthias Brugger
  Cc: dri-devel, linux-mediatek, linux-kernel, linux-arm-kernel,
	Hsiao Chien Sung, CK Hu

Il 17/07/24 07:24, Hsiao Chien Sung via B4 Relay ha scritto:
> From: Hsiao Chien Sung <shawn.sung@mediatek.com>
> 
> Support "Pre-multiplied" alpha blending mode on in OVL.
> Before this patch, only the "coverage" mode is supported.
> 
> As whether OVL_CON_CLRFMT_MAN bit is enabled, (3 << 12)
> means different formats in the datasheet. To prevent
> misunderstandings going forward, instead of reusing
> OVL_CON_CLRFMT_RGBA8888, we intetionally defined
> OVL_CON_CLRFMT_PARGB8888 with bit operation again.
> 
> Reviewed-by: CK Hu <ck.hu@mediatek.com>
> Signed-off-by: Hsiao Chien Sung <shawn.sung@mediatek.com>

Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>




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

* Re: [PATCH v4 1/5] drm/mediatek: Support "None" blending in OVL
  2024-07-17  5:24 ` [PATCH v4 1/5] drm/mediatek: Support "None" blending in OVL Hsiao Chien Sung via B4 Relay
@ 2024-07-17 13:49   ` AngeloGioacchino Del Regno
  0 siblings, 0 replies; 20+ messages in thread
From: AngeloGioacchino Del Regno @ 2024-07-17 13:49 UTC (permalink / raw)
  To: shawn.sung, Chun-Kuang Hu, Philipp Zabel, David Airlie,
	Daniel Vetter, Matthias Brugger
  Cc: dri-devel, linux-mediatek, linux-kernel, linux-arm-kernel,
	Hsiao Chien Sung, CK Hu

Il 17/07/24 07:24, Hsiao Chien Sung via B4 Relay ha scritto:
> From: Hsiao Chien Sung <shawn.sung@mediatek.com>
> 
> Support "None" alpha blending mode on MediaTek's chips.
> 
> Reviewed-by: CK Hu <ck.hu@mediatek.com>
> Signed-off-by: Hsiao Chien Sung <shawn.sung@mediatek.com>

Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>



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

* Re: [PATCH v4 0/5] Support alpha blending in MTK display driver
  2024-07-17  5:24 [PATCH v4 0/5] Support alpha blending in MTK display driver Hsiao Chien Sung via B4 Relay
                   ` (4 preceding siblings ...)
  2024-07-17  5:24 ` [PATCH v4 5/5] drm/mediatek: Support alpha blending in display driver Hsiao Chien Sung via B4 Relay
@ 2024-07-31 13:34 ` Chun-Kuang Hu
  2024-08-02  1:25   ` Shawn Sung (宋孝謙)
  2024-09-12 20:29   ` Alper Nebi Yasak
  5 siblings, 2 replies; 20+ messages in thread
From: Chun-Kuang Hu @ 2024-07-31 13:34 UTC (permalink / raw)
  To: shawn.sung
  Cc: Chun-Kuang Hu, Philipp Zabel, David Airlie, Daniel Vetter,
	Matthias Brugger, AngeloGioacchino Del Regno, dri-devel,
	linux-mediatek, linux-kernel, linux-arm-kernel, Hsiao Chien Sung,
	CK Hu

Hi, Shawn:

Hsiao Chien Sung via B4 Relay
<devnull+shawn.sung.mediatek.com@kernel.org> 於 2024年7月17日 週三 下午1:24寫道:
>
> Support "Pre-multiplied" and "None" blend mode on MediaTek's chips by
> adding correct blend mode property when the planes init.
> Before this patch, only the "Coverage" mode (default) is supported.

For the whole series, 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.

>
> Signed-off-by: Hsiao Chien Sung <shawn.sung@mediatek.corp-partner.google.com>
> ---
> Changes in v4:
> - Add more information to the commit message
> - Link to v3: https://lore.kernel.org/r/20240710-alpha-blending-v3-0-289c187f9c6f@mediatek.com
>
> Changes in v3:
> - Remove the Change-Id
> - Link to v2: https://lore.kernel.org/r/20240710-alpha-blending-v2-0-d4b505e6980a@mediatek.com
>
> Changes in v2:
> - Remove unnecessary codes
> - Add more information to the commit message
> - Link to v1: https://lore.kernel.org/r/20240620-blend-v1-0-72670072ca20@mediatek.com
>
> ---
> Hsiao Chien Sung (5):
>       drm/mediatek: Support "None" blending in OVL
>       drm/mediatek: Support "None" blending in Mixer
>       drm/mediatek: Support "Pre-multiplied" blending in OVL
>       drm/mediatek: Support "Pre-multiplied" blending in Mixer
>       drm/mediatek: Support alpha blending in display driver
>
>  drivers/gpu/drm/mediatek/mtk_disp_ovl.c | 36 +++++++++++++++++++++++++--------
>  drivers/gpu/drm/mediatek/mtk_ethdr.c    | 13 +++++++++---
>  drivers/gpu/drm/mediatek/mtk_plane.c    | 11 ++++++++++
>  3 files changed, 49 insertions(+), 11 deletions(-)
> ---
> base-commit: 8ad49a92cff4bab13eb2f2725243f5f31eff3f3b
> change-id: 20240710-alpha-blending-067295570863
>
> Best regards,
> --
> Hsiao Chien Sung <shawn.sung@mediatek.com>
>
>


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

* Re: [PATCH v4 0/5] Support alpha blending in MTK display driver
  2024-07-31 13:34 ` [PATCH v4 0/5] Support alpha blending in MTK " Chun-Kuang Hu
@ 2024-08-02  1:25   ` Shawn Sung (宋孝謙)
  2024-09-12 20:29   ` Alper Nebi Yasak
  1 sibling, 0 replies; 20+ messages in thread
From: Shawn Sung (宋孝謙) @ 2024-08-02  1:25 UTC (permalink / raw)
  To: chunkuang.hu@kernel.org
  Cc: linux-mediatek@lists.infradead.org, linux-kernel@vger.kernel.org,
	daniel@ffwll.ch, p.zabel@pengutronix.de,
	CK Hu (胡俊光), dri-devel@lists.freedesktop.org,
	shawn.sung@mediatek.corp-partner.google.com, airlied@gmail.com,
	linux-arm-kernel@lists.infradead.org, matthias.bgg@gmail.com,
	angelogioacchino.delregno@collabora.com

Hi CK,

On Wed, 2024-07-31 at 21:34 +0800, Chun-Kuang Hu wrote:
>  	 
> External email : Please do not click links or open attachments until
> you have verified the sender or the content.
>  Hi, Shawn:
> 
> Hsiao Chien Sung via B4 Relay
> <devnull+shawn.sung.mediatek.com@kernel.org> 於 2024年7月17日 週三
> 下午1:24寫道:
> >
> > Support "Pre-multiplied" and "None" blend mode on MediaTek's chips
> by
> > adding correct blend mode property when the planes init.
> > Before this patch, only the "Coverage" mode (default) is supported.
> 
> For the whole series, applied to mediatek-drm-next [1], thanks.
> 

Thank you for the information.

Regards,
Shawn

> [1] 
> https://git.kernel.org/pub/scm/linux/kernel/git/chunkuang.hu/linux.git/log/?h=mediatek-drm-next
> 
> Regards,
> Chun-Kuang.
> 
> >
> > Signed-off-by: Hsiao Chien Sung <
> shawn.sung@mediatek.corp-partner.google.com>
> > ---
> > Changes in v4:
> > - Add more information to the commit message
> > - Link to v3: 
> https://lore.kernel.org/r/20240710-alpha-blending-v3-0-289c187f9c6f@mediatek.com
> >
> > Changes in v3:
> > - Remove the Change-Id
> > - Link to v2: 
> https://lore.kernel.org/r/20240710-alpha-blending-v2-0-d4b505e6980a@mediatek.com
> >
> > Changes in v2:
> > - Remove unnecessary codes
> > - Add more information to the commit message
> > - Link to v1: 
> https://lore.kernel.org/r/20240620-blend-v1-0-72670072ca20@mediatek.com
> >
> > ---
> > Hsiao Chien Sung (5):
> >       drm/mediatek: Support "None" blending in OVL
> >       drm/mediatek: Support "None" blending in Mixer
> >       drm/mediatek: Support "Pre-multiplied" blending in OVL
> >       drm/mediatek: Support "Pre-multiplied" blending in Mixer
> >       drm/mediatek: Support alpha blending in display driver
> >
> >  drivers/gpu/drm/mediatek/mtk_disp_ovl.c | 36
> +++++++++++++++++++++++++--------
> >  drivers/gpu/drm/mediatek/mtk_ethdr.c    | 13 +++++++++---
> >  drivers/gpu/drm/mediatek/mtk_plane.c    | 11 ++++++++++
> >  3 files changed, 49 insertions(+), 11 deletions(-)
> > ---
> > base-commit: 8ad49a92cff4bab13eb2f2725243f5f31eff3f3b
> > change-id: 20240710-alpha-blending-067295570863
> >
> > Best regards,
> > --
> > Hsiao Chien Sung <shawn.sung@mediatek.com>
> >
> >

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

* Re: [PATCH v4 0/5] Support alpha blending in MTK display driver
  2024-07-31 13:34 ` [PATCH v4 0/5] Support alpha blending in MTK " Chun-Kuang Hu
  2024-08-02  1:25   ` Shawn Sung (宋孝謙)
@ 2024-09-12 20:29   ` Alper Nebi Yasak
  2024-09-13  1:25     ` CK Hu (胡俊光)
  2024-09-13  2:56     ` Shawn Sung (宋孝謙)
  1 sibling, 2 replies; 20+ messages in thread
From: Alper Nebi Yasak @ 2024-09-12 20:29 UTC (permalink / raw)
  To: linux-mediatek, Chun-Kuang Hu, Hsiao Chien Sung
  Cc: Philipp Zabel, David Airlie, Daniel Vetter, Matthias Brugger,
	AngeloGioacchino Del Regno, dri-devel, linux-kernel,
	linux-arm-kernel, Hsiao Chien Sung, CK Hu, Chen-Yu Tsai

Hi,

On 2024-07-31 16:34 +03:00, Chun-Kuang Hu wrote:
> Hi, Shawn:
> 
> Hsiao Chien Sung via B4 Relay
> <devnull+shawn.sung.mediatek.com@kernel.org> 於 2024年7月17日 週三 下午1:24寫道:
>>
>> Support "Pre-multiplied" and "None" blend mode on MediaTek's chips by
>> adding correct blend mode property when the planes init.
>> Before this patch, only the "Coverage" mode (default) is supported.
> 
> For the whole series, 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

I am seeing broken colors on an MT8173 Chromebook with next-20240912,
which goes away if I git-revert this series (commits 1f66fe62cc09
eb17c5909481 a3f7f7ef4bfe 59e9d9de25f0 4225d5d5e779).

To illustrate, I took a picture [1] of some color mixing diagrams from
Wikipedia [2]. Do you have an idea of what goes wrong?

(I'm busy with too many things so I don't want to debug it now...)

[1] https://i.imgur.com/tNFvovB.jpeg
[2] https://en.wikipedia.org/wiki/Color_space#Generic


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

* Re: [PATCH v4 0/5] Support alpha blending in MTK display driver
  2024-09-12 20:29   ` Alper Nebi Yasak
@ 2024-09-13  1:25     ` CK Hu (胡俊光)
  2024-09-13  2:56       ` Jason-JH Lin (林睿祥)
  2024-09-13  2:56     ` Shawn Sung (宋孝謙)
  1 sibling, 1 reply; 20+ messages in thread
From: CK Hu (胡俊光) @ 2024-09-13  1:25 UTC (permalink / raw)
  To: Shawn Sung (宋孝謙), alpernebiyasak@gmail.com,
	linux-mediatek@lists.infradead.org, chunkuang.hu@kernel.org,
	Jason-JH Lin (林睿祥)
  Cc: linux-kernel@vger.kernel.org, wenst@chromium.org, daniel@ffwll.ch,
	p.zabel@pengutronix.de, dri-devel@lists.freedesktop.org,
	shawn.sung@mediatek.corp-partner.google.com, airlied@gmail.com,
	linux-arm-kernel@lists.infradead.org, matthias.bgg@gmail.com,
	angelogioacchino.delregno@collabora.com

Hi, Jason:

Please help to fix this issue.
Otherwise, I would revert this series.

Regards,
CK

On Thu, 2024-09-12 at 23:29 +0300, Alper Nebi Yasak wrote:
>  	 
> External email : Please do not click links or open attachments until you have verified the sender or the content.
>  Hi,
> 
> On 2024-07-31 16:34 +03:00, Chun-Kuang Hu wrote:
> > Hi, Shawn:
> > 
> > Hsiao Chien Sung via B4 Relay
> > <devnull+shawn.sung.mediatek.com@kernel.org> 於 2024年7月17日 週三 下午1:24寫道:
> >>
> >> Support "Pre-multiplied" and "None" blend mode on MediaTek's chips by
> >> adding correct blend mode property when the planes init.
> >> Before this patch, only the "Coverage" mode (default) is supported.
> > 
> > For the whole series, 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
> 
> I am seeing broken colors on an MT8173 Chromebook with next-20240912,
> which goes away if I git-revert this series (commits 1f66fe62cc09
> eb17c5909481 a3f7f7ef4bfe 59e9d9de25f0 4225d5d5e779).
> 
> To illustrate, I took a picture [1] of some color mixing diagrams from
> Wikipedia [2]. Do you have an idea of what goes wrong?
> 
> (I'm busy with too many things so I don't want to debug it now...)
> 
> [1] https://i.imgur.com/tNFvovB.jpeg
> [2] https://en.wikipedia.org/wiki/Color_space#Generic
> 

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

* Re: [PATCH v4 0/5] Support alpha blending in MTK display driver
  2024-09-12 20:29   ` Alper Nebi Yasak
  2024-09-13  1:25     ` CK Hu (胡俊光)
@ 2024-09-13  2:56     ` Shawn Sung (宋孝謙)
  1 sibling, 0 replies; 20+ messages in thread
From: Shawn Sung (宋孝謙) @ 2024-09-13  2:56 UTC (permalink / raw)
  To: alpernebiyasak@gmail.com, linux-mediatek@lists.infradead.org,
	chunkuang.hu@kernel.org
  Cc: linux-kernel@vger.kernel.org, wenst@chromium.org, daniel@ffwll.ch,
	p.zabel@pengutronix.de, CK Hu (胡俊光),
	dri-devel@lists.freedesktop.org,
	shawn.sung@mediatek.corp-partner.google.com, airlied@gmail.com,
	linux-arm-kernel@lists.infradead.org, matthias.bgg@gmail.com,
	angelogioacchino.delregno@collabora.com

Hi Alper,

On Thu, 2024-09-12 at 23:29 +0300, Alper Nebi Yasak wrote:
> Hi,
> 
> On 2024-07-31 16:34 +03:00, Chun-Kuang Hu wrote:
> > Hi, Shawn:
> > 
> > Hsiao Chien Sung via B4 Relay
> > <devnull+shawn.sung.mediatek.com@kernel.org> 於 2024年7月17日 週三
> > 下午1:24寫道:
> > > 
> > > Support "Pre-multiplied" and "None" blend mode on MediaTek's
> > > chips by
> > > adding correct blend mode property when the planes init.
> > > Before this patch, only the "Coverage" mode (default) is
> > > supported.
> > 
> > For the whole series, 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
> 
> I am seeing broken colors on an MT8173 Chromebook with next-20240912,
> which goes away if I git-revert this series (commits 1f66fe62cc09
> eb17c5909481 a3f7f7ef4bfe 59e9d9de25f0 4225d5d5e779).

Thank you for your feedback. I apologize for the delay in my response;
I was just notified of your email by my colleague.

> 
> To illustrate, I took a picture [1] of some color mixing diagrams
> from
> Wikipedia [2]. Do you have an idea of what goes wrong?

Based on the provided pictures, it appears that this issue is related
to the way the MT8173 chip handles alpha channel (ARGB -> RGBA), which
differes from the behavior of later chips.

> 
> (I'm busy with too many things so I don't want to debug it now...)
> 
> [1] https://i.imgur.com/tNFvovB.jpeg
> [2] https://en.wikipedia.org/wiki/Color_space#Generic

We will either submit a new fix ASAP or revert this series as a first
step.

Best regards,
Shawn

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

* Re: [PATCH v4 0/5] Support alpha blending in MTK display driver
  2024-09-13  1:25     ` CK Hu (胡俊光)
@ 2024-09-13  2:56       ` Jason-JH Lin (林睿祥)
  2024-09-13  5:40         ` Alper Nebi Yasak
  0 siblings, 1 reply; 20+ messages in thread
From: Jason-JH Lin (林睿祥) @ 2024-09-13  2:56 UTC (permalink / raw)
  To: CK Hu (胡俊光),
	Shawn Sung (宋孝謙), alpernebiyasak@gmail.com,
	linux-mediatek@lists.infradead.org, chunkuang.hu@kernel.org
  Cc: linux-kernel@vger.kernel.org, wenst@chromium.org, daniel@ffwll.ch,
	p.zabel@pengutronix.de,
	shawn.sung@mediatek.corp-partner.google.com,
	dri-devel@lists.freedesktop.org,
	linux-arm-kernel@lists.infradead.org, airlied@gmail.com,
	matthias.bgg@gmail.com, angelogioacchino.delregno@collabora.com

Hi Alper,

I think that's a platform issue because it works find in my MT8188
platform, but I don't have any MT8173 platform.

Can you help me test the fix patch in your MT8173 platform?
I'll provide a fix patch in 2 weeks via Google Chat.

Regards,
Jason-JH.Lin

On Fri, 2024-09-13 at 01:25 +0000, CK Hu (胡俊光) wrote:
> Hi, Jason:
> 
> Please help to fix this issue.
> Otherwise, I would revert this series.
> 
> Regards,
> CK
> 
> On Thu, 2024-09-12 at 23:29 +0300, Alper Nebi Yasak wrote:
> >  	 
> > External email : Please do not click links or open attachments
> > until you have verified the sender or the content.
> >  Hi,
> > 
> > On 2024-07-31 16:34 +03:00, Chun-Kuang Hu wrote:
> > > Hi, Shawn:
> > > 
> > > Hsiao Chien Sung via B4 Relay
> > > <devnull+shawn.sung.mediatek.com@kernel.org> 於 2024年7月17日 週三
> > > 下午1:24寫道:
> > > > 
> > > > Support "Pre-multiplied" and "None" blend mode on MediaTek's
> > > > chips by
> > > > adding correct blend mode property when the planes init.
> > > > Before this patch, only the "Coverage" mode (default) is
> > > > supported.
> > > 
> > > For the whole series, 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
> > 
> > I am seeing broken colors on an MT8173 Chromebook with next-
> > 20240912,
> > which goes away if I git-revert this series (commits 1f66fe62cc09
> > eb17c5909481 a3f7f7ef4bfe 59e9d9de25f0 4225d5d5e779).
> > 
> > To illustrate, I took a picture [1] of some color mixing diagrams
> > from
> > Wikipedia [2]. Do you have an idea of what goes wrong?
> > 
> > (I'm busy with too many things so I don't want to debug it now...)
> > 
> > [1] https://i.imgur.com/tNFvovB.jpeg
> > [2] https://en.wikipedia.org/wiki/Color_space#Generic
> > 

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

* Re: [PATCH v4 0/5] Support alpha blending in MTK display driver
  2024-09-13  2:56       ` Jason-JH Lin (林睿祥)
@ 2024-09-13  5:40         ` Alper Nebi Yasak
  2024-09-13  9:01           ` AngeloGioacchino Del Regno
  0 siblings, 1 reply; 20+ messages in thread
From: Alper Nebi Yasak @ 2024-09-13  5:40 UTC (permalink / raw)
  To: linux-mediatek
  Cc: linux-kernel, Chen-Yu Tsai, Daniel Vetter, Philipp Zabel,
	Hsiao Chien Sung, dri-devel, linux-arm-kernel, David Airlie,
	Matthias Brugger, AngeloGioacchino Del Regno, Chun-Kuang Hu,
	CK Hu (胡俊光),
	Shawn Sung (宋孝謙),
	Jason-JH Lin (林睿祥)

Hi,

On 2024-09-13 05:56 +03:00, Jason-JH Lin (林睿祥) wrote:
> Hi Alper,
> 
> I think that's a platform issue because it works find in my MT8188
> platform, but I don't have any MT8173 platform.
> 
> Can you help me test the fix patch in your MT8173 platform?
> I'll provide a fix patch in 2 weeks via Google Chat.
> 
> Regards,
> Jason-JH.Lin

I replied over Google Chat, but to make it clear for others on the
mailing list: Yes, I'll try to test patches when you send them.

> On Fri, 2024-09-13 at 01:25 +0000, CK Hu (胡俊光) wrote:
>> Hi, Jason:
>> 
>> Please help to fix this issue.
>> Otherwise, I would revert this series.
>> 
>> Regards,
>> CK
>> 
>> On Thu, 2024-09-12 at 23:29 +0300, Alper Nebi Yasak wrote:
>> >   
>> > External email : Please do not click links or open attachments
>> > until you have verified the sender or the content.
>> >  Hi,
>> > 
>> > On 2024-07-31 16:34 +03:00, Chun-Kuang Hu wrote:
>> > > Hi, Shawn:
>> > > 
>> > > Hsiao Chien Sung via B4 Relay
>> > > <devnull+shawn.sung.mediatek.com@kernel.org> 於 2024年7月17日 週三
>> > > 下午1:24寫道:
>> > > > 
>> > > > Support "Pre-multiplied" and "None" blend mode on MediaTek's
>> > > > chips by
>> > > > adding correct blend mode property when the planes init.
>> > > > Before this patch, only the "Coverage" mode (default) is
>> > > > supported.
>> > > 
>> > > For the whole series, 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
>> > 
>> > I am seeing broken colors on an MT8173 Chromebook with next-
>> > 20240912,
>> > which goes away if I git-revert this series (commits 1f66fe62cc09
>> > eb17c5909481 a3f7f7ef4bfe 59e9d9de25f0 4225d5d5e779).
>> > 
>> > To illustrate, I took a picture [1] of some color mixing diagrams
>> > from
>> > Wikipedia [2]. Do you have an idea of what goes wrong?
>> > 
>> > (I'm busy with too many things so I don't want to debug it now...)
>> > 
>> > [1] https://i.imgur.com/tNFvovB.jpeg
>> > [2] https://en.wikipedia.org/wiki/Color_space#Generic


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

* Re: [PATCH v4 0/5] Support alpha blending in MTK display driver
  2024-09-13  5:40         ` Alper Nebi Yasak
@ 2024-09-13  9:01           ` AngeloGioacchino Del Regno
  2024-09-14 20:22             ` Jason-JH Lin (林睿祥)
  0 siblings, 1 reply; 20+ messages in thread
From: AngeloGioacchino Del Regno @ 2024-09-13  9:01 UTC (permalink / raw)
  To: Alper Nebi Yasak, linux-mediatek,
	Jason-JH Lin (林睿祥)
  Cc: linux-kernel, Chen-Yu Tsai, Daniel Vetter, Philipp Zabel,
	Hsiao Chien Sung, dri-devel, linux-arm-kernel, David Airlie,
	Matthias Brugger, Chun-Kuang Hu, CK Hu (胡俊光),
	Shawn Sung (宋孝謙)

Il 13/09/24 07:40, Alper Nebi Yasak ha scritto:
> Hi,
> 
> On 2024-09-13 05:56 +03:00, Jason-JH Lin (林睿祥) wrote:
>> Hi Alper,
>>
>> I think that's a platform issue because it works find in my MT8188
>> platform, but I don't have any MT8173 platform.
>>
>> Can you help me test the fix patch in your MT8173 platform?
>> I'll provide a fix patch in 2 weeks via Google Chat.

Jason, Two weeks is a bit too late as CK already picked your series: reverting
and reapplying creates noise in the commit log, and when this can be avoided it
should be avoided.

Since upstream is broken, please understand that this fix should be developed
with *highest* priority (so, as immediate as possible).

Thanks,
Angelo

>>
>> Regards,
>> Jason-JH.Lin
> 
> I replied over Google Chat, but to make it clear for others on the
> mailing list: Yes, I'll try to test patches when you send them.
> 
>> On Fri, 2024-09-13 at 01:25 +0000, CK Hu (胡俊光) wrote:
>>> Hi, Jason:
>>>
>>> Please help to fix this issue.
>>> Otherwise, I would revert this series.
>>>
>>> Regards,
>>> CK
>>>
>>> On Thu, 2024-09-12 at 23:29 +0300, Alper Nebi Yasak wrote:
>>>>    
>>>> External email : Please do not click links or open attachments
>>>> until you have verified the sender or the content.
>>>>   Hi,
>>>>
>>>> On 2024-07-31 16:34 +03:00, Chun-Kuang Hu wrote:
>>>>> Hi, Shawn:
>>>>>
>>>>> Hsiao Chien Sung via B4 Relay
>>>>> <devnull+shawn.sung.mediatek.com@kernel.org> 於 2024年7月17日 週三
>>>>> 下午1:24寫道:
>>>>>>
>>>>>> Support "Pre-multiplied" and "None" blend mode on MediaTek's
>>>>>> chips by
>>>>>> adding correct blend mode property when the planes init.
>>>>>> Before this patch, only the "Coverage" mode (default) is
>>>>>> supported.
>>>>>
>>>>> For the whole series, 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
>>>>
>>>> I am seeing broken colors on an MT8173 Chromebook with next-
>>>> 20240912,
>>>> which goes away if I git-revert this series (commits 1f66fe62cc09
>>>> eb17c5909481 a3f7f7ef4bfe 59e9d9de25f0 4225d5d5e779).
>>>>
>>>> To illustrate, I took a picture [1] of some color mixing diagrams
>>>> from
>>>> Wikipedia [2]. Do you have an idea of what goes wrong?
>>>>
>>>> (I'm busy with too many things so I don't want to debug it now...)
>>>>
>>>> [1] https://i.imgur.com/tNFvovB.jpeg
>>>> [2] https://en.wikipedia.org/wiki/Color_space#Generic



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

* Re: [PATCH v4 0/5] Support alpha blending in MTK display driver
  2024-09-13  9:01           ` AngeloGioacchino Del Regno
@ 2024-09-14 20:22             ` Jason-JH Lin (林睿祥)
  2024-09-15 10:30               ` Shawn Sung (宋孝謙)
  0 siblings, 1 reply; 20+ messages in thread
From: Jason-JH Lin (林睿祥) @ 2024-09-14 20:22 UTC (permalink / raw)
  To: alpernebiyasak@gmail.com, linux-mediatek@lists.infradead.org,
	angelogioacchino.delregno@collabora.com
  Cc: linux-kernel@vger.kernel.org, wenst@chromium.org,
	chunkuang.hu@kernel.org, Shawn Sung (宋孝謙),
	daniel@ffwll.ch, p.zabel@pengutronix.de,
	CK Hu (胡俊光),
	shawn.sung@mediatek.corp-partner.google.com,
	dri-devel@lists.freedesktop.org, airlied@gmail.com,
	linux-arm-kernel@lists.infradead.org, matthias.bgg@gmail.com

On Fri, 2024-09-13 at 09:01 +0000, AngeloGioacchino Del Regno wrote:
> Il 13/09/24 07:40, Alper Nebi Yasak ha scritto:
> > Hi,
> > 
> > On 2024-09-13 05:56 +03:00, Jason-JH Lin (林睿祥) wrote:
> > > Hi Alper,
> > > 
> > > I think that's a platform issue because it works find in my
> > > MT8188
> > > platform, but I don't have any MT8173 platform.
> > > 
> > > Can you help me test the fix patch in your MT8173 platform?
> > > I'll provide a fix patch in 2 weeks via Google Chat.
> 
> Jason, Two weeks is a bit too late as CK already picked your series:
> reverting
> and reapplying creates noise in the commit log, and when this can be
> avoided it
> should be avoided.
> 
> Since upstream is broken, please understand that this fix should be
> developed
> with *highest* priority (so, as immediate as possible).
> 

OK, I'll send the fix path right away!

Regards,
Jason-JH.Lin

> Thanks,
> Angelo
> 
> > > 
> > > Regards,
> > > Jason-JH.Lin
> > 
> > I replied over Google Chat, but to make it clear for others on the
> > mailing list: Yes, I'll try to test patches when you send them.
> > 
> > > On Fri, 2024-09-13 at 01:25 +0000, CK Hu (胡俊光) wrote:
> > > > Hi, Jason:
> > > > 
> > > > Please help to fix this issue.
> > > > Otherwise, I would revert this series.
> > > > 
> > > > Regards,
> > > > CK
> > > > 
> > > > On Thu, 2024-09-12 at 23:29 +0300, Alper Nebi Yasak wrote:
> > > > >    
> > > > > External email : Please do not click links or open
> > > > > attachments
> > > > > until you have verified the sender or the content.
> > > > >   Hi,
> > > > > 
> > > > > On 2024-07-31 16:34 +03:00, Chun-Kuang Hu wrote:
> > > > > > Hi, Shawn:
> > > > > > 
> > > > > > Hsiao Chien Sung via B4 Relay
> > > > > > <devnull+shawn.sung.mediatek.com@kernel.org> 於 2024年7月17日
> > > > > > 週三
> > > > > > 下午1:24寫道:
> > > > > > > 
> > > > > > > Support "Pre-multiplied" and "None" blend mode on
> > > > > > > MediaTek's
> > > > > > > chips by
> > > > > > > adding correct blend mode property when the planes init.
> > > > > > > Before this patch, only the "Coverage" mode (default) is
> > > > > > > supported.
> > > > > > 
> > > > > > For the whole series, applied to mediatek-drm-next [1],
> > > > > > thanks.
> > > > > > 
> > > > > > [1]
> > > > > > 
https://urldefense.com/v3/__https://git.kernel.org/pub/scm/linux/kernel/git/chunkuang.hu/linux.git/log/?h=mediatek-drm-next__;!!CTRNKA9wMg0ARbw!jrw0cZrT-6A9bviBj9yX0zzeM2NAPin74zALZAajn9k92ZFrRVd3iZVOe0xpjsr21_Xw5v8KDeeF7nDtvT5rhRAMDV7KZ-qQ0Q$
> > > > > >  
> > > > > 
> > > > > I am seeing broken colors on an MT8173 Chromebook with next-
> > > > > 20240912,
> > > > > which goes away if I git-revert this series (commits
> > > > > 1f66fe62cc09
> > > > > eb17c5909481 a3f7f7ef4bfe 59e9d9de25f0 4225d5d5e779).
> > > > > 
> > > > > To illustrate, I took a picture [1] of some color mixing
> > > > > diagrams
> > > > > from
> > > > > Wikipedia [2]. Do you have an idea of what goes wrong?
> > > > > 
> > > > > (I'm busy with too many things so I don't want to debug it
> > > > > now...)
> > > > > 
> > > > > [1] 
> > > > > https://urldefense.com/v3/__https://i.imgur.com/tNFvovB.jpeg__;!!CTRNKA9wMg0ARbw!jrw0cZrT-6A9bviBj9yX0zzeM2NAPin74zALZAajn9k92ZFrRVd3iZVOe0xpjsr21_Xw5v8KDeeF7nDtvT5rhRAMDV42KYfvHA$
> > > > >  
> > > > > [2] 
> > > > > https://urldefense.com/v3/__https://en.wikipedia.org/wiki/Color_space*Generic__;Iw!!CTRNKA9wMg0ARbw!jrw0cZrT-6A9bviBj9yX0zzeM2NAPin74zALZAajn9k92ZFrRVd3iZVOe0xpjsr21_Xw5v8KDeeF7nDtvT5rhRAMDV67WeSFhQ$
> > > > >  
> 
> 

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

* Re: [PATCH v4 0/5] Support alpha blending in MTK display driver
  2024-09-14 20:22             ` Jason-JH Lin (林睿祥)
@ 2024-09-15 10:30               ` Shawn Sung (宋孝謙)
  0 siblings, 0 replies; 20+ messages in thread
From: Shawn Sung (宋孝謙) @ 2024-09-15 10:30 UTC (permalink / raw)
  To: Jason-JH Lin (林睿祥), alpernebiyasak@gmail.com,
	angelogioacchino.delregno@collabora.com,
	linux-mediatek@lists.infradead.org
  Cc: linux-kernel@vger.kernel.org, wenst@chromium.org,
	chunkuang.hu@kernel.org, daniel@ffwll.ch, p.zabel@pengutronix.de,
	CK Hu (胡俊光),
	shawn.sung@mediatek.corp-partner.google.com,
	dri-devel@lists.freedesktop.org, airlied@gmail.com,
	linux-arm-kernel@lists.infradead.org, matthias.bgg@gmail.com

Hi Jason,

On Sat, 2024-09-14 at 20:22 +0000, Jason-JH Lin (林睿祥) wrote:
> On Fri, 2024-09-13 at 09:01 +0000, AngeloGioacchino Del Regno wrote:
> > Il 13/09/24 07:40, Alper Nebi Yasak ha scritto:
> > > Hi,
> > > 
> > > On 2024-09-13 05:56 +03:00, Jason-JH Lin (林睿祥) wrote:
> > > > Hi Alper,
> > > > 
> > > > I think that's a platform issue because it works find in my
> > > > MT8188
> > > > platform, but I don't have any MT8173 platform.
> > > > 
> > > > Can you help me test the fix patch in your MT8173 platform?
> > > > I'll provide a fix patch in 2 weeks via Google Chat.
> > 
> > Jason, Two weeks is a bit too late as CK already picked your
> > series:
> > reverting
> > and reapplying creates noise in the commit log, and when this can
> > be
> > avoided it
> > should be avoided.
> > 
> > Since upstream is broken, please understand that this fix should be
> > developed
> > with *highest* priority (so, as immediate as possible).
> > 
> 
> OK, I'll send the fix path right away!

I notice that I'm unable to see replies from external sources. Not sure
if this is related to B4 relay, but I wanted to bring this to your
attention as feedback while you may want to consider sending the
patches with B4 relay as well.

Regards,
Shawn


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

end of thread, other threads:[~2024-09-15 10:41 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-07-17  5:24 [PATCH v4 0/5] Support alpha blending in MTK display driver Hsiao Chien Sung via B4 Relay
2024-07-17  5:24 ` [PATCH v4 1/5] drm/mediatek: Support "None" blending in OVL Hsiao Chien Sung via B4 Relay
2024-07-17 13:49   ` AngeloGioacchino Del Regno
2024-07-17  5:24 ` [PATCH v4 2/5] drm/mediatek: Support "None" blending in Mixer Hsiao Chien Sung via B4 Relay
2024-07-17  5:58   ` CK Hu (胡俊光)
2024-07-17  5:24 ` [PATCH v4 3/5] drm/mediatek: Support "Pre-multiplied" blending in OVL Hsiao Chien Sung via B4 Relay
2024-07-17 13:49   ` AngeloGioacchino Del Regno
2024-07-17  5:24 ` [PATCH v4 4/5] drm/mediatek: Support "Pre-multiplied" blending in Mixer Hsiao Chien Sung via B4 Relay
2024-07-17  6:05   ` CK Hu (胡俊光)
2024-07-17  5:24 ` [PATCH v4 5/5] drm/mediatek: Support alpha blending in display driver Hsiao Chien Sung via B4 Relay
2024-07-31 13:34 ` [PATCH v4 0/5] Support alpha blending in MTK " Chun-Kuang Hu
2024-08-02  1:25   ` Shawn Sung (宋孝謙)
2024-09-12 20:29   ` Alper Nebi Yasak
2024-09-13  1:25     ` CK Hu (胡俊光)
2024-09-13  2:56       ` Jason-JH Lin (林睿祥)
2024-09-13  5:40         ` Alper Nebi Yasak
2024-09-13  9:01           ` AngeloGioacchino Del Regno
2024-09-14 20:22             ` Jason-JH Lin (林睿祥)
2024-09-15 10:30               ` Shawn Sung (宋孝謙)
2024-09-13  2:56     ` Shawn Sung (宋孝謙)

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).