Skip to contentSkip to conversation

Support alpha blending in MTK display driver

PATCH In review Hsiao Chien Sung 6 participants 20 messages Jul 17, 2024 – Sep 15, 2024

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

v4 cover Support alpha blending in MTK display driver

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.

---
Changes in v4:
- Add more information to the commit message
- Link to v3: https://lore.kernel.org/r/[email protected]

Changes in v3:
- Remove the Change-Id
- Link to v2: https://lore.kernel.org/r/[email protected]

Changes in v2:
- Remove unnecessary codes
- Add more information to the commit message
- Link to v1: https://lore.kernel.org/r/[email protected]

---
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,

Signature · 1 line
Hsiao Chien Sung <[email protected]>
#1 lore raw

PATCH v4 1/5 drm/mediatek: Support "None" blending in OVL

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

---
 drivers/gpu/drm/mediatek/mtk_disp_ovl.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/mediatek/mtk_disp_ovl.c +3 -1
index 9d6d9fd8342e..add671c38613 100644
@@ -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) {
Signature · 1 line
2.43.0
#3 lore raw

PATCH v4 2/5 drm/mediatek: Support "None" blending in Mixer

In reply to Hsiao Chien Sung

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

---
 drivers/gpu/drm/mediatek/mtk_ethdr.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/mediatek/mtk_ethdr.c +3 -1
index 9dfd13d32dfa..80ccdad3741b 100644
@@ -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
Signature · 1 line
2.43.0
Reviewed-by on v4 2/5
#4 lore raw

Re: [PATCH v4 2/5] drm/mediatek: Support "None" blending in Mixer

Hi, Shawn:

Quoted 5 lines · 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 <[email protected]>

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

Quoted 34 lines
---
 drivers/gpu/drm/mediatek/mtk_ethdr.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/mediatek/mtk_ethdr.c +3 -1
index 9dfd13d32dfa..80ccdad3741b 100644
@@ -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
Signature · 2 lines
-- 
2.43.0
#5 lore raw

PATCH v4 3/5 drm/mediatek: Support "Pre-multiplied" blending in OVL

In reply to Hsiao Chien Sung

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.

---
 drivers/gpu/drm/mediatek/mtk_disp_ovl.c | 32 +++++++++++++++++++++++++-------
 1 file changed, 25 insertions(+), 7 deletions(-)
drivers/gpu/drm/mediatek/mtk_disp_ovl.c +25 -7
index add671c38613..89b439dcf3a6 100644
@@ -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;
Signature · 1 line
2.43.0
maintainer Reviewed-by on v4 3/5
#6 lore raw

Re: [PATCH v4 3/5] drm/mediatek: Support "Pre-multiplied" blending in OVL

Il 17/07/24 07:24, Hsiao Chien Sung via B4 Relay ha scritto:

Quoted 5 lines

From: Hsiao Chien Sung <[email protected]>

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

Quoted 8 lines

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.

#7 lore raw

PATCH v4 4/5 drm/mediatek: Support "Pre-multiplied" blending in Mixer

In reply to Hsiao Chien Sung

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.

---
 drivers/gpu/drm/mediatek/mtk_ethdr.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
drivers/gpu/drm/mediatek/mtk_ethdr.c +7 -2
index 80ccdad3741b..d1d9cf8b10e1 100644
@@ -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));
 }
Signature · 1 line
2.43.0
Reviewed-by on v4 4/5
#8 lore raw

Re: [PATCH v4 4/5] drm/mediatek: Support "Pre-multiplied" blending in Mixer

Hi, Shawn:

Quoted 4 lines · 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 <[email protected]>

Quoted 8 lines

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.

Quoted 46 lines
---
 drivers/gpu/drm/mediatek/mtk_ethdr.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
drivers/gpu/drm/mediatek/mtk_ethdr.c +7 -2
index 80ccdad3741b..d1d9cf8b10e1 100644
@@ -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));
 }
Signature · 2 lines
-- 
2.43.0
#9 lore raw

PATCH v4 5/5 drm/mediatek: Support alpha blending in display driver

In reply to 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.

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.

---
 drivers/gpu/drm/mediatek/mtk_plane.c | 11 +++++++++++
 1 file changed, 11 insertions(+)
drivers/gpu/drm/mediatek/mtk_plane.c +11 -0
index 1723d4333f37..5bf757a3ef20 100644
@@ -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;
Signature · 1 line
2.43.0
maintainer
#10 lore raw
In reply to Hsiao Chien Sung

Hi, Shawn:

Hsiao Chien Sung via B4 Relay <[email protected]> 於 2024年7月17日 週三 下午1:24寫道:

Quoted 4 lines

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.

Quoted 37 lines

---
Changes in v4:
- Add more information to the commit message
- Link to v3: https://lore.kernel.org/r/[email protected]

Changes in v3:
- Remove the Change-Id
- Link to v2: https://lore.kernel.org/r/[email protected]

Changes in v2:
- Remove unnecessary codes
- Add more information to the commit message
- Link to v1: https://lore.kernel.org/r/[email protected]

---
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 <[email protected]>

#11 lore raw

Hi CK,

Quoted 9 lines · Chun-Kuang Hu

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 <[email protected]> 於 2024年7月17日 週三 下午1:24寫道:

Quoted 1 line
Quoted 7 lines
Quoted 1 line

Support "Pre-multiplied" and "None" blend mode on MediaTek's chips

by

Quoted 2 lines

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

Quoted 48 lines

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

Regards,
Chun-Kuang.

Quoted 2 lines
Signed-off-by Hsiao Chien Sung <

[email protected]>

Quoted 4 lines

---
Changes in v4:
- Add more information to the commit message
- Link to v3:

https://lore.kernel.org/r/[email protected]

Quoted 4 lines

Changes in v3:
- Remove the Change-Id
- Link to v2:

https://lore.kernel.org/r/[email protected]

Quoted 5 lines

Changes in v2:
- Remove unnecessary codes
- Add more information to the commit message
- Link to v1:

https://lore.kernel.org/r/[email protected]

Quoted 10 lines

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

+++++++++++++++++++++++++--------

Quoted 12 lines
 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 <[email protected]>

#12 lore raw
In reply to Chun-Kuang Hu

Hi,

Quoted 5 lines · Chun-Kuang Hu

Hi, Shawn:

Hsiao Chien Sung via B4 Relay <[email protected]> 於 2024年7月17日 週三 下午1:24寫道:

Quoted 1 line
Quoted 7 lines
Quoted 3 lines

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

#13 lore raw

Hi, Jason:

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

Regards,
CK

Quoted 30 lines · Alper Nebi Yasak

External email : Please do not click links or open attachments until you have verified the sender or the content.
Hi,

Quoted 5 lines · Chun-Kuang Hu

Hi, Shawn:

Hsiao Chien Sung via B4 Relay <[email protected]> 於 2024年7月17日 週三 下午1:24寫道:

Quoted 1 line
Quoted 7 lines
Quoted 3 lines

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

#14 lore raw

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

Quoted 46 lines · CK Hu (胡俊光)

Hi, Jason:

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

Regards,
CK

Quoted 37 lines · Alper Nebi Yasak

External email : Please do not click links or open attachments until you have verified the sender or the content.
Hi,

Quoted 12 lines · Chun-Kuang Hu

Hi, Shawn:

Hsiao Chien Sung via B4 Relay <[email protected]> 於 2024年7月17日 週三 下午1:24寫道:

Quoted 6 lines

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.

Quoted 4 lines

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

#15 lore raw

Hi,

Quoted 10 lines · Jason-JH Lin (林睿祥)

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.

Quoted 46 lines · CK Hu (胡俊光)
Quoted 45 lines

Hi, Jason:

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

Regards,
CK

Quoted 36 lines · Alper Nebi Yasak

External email : Please do not click links or open attachments until you have verified the sender or the content.
Hi,

Quoted 12 lines · Chun-Kuang Hu

Hi, Shawn:

Hsiao Chien Sung via B4 Relay <[email protected]> 於 2024年7月17日 週三 下午1:24寫道:

Quoted 6 lines

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.

Quoted 4 lines

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

#16 lore raw

Il 13/09/24 07:40, Alper Nebi Yasak ha scritto:

Quoted 10 lines

Hi,

Quoted 7 lines · Jason-JH Lin (林睿祥)

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

Quoted 53 lines
Quoted 3 lines

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.

Quoted 46 lines · CK Hu (胡俊光)
Quoted 45 lines

Hi, Jason:

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

Regards,
CK

Quoted 36 lines · Alper Nebi Yasak

External email : Please do not click links or open attachments until you have verified the sender or the content.
Hi,

Quoted 12 lines · Chun-Kuang Hu

Hi, Shawn:

Hsiao Chien Sung via B4 Relay <[email protected]> 於 2024年7月17日 週三 下午1:24寫道:

Quoted 6 lines

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.

Quoted 4 lines

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

#17 lore raw
Quoted 19 lines · AngeloGioacchino Del Regno

Il 13/09/24 07:40, Alper Nebi Yasak ha scritto:

Quoted 11 lines

Hi,

Quoted 8 lines · Jason-JH Lin (林睿祥)

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.

Quoted 4 lines

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

Quoted 46 lines

Thanks,
Angelo

Quoted 43 lines
Quoted 3 lines

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.

Quoted 36 lines · CK Hu (胡俊光)
Quoted 35 lines

Hi, Jason:

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

Regards,
CK

Quoted 26 lines · Alper Nebi Yasak

External email : Please do not click links or open attachments
until you have verified the sender or the content.
Hi,

Quoted 19 lines · Chun-Kuang Hu

Hi, Shawn:

Hsiao Chien Sung via B4 Relay <[email protected]> 於 2024年7月17日 週三
下午1:24寫道:

Quoted 7 lines

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$

Quoted 24 lines
Quoted 22 lines
Quoted 22 lines
Quoted 22 lines
Quoted 22 lines
Quoted 1 line

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$

#18 lore raw

Hi Jason,

Quoted 22 lines · Jason-JH Lin (林睿祥)
Quoted 21 lines · AngeloGioacchino Del Regno

Il 13/09/24 07:40, Alper Nebi Yasak ha scritto:

Quoted 11 lines

Hi,

Quoted 8 lines · Jason-JH Lin (林睿祥)

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.

Quoted 6 lines
Quoted 4 lines

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

#19 lore raw
In reply to Alper Nebi Yasak

Hi Alper,

Quoted 15 lines · Alper Nebi Yasak

Hi,

Quoted 12 lines · Chun-Kuang Hu

Hi, Shawn:

Hsiao Chien Sung via B4 Relay <[email protected]> 於 2024年7月17日 週三 下午1:24寫道:

Quoted 6 lines

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.

Quoted 8 lines
Quoted 4 lines

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.

Quoted 4 lines

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.

Quoted 5 lines

(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