linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v10 0/5] Fix degradation problem of alpha blending series
@ 2024-10-08  6:47 Jason-JH.Lin
  2024-10-08  6:47 ` [PATCH v10 1/5] drm/mediatek: ovl: Fix XRGB format breakage for blend_modes unsupported SoCs Jason-JH.Lin
                   ` (6 more replies)
  0 siblings, 7 replies; 17+ messages in thread
From: Jason-JH.Lin @ 2024-10-08  6:47 UTC (permalink / raw)
  To: Adam Thiede, Yassine Oudjana, Chun-Kuang Hu,
	AngeloGioacchino Del Regno
  Cc: Shawn Sung, Alper Nebi Yasak, dri-devel, linux-mediatek,
	linux-kernel, linux-arm-kernel, Jason-JH . Lin, Singo Chang,
	Nancy Lin, Project_Global_Chrome_Upstream_Group

Some SoCs do not support the ignore_pixl_alpha flag, which breaks the
XRGB8888 format. Some SoCs do not support pre-multiplied pixel formats
and extending configuration of OVL pre-multiplied color formats,
such as MT8173.

Fix the SoC degradation problem by this sreies.

---

Change in v10:
1. Fix the commit message and comment for OVL_CON_AEN

Change in v9:
1. Add the fix patch for the XRGB8888 downgrade issue of MT8173
2. Add the refine patch for ignore_pixel_alpha statement

Change in v8:
Remove blend_modes for not supported pre-multiplied SoCs to fix the
return error from drm_plane_create_blend_mode_property().

Change in v7:
1. Add the remove color format comment patch for OVL
2. Fix warning: 'const' type qualifier on return type has no effect

Chnage in v6:
1. Use blend_modes instead of function pointer in OVL
2. Use ethdr instead of mdp_rdma to get blend_modes
3. Add 0 checking for adding blend_mode property for mtk_plane

Change in v5:
Add fix patch for mtk_plane

Change in v4:
Add lost cases of mtk_ovl_fmt_convert_with_blend

Change in v3:
Change MACRO approach to function pointer in driver data

Change in v2:
Fix build error and typo

Change in v1:
Add fix patch for OVL unsupport color format settings by driver data

---

Jason-JH.Lin (5):
  drm/mediatek: ovl: Fix XRGB format breakage for blend_modes
    unsupported SoCs
  drm/mediatek: ovl: Refine ignore_pixel_alpha comment and placement
  drm/mediatek: ovl: Remove the color format comment for
    ovl_fmt_convert()
  drm/mediatek: ovl: Add blend_modes to driver data
  drm/mediatek: Add blend_modes to mtk_plane_init() for different SoCs

 drivers/gpu/drm/mediatek/mtk_crtc.c           |  1 +
 drivers/gpu/drm/mediatek/mtk_ddp_comp.c       |  2 +
 drivers/gpu/drm/mediatek/mtk_ddp_comp.h       | 10 +++
 drivers/gpu/drm/mediatek/mtk_disp_drv.h       |  2 +
 drivers/gpu/drm/mediatek/mtk_disp_ovl.c       | 70 ++++++++++++++-----
 .../gpu/drm/mediatek/mtk_disp_ovl_adaptor.c   |  7 ++
 drivers/gpu/drm/mediatek/mtk_ethdr.c          |  7 ++
 drivers/gpu/drm/mediatek/mtk_ethdr.h          |  1 +
 drivers/gpu/drm/mediatek/mtk_plane.c          | 15 ++--
 drivers/gpu/drm/mediatek/mtk_plane.h          |  4 +-
 10 files changed, 92 insertions(+), 27 deletions(-)

-- 
2.43.0



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

* [PATCH v10 1/5] drm/mediatek: ovl: Fix XRGB format breakage for blend_modes unsupported SoCs
  2024-10-08  6:47 [PATCH v10 0/5] Fix degradation problem of alpha blending series Jason-JH.Lin
@ 2024-10-08  6:47 ` Jason-JH.Lin
  2024-10-08  7:55   ` Markus Elfring
  2024-10-09  3:22   ` CK Hu (胡俊光)
  2024-10-08  6:47 ` [PATCH v10 2/5] drm/mediatek: ovl: Refine ignore_pixel_alpha comment and placement Jason-JH.Lin
                   ` (5 subsequent siblings)
  6 siblings, 2 replies; 17+ messages in thread
From: Jason-JH.Lin @ 2024-10-08  6:47 UTC (permalink / raw)
  To: Adam Thiede, Yassine Oudjana, Chun-Kuang Hu,
	AngeloGioacchino Del Regno
  Cc: Shawn Sung, Alper Nebi Yasak, dri-devel, linux-mediatek,
	linux-kernel, linux-arm-kernel, Jason-JH . Lin, Singo Chang,
	Nancy Lin, Project_Global_Chrome_Upstream_Group

OVL_CON_AEN is for alpha blending enable.
For the SoC that is supported the blend_modes, OVL_CON_AEN will always
enabled to use constant alpha and then use the ignore_pixel_alpha bit
to do the alpha blending for XRGB8888 format.
Note that ignore pixel alpha bit is not supported if the SoC is not
supported the blend_modes.
So it will break the original setting of XRGB8888 foramt for the
blend_modes unsupported SoCs, such as MT8173.

To fix the downgrade issue, enable alpha blending only when a valid
blend_mode or has_alpha is set.

Fixes: bc46eb5d5d77 ("drm/mediatek: Support DRM plane alpha in OVL")
Signed-off-by: Jason-JH.Lin <jason-jh.lin@mediatek.com>
---
 drivers/gpu/drm/mediatek/mtk_disp_ovl.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/mediatek/mtk_disp_ovl.c b/drivers/gpu/drm/mediatek/mtk_disp_ovl.c
index 89b439dcf3a6..047cd1796a51 100644
--- a/drivers/gpu/drm/mediatek/mtk_disp_ovl.c
+++ b/drivers/gpu/drm/mediatek/mtk_disp_ovl.c
@@ -473,8 +473,14 @@ void mtk_ovl_layer_config(struct device *dev, unsigned int idx,
 
 	con = ovl_fmt_convert(ovl, fmt, blend_mode);
 	if (state->base.fb) {
-		con |= OVL_CON_AEN;
 		con |= state->base.alpha & OVL_CON_ALPHA;
+
+		/*
+		 * For blend_modes supported SoCs, always enable alpha blending.
+		 * For blend_modes unsupported SoCs, enable alpha blending when has_alpha is set.
+		 */
+		if (blend_mode || state->base.fb->format->has_alpha)
+			con |= OVL_CON_AEN;
 	}
 
 	/* CONST_BLD must be enabled for XRGB formats although the alpha channel
-- 
2.43.0



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

* [PATCH v10 2/5] drm/mediatek: ovl: Refine ignore_pixel_alpha comment and placement
  2024-10-08  6:47 [PATCH v10 0/5] Fix degradation problem of alpha blending series Jason-JH.Lin
  2024-10-08  6:47 ` [PATCH v10 1/5] drm/mediatek: ovl: Fix XRGB format breakage for blend_modes unsupported SoCs Jason-JH.Lin
@ 2024-10-08  6:47 ` Jason-JH.Lin
  2024-10-08  6:47 ` [PATCH v10 3/5] drm/mediatek: ovl: Remove the color format comment for ovl_fmt_convert() Jason-JH.Lin
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 17+ messages in thread
From: Jason-JH.Lin @ 2024-10-08  6:47 UTC (permalink / raw)
  To: Adam Thiede, Yassine Oudjana, Chun-Kuang Hu,
	AngeloGioacchino Del Regno
  Cc: Shawn Sung, Alper Nebi Yasak, dri-devel, linux-mediatek,
	linux-kernel, linux-arm-kernel, Jason-JH . Lin, Singo Chang,
	Nancy Lin, Project_Global_Chrome_Upstream_Group

Refine the comment for ignore_pixel_alpha flag and move it to
if(state->fb) statement to make it less conditional.

Signed-off-by: Jason-JH.Lin <jason-jh.lin@mediatek.com>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Reviewed-by: CK Hu <ck.hu@mediatek.com>
---
 drivers/gpu/drm/mediatek/mtk_disp_ovl.c | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/drivers/gpu/drm/mediatek/mtk_disp_ovl.c b/drivers/gpu/drm/mediatek/mtk_disp_ovl.c
index 047cd1796a51..0d3a9c5e8d26 100644
--- a/drivers/gpu/drm/mediatek/mtk_disp_ovl.c
+++ b/drivers/gpu/drm/mediatek/mtk_disp_ovl.c
@@ -481,16 +481,16 @@ void mtk_ovl_layer_config(struct device *dev, unsigned int idx,
 		 */
 		if (blend_mode || state->base.fb->format->has_alpha)
 			con |= OVL_CON_AEN;
-	}
 
-	/* CONST_BLD must be enabled for XRGB formats although the alpha channel
-	 * can be ignored, or OVL will still read the value from memory.
-	 * 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) ||
-	    blend_mode == DRM_MODE_BLEND_PIXEL_NONE)
-		ignore_pixel_alpha = OVL_CONST_BLEND;
+		/*
+		 * Although the alpha channel can be ignored, CONST_BLD must be enabled
+		 * for XRGB format, otherwise OVL will still read the value from memory.
+		 * 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 (blend_mode == DRM_MODE_BLEND_PIXEL_NONE || !state->base.fb->format->has_alpha)
+			ignore_pixel_alpha = OVL_CONST_BLEND;
+	}
 
 	if (pending->rotation & DRM_MODE_REFLECT_Y) {
 		con |= OVL_CON_VIRT_FLIP;
-- 
2.43.0



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

* [PATCH v10 3/5] drm/mediatek: ovl: Remove the color format comment for ovl_fmt_convert()
  2024-10-08  6:47 [PATCH v10 0/5] Fix degradation problem of alpha blending series Jason-JH.Lin
  2024-10-08  6:47 ` [PATCH v10 1/5] drm/mediatek: ovl: Fix XRGB format breakage for blend_modes unsupported SoCs Jason-JH.Lin
  2024-10-08  6:47 ` [PATCH v10 2/5] drm/mediatek: ovl: Refine ignore_pixel_alpha comment and placement Jason-JH.Lin
@ 2024-10-08  6:47 ` Jason-JH.Lin
  2024-10-08  6:47 ` [PATCH v10 4/5] drm/mediatek: ovl: Add blend_modes to driver data Jason-JH.Lin
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 17+ messages in thread
From: Jason-JH.Lin @ 2024-10-08  6:47 UTC (permalink / raw)
  To: Adam Thiede, Yassine Oudjana, Chun-Kuang Hu,
	AngeloGioacchino Del Regno
  Cc: Shawn Sung, Alper Nebi Yasak, dri-devel, linux-mediatek,
	linux-kernel, linux-arm-kernel, Jason-JH . Lin, Singo Chang,
	Nancy Lin, Project_Global_Chrome_Upstream_Group

Since we changed MACROs to be consistent with DRM input color format
naming, the comment for ovl_fmt_conver() is no longer needed.

Fixes: 9f428b95ac89 ("drm/mediatek: Add new color format MACROs in OVL")
Signed-off-by: Jason-JH.Lin <jason-jh.lin@mediatek.com>
Reviewed-by: CK Hu <ck.hu@mediatek.com>
---
 drivers/gpu/drm/mediatek/mtk_disp_ovl.c | 5 -----
 1 file changed, 5 deletions(-)

diff --git a/drivers/gpu/drm/mediatek/mtk_disp_ovl.c b/drivers/gpu/drm/mediatek/mtk_disp_ovl.c
index 0d3a9c5e8d26..1ccb700858cf 100644
--- a/drivers/gpu/drm/mediatek/mtk_disp_ovl.c
+++ b/drivers/gpu/drm/mediatek/mtk_disp_ovl.c
@@ -389,11 +389,6 @@ void mtk_ovl_layer_off(struct device *dev, unsigned int idx,
 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.
-	 * The alphabet order in XXX is no relation to data
-	 * arrangement in memory.
-	 */
 	switch (fmt) {
 	default:
 	case DRM_FORMAT_RGB565:
-- 
2.43.0



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

* [PATCH v10 4/5] drm/mediatek: ovl: Add blend_modes to driver data
  2024-10-08  6:47 [PATCH v10 0/5] Fix degradation problem of alpha blending series Jason-JH.Lin
                   ` (2 preceding siblings ...)
  2024-10-08  6:47 ` [PATCH v10 3/5] drm/mediatek: ovl: Remove the color format comment for ovl_fmt_convert() Jason-JH.Lin
@ 2024-10-08  6:47 ` Jason-JH.Lin
  2024-10-08  8:16   ` Markus Elfring
  2024-10-08  6:47 ` [PATCH v10 5/5] drm/mediatek: Add blend_modes to mtk_plane_init() for different SoCs Jason-JH.Lin
                   ` (2 subsequent siblings)
  6 siblings, 1 reply; 17+ messages in thread
From: Jason-JH.Lin @ 2024-10-08  6:47 UTC (permalink / raw)
  To: Adam Thiede, Yassine Oudjana, Chun-Kuang Hu,
	AngeloGioacchino Del Regno
  Cc: Shawn Sung, Alper Nebi Yasak, dri-devel, linux-mediatek,
	linux-kernel, linux-arm-kernel, Jason-JH . Lin, Singo Chang,
	Nancy Lin, Project_Global_Chrome_Upstream_Group

OVL_CON_CLRFMT_MAN is a configuration for extending color format
settings of DISP_REG_OVL_CON(n).
It will change some of the original color format settings.

Take the settings of (3 << 12) for example.
- If OVL_CON_CLRFMT_MAN = 0 means OVL_CON_CLRFMT_RGBA8888.
- If OVL_CON_CLRFMT_MAN = 1 means OVL_CON_CLRFMT_PARGB8888.

Since previous SoCs did not support OVL_CON_CLRFMT_MAN, this means
that the SoC does not support the premultiplied color format.
It will break the original color format setting of MT8173.

Therefore, the blend_modes is added to the driver data and then
mtk_ovl_fmt_convert() will check the blend_modes to see if
pre-multiplied is supported in the current platform.
If it is not supported, use coverage mode to set it to the supported
color formats to solve the degradation problem.

Fixes: a3f7f7ef4bfe ("drm/mediatek: Support "Pre-multiplied" blending in OVL")
Signed-off-by: Jason-JH.Lin <jason-jh.lin@mediatek.com>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Reviewed-by: CK Hu <ck.hu@mediatek.com>
---
 drivers/gpu/drm/mediatek/mtk_disp_ovl.c | 34 ++++++++++++++++++++++---
 1 file changed, 31 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/mediatek/mtk_disp_ovl.c b/drivers/gpu/drm/mediatek/mtk_disp_ovl.c
index 1ccb700858cf..fab23b1904bd 100644
--- a/drivers/gpu/drm/mediatek/mtk_disp_ovl.c
+++ b/drivers/gpu/drm/mediatek/mtk_disp_ovl.c
@@ -146,6 +146,7 @@ struct mtk_disp_ovl_data {
 	bool fmt_rgb565_is_0;
 	bool smi_id_en;
 	bool supports_afbc;
+	const u32 blend_modes;
 	const u32 *formats;
 	size_t num_formats;
 	bool supports_clrfmt_ext;
@@ -386,9 +387,27 @@ 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,
-				    unsigned int blend_mode)
+static unsigned int mtk_ovl_fmt_convert(struct mtk_disp_ovl *ovl,
+					struct mtk_plane_state *state)
 {
+	unsigned int fmt = state->pending.format;
+	unsigned int blend_mode = DRM_MODE_BLEND_COVERAGE;
+
+	/*
+	 * For the platforms where OVL_CON_CLRFMT_MAN is defined in the hardware data sheet
+	 * and supports premultiplied color formats, such as OVL_CON_CLRFMT_PARGB8888.
+	 *
+	 * Check blend_modes in the driver data to see if premultiplied mode is supported.
+	 * If not, use coverage mode instead to set it to the supported color formats.
+	 *
+	 * Current DRM assumption is that alpha is default premultiplied, so the bitmask of
+	 * blend_modes must include BIT(DRM_MODE_BLEND_PREMULTI). Otherwise, mtk_plane_init()
+	 * will get an error return from drm_plane_create_blend_mode_property() and
+	 * state->base.pixel_blend_mode should not be used.
+	 */
+	if (ovl->data->blend_modes & BIT(DRM_MODE_BLEND_PREMULTI))
+		blend_mode = state->base.pixel_blend_mode;
+
 	switch (fmt) {
 	default:
 	case DRM_FORMAT_RGB565:
@@ -466,7 +485,7 @@ void mtk_ovl_layer_config(struct device *dev, unsigned int idx,
 		return;
 	}
 
-	con = ovl_fmt_convert(ovl, fmt, blend_mode);
+	con = mtk_ovl_fmt_convert(ovl, state);
 	if (state->base.fb) {
 		con |= state->base.alpha & OVL_CON_ALPHA;
 
@@ -664,6 +683,9 @@ static const struct mtk_disp_ovl_data mt8192_ovl_driver_data = {
 	.layer_nr = 4,
 	.fmt_rgb565_is_0 = true,
 	.smi_id_en = true,
+	.blend_modes = BIT(DRM_MODE_BLEND_PREMULTI) |
+		       BIT(DRM_MODE_BLEND_COVERAGE) |
+		       BIT(DRM_MODE_BLEND_PIXEL_NONE),
 	.formats = mt8173_formats,
 	.num_formats = ARRAY_SIZE(mt8173_formats),
 };
@@ -674,6 +696,9 @@ static const struct mtk_disp_ovl_data mt8192_ovl_2l_driver_data = {
 	.layer_nr = 2,
 	.fmt_rgb565_is_0 = true,
 	.smi_id_en = true,
+	.blend_modes = BIT(DRM_MODE_BLEND_PREMULTI) |
+		       BIT(DRM_MODE_BLEND_COVERAGE) |
+		       BIT(DRM_MODE_BLEND_PIXEL_NONE),
 	.formats = mt8173_formats,
 	.num_formats = ARRAY_SIZE(mt8173_formats),
 };
@@ -685,6 +710,9 @@ static const struct mtk_disp_ovl_data mt8195_ovl_driver_data = {
 	.fmt_rgb565_is_0 = true,
 	.smi_id_en = true,
 	.supports_afbc = true,
+	.blend_modes = BIT(DRM_MODE_BLEND_PREMULTI) |
+		       BIT(DRM_MODE_BLEND_COVERAGE) |
+		       BIT(DRM_MODE_BLEND_PIXEL_NONE),
 	.formats = mt8195_formats,
 	.num_formats = ARRAY_SIZE(mt8195_formats),
 	.supports_clrfmt_ext = true,
-- 
2.43.0



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

* [PATCH v10 5/5] drm/mediatek: Add blend_modes to mtk_plane_init() for different SoCs
  2024-10-08  6:47 [PATCH v10 0/5] Fix degradation problem of alpha blending series Jason-JH.Lin
                   ` (3 preceding siblings ...)
  2024-10-08  6:47 ` [PATCH v10 4/5] drm/mediatek: ovl: Add blend_modes to driver data Jason-JH.Lin
@ 2024-10-08  6:47 ` Jason-JH.Lin
  2024-10-08  6:52 ` [PATCH v10 0/5] Fix degradation problem of alpha blending series Chen-Yu Tsai
  2024-10-08  7:33 ` Markus Elfring
  6 siblings, 0 replies; 17+ messages in thread
From: Jason-JH.Lin @ 2024-10-08  6:47 UTC (permalink / raw)
  To: Adam Thiede, Yassine Oudjana, Chun-Kuang Hu,
	AngeloGioacchino Del Regno
  Cc: Shawn Sung, Alper Nebi Yasak, dri-devel, linux-mediatek,
	linux-kernel, linux-arm-kernel, Jason-JH . Lin, Singo Chang,
	Nancy Lin, Project_Global_Chrome_Upstream_Group

Since some SoCs support premultiplied pixel formats but some do not,
the blend_modes parameter is added to mtk_plane_init(), which is
obtained from the mtk_ddp_comp_get_blend_modes function implemented
in different blending supported components.

The blending supported components can use driver data to set the
blend mode capabilities for different SoCs.

Signed-off-by: Jason-JH.Lin <jason-jh.lin@mediatek.com>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Reviewed-by: CK Hu <ck.hu@mediatek.com>
---
 drivers/gpu/drm/mediatek/mtk_crtc.c             |  1 +
 drivers/gpu/drm/mediatek/mtk_ddp_comp.c         |  2 ++
 drivers/gpu/drm/mediatek/mtk_ddp_comp.h         | 10 ++++++++++
 drivers/gpu/drm/mediatek/mtk_disp_drv.h         |  2 ++
 drivers/gpu/drm/mediatek/mtk_disp_ovl.c         |  7 +++++++
 drivers/gpu/drm/mediatek/mtk_disp_ovl_adaptor.c |  7 +++++++
 drivers/gpu/drm/mediatek/mtk_ethdr.c            |  7 +++++++
 drivers/gpu/drm/mediatek/mtk_ethdr.h            |  1 +
 drivers/gpu/drm/mediatek/mtk_plane.c            | 15 +++++++--------
 drivers/gpu/drm/mediatek/mtk_plane.h            |  4 ++--
 10 files changed, 46 insertions(+), 10 deletions(-)

diff --git a/drivers/gpu/drm/mediatek/mtk_crtc.c b/drivers/gpu/drm/mediatek/mtk_crtc.c
index 175b00e5a253..b65f196f2015 100644
--- a/drivers/gpu/drm/mediatek/mtk_crtc.c
+++ b/drivers/gpu/drm/mediatek/mtk_crtc.c
@@ -913,6 +913,7 @@ static int mtk_crtc_init_comp_planes(struct drm_device *drm_dev,
 				BIT(pipe),
 				mtk_crtc_plane_type(mtk_crtc->layer_nr, num_planes),
 				mtk_ddp_comp_supported_rotations(comp),
+				mtk_ddp_comp_get_blend_modes(comp),
 				mtk_ddp_comp_get_formats(comp),
 				mtk_ddp_comp_get_num_formats(comp), i);
 		if (ret)
diff --git a/drivers/gpu/drm/mediatek/mtk_ddp_comp.c b/drivers/gpu/drm/mediatek/mtk_ddp_comp.c
index be66d94be361..edc6417639e6 100644
--- a/drivers/gpu/drm/mediatek/mtk_ddp_comp.c
+++ b/drivers/gpu/drm/mediatek/mtk_ddp_comp.c
@@ -363,6 +363,7 @@ static const struct mtk_ddp_comp_funcs ddp_ovl = {
 	.layer_config = mtk_ovl_layer_config,
 	.bgclr_in_on = mtk_ovl_bgclr_in_on,
 	.bgclr_in_off = mtk_ovl_bgclr_in_off,
+	.get_blend_modes = mtk_ovl_get_blend_modes,
 	.get_formats = mtk_ovl_get_formats,
 	.get_num_formats = mtk_ovl_get_num_formats,
 };
@@ -416,6 +417,7 @@ static const struct mtk_ddp_comp_funcs ddp_ovl_adaptor = {
 	.disconnect = mtk_ovl_adaptor_disconnect,
 	.add = mtk_ovl_adaptor_add_comp,
 	.remove = mtk_ovl_adaptor_remove_comp,
+	.get_blend_modes = mtk_ovl_adaptor_get_blend_modes,
 	.get_formats = mtk_ovl_adaptor_get_formats,
 	.get_num_formats = mtk_ovl_adaptor_get_num_formats,
 	.mode_valid = mtk_ovl_adaptor_mode_valid,
diff --git a/drivers/gpu/drm/mediatek/mtk_ddp_comp.h b/drivers/gpu/drm/mediatek/mtk_ddp_comp.h
index ecf6dc283cd7..39720b27f4e9 100644
--- a/drivers/gpu/drm/mediatek/mtk_ddp_comp.h
+++ b/drivers/gpu/drm/mediatek/mtk_ddp_comp.h
@@ -80,6 +80,7 @@ struct mtk_ddp_comp_funcs {
 	void (*ctm_set)(struct device *dev,
 			struct drm_crtc_state *state);
 	struct device * (*dma_dev_get)(struct device *dev);
+	u32 (*get_blend_modes)(struct device *dev);
 	const u32 *(*get_formats)(struct device *dev);
 	size_t (*get_num_formats)(struct device *dev);
 	void (*connect)(struct device *dev, struct device *mmsys_dev, unsigned int next);
@@ -266,6 +267,15 @@ static inline struct device *mtk_ddp_comp_dma_dev_get(struct mtk_ddp_comp *comp)
 	return comp->dev;
 }
 
+static inline
+u32 mtk_ddp_comp_get_blend_modes(struct mtk_ddp_comp *comp)
+{
+	if (comp->funcs && comp->funcs->get_blend_modes)
+		return comp->funcs->get_blend_modes(comp->dev);
+
+	return 0;
+}
+
 static inline
 const u32 *mtk_ddp_comp_get_formats(struct mtk_ddp_comp *comp)
 {
diff --git a/drivers/gpu/drm/mediatek/mtk_disp_drv.h b/drivers/gpu/drm/mediatek/mtk_disp_drv.h
index 082ac18fe04a..04154db9085c 100644
--- a/drivers/gpu/drm/mediatek/mtk_disp_drv.h
+++ b/drivers/gpu/drm/mediatek/mtk_disp_drv.h
@@ -103,6 +103,7 @@ void mtk_ovl_register_vblank_cb(struct device *dev,
 void mtk_ovl_unregister_vblank_cb(struct device *dev);
 void mtk_ovl_enable_vblank(struct device *dev);
 void mtk_ovl_disable_vblank(struct device *dev);
+u32 mtk_ovl_get_blend_modes(struct device *dev);
 const u32 *mtk_ovl_get_formats(struct device *dev);
 size_t mtk_ovl_get_num_formats(struct device *dev);
 
@@ -131,6 +132,7 @@ void mtk_ovl_adaptor_start(struct device *dev);
 void mtk_ovl_adaptor_stop(struct device *dev);
 unsigned int mtk_ovl_adaptor_layer_nr(struct device *dev);
 struct device *mtk_ovl_adaptor_dma_dev_get(struct device *dev);
+u32 mtk_ovl_adaptor_get_blend_modes(struct device *dev);
 const u32 *mtk_ovl_adaptor_get_formats(struct device *dev);
 size_t mtk_ovl_adaptor_get_num_formats(struct device *dev);
 enum drm_mode_status mtk_ovl_adaptor_mode_valid(struct device *dev,
diff --git a/drivers/gpu/drm/mediatek/mtk_disp_ovl.c b/drivers/gpu/drm/mediatek/mtk_disp_ovl.c
index fab23b1904bd..9786ce94de0e 100644
--- a/drivers/gpu/drm/mediatek/mtk_disp_ovl.c
+++ b/drivers/gpu/drm/mediatek/mtk_disp_ovl.c
@@ -215,6 +215,13 @@ void mtk_ovl_disable_vblank(struct device *dev)
 	writel_relaxed(0x0, ovl->regs + DISP_REG_OVL_INTEN);
 }
 
+u32 mtk_ovl_get_blend_modes(struct device *dev)
+{
+	struct mtk_disp_ovl *ovl = dev_get_drvdata(dev);
+
+	return ovl->data->blend_modes;
+}
+
 const u32 *mtk_ovl_get_formats(struct device *dev)
 {
 	struct mtk_disp_ovl *ovl = dev_get_drvdata(dev);
diff --git a/drivers/gpu/drm/mediatek/mtk_disp_ovl_adaptor.c b/drivers/gpu/drm/mediatek/mtk_disp_ovl_adaptor.c
index c6768210b08b..bf2546c4681a 100644
--- a/drivers/gpu/drm/mediatek/mtk_disp_ovl_adaptor.c
+++ b/drivers/gpu/drm/mediatek/mtk_disp_ovl_adaptor.c
@@ -400,6 +400,13 @@ void mtk_ovl_adaptor_disable_vblank(struct device *dev)
 	mtk_ethdr_disable_vblank(ovl_adaptor->ovl_adaptor_comp[OVL_ADAPTOR_ETHDR0]);
 }
 
+u32 mtk_ovl_adaptor_get_blend_modes(struct device *dev)
+{
+	struct mtk_disp_ovl_adaptor *ovl_adaptor = dev_get_drvdata(dev);
+
+	return mtk_ethdr_get_blend_modes(ovl_adaptor->ovl_adaptor_comp[OVL_ADAPTOR_ETHDR0]);
+}
+
 const u32 *mtk_ovl_adaptor_get_formats(struct device *dev)
 {
 	struct mtk_disp_ovl_adaptor *ovl_adaptor = dev_get_drvdata(dev);
diff --git a/drivers/gpu/drm/mediatek/mtk_ethdr.c b/drivers/gpu/drm/mediatek/mtk_ethdr.c
index d1d9cf8b10e1..0f22e7d337cb 100644
--- a/drivers/gpu/drm/mediatek/mtk_ethdr.c
+++ b/drivers/gpu/drm/mediatek/mtk_ethdr.c
@@ -145,6 +145,13 @@ static irqreturn_t mtk_ethdr_irq_handler(int irq, void *dev_id)
 	return IRQ_HANDLED;
 }
 
+u32 mtk_ethdr_get_blend_modes(struct device *dev)
+{
+	return BIT(DRM_MODE_BLEND_PREMULTI) |
+	       BIT(DRM_MODE_BLEND_COVERAGE) |
+	       BIT(DRM_MODE_BLEND_PIXEL_NONE);
+}
+
 void mtk_ethdr_layer_config(struct device *dev, unsigned int idx,
 			    struct mtk_plane_state *state,
 			    struct cmdq_pkt *cmdq_pkt)
diff --git a/drivers/gpu/drm/mediatek/mtk_ethdr.h b/drivers/gpu/drm/mediatek/mtk_ethdr.h
index 81af9edea3f7..a72aeee46829 100644
--- a/drivers/gpu/drm/mediatek/mtk_ethdr.h
+++ b/drivers/gpu/drm/mediatek/mtk_ethdr.h
@@ -13,6 +13,7 @@ void mtk_ethdr_clk_disable(struct device *dev);
 void mtk_ethdr_config(struct device *dev, unsigned int w,
 		      unsigned int h, unsigned int vrefresh,
 		      unsigned int bpc, struct cmdq_pkt *cmdq_pkt);
+u32 mtk_ethdr_get_blend_modes(struct device *dev);
 void mtk_ethdr_layer_config(struct device *dev, unsigned int idx,
 			    struct mtk_plane_state *state,
 			    struct cmdq_pkt *cmdq_pkt);
diff --git a/drivers/gpu/drm/mediatek/mtk_plane.c b/drivers/gpu/drm/mediatek/mtk_plane.c
index 7d2cb4e0fafa..8a48b3b0a956 100644
--- a/drivers/gpu/drm/mediatek/mtk_plane.c
+++ b/drivers/gpu/drm/mediatek/mtk_plane.c
@@ -320,8 +320,8 @@ static const struct drm_plane_helper_funcs mtk_plane_helper_funcs = {
 
 int mtk_plane_init(struct drm_device *dev, struct drm_plane *plane,
 		   unsigned long possible_crtcs, enum drm_plane_type type,
-		   unsigned int supported_rotations, const u32 *formats,
-		   size_t num_formats, unsigned int plane_idx)
+		   unsigned int supported_rotations, const u32 blend_modes,
+		   const u32 *formats, size_t num_formats, unsigned int plane_idx)
 {
 	int err;
 
@@ -366,12 +366,11 @@ int mtk_plane_init(struct drm_device *dev, struct drm_plane *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");
+	if (blend_modes) {
+		err = drm_plane_create_blend_mode_property(plane, blend_modes);
+		if (err)
+			DRM_ERROR("failed to create property: blend_mode\n");
+	}
 
 	drm_plane_helper_add(plane, &mtk_plane_helper_funcs);
 
diff --git a/drivers/gpu/drm/mediatek/mtk_plane.h b/drivers/gpu/drm/mediatek/mtk_plane.h
index 5b177eac67b7..3b13b89989c7 100644
--- a/drivers/gpu/drm/mediatek/mtk_plane.h
+++ b/drivers/gpu/drm/mediatek/mtk_plane.h
@@ -48,6 +48,6 @@ to_mtk_plane_state(struct drm_plane_state *state)
 
 int mtk_plane_init(struct drm_device *dev, struct drm_plane *plane,
 		   unsigned long possible_crtcs, enum drm_plane_type type,
-		   unsigned int supported_rotations, const u32 *formats,
-		   size_t num_formats, unsigned int plane_idx);
+		   unsigned int supported_rotations, const u32 blend_modes,
+		   const u32 *formats, size_t num_formats, unsigned int plane_idx);
 #endif
-- 
2.43.0



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

* Re: [PATCH v10 0/5] Fix degradation problem of alpha blending series
  2024-10-08  6:47 [PATCH v10 0/5] Fix degradation problem of alpha blending series Jason-JH.Lin
                   ` (4 preceding siblings ...)
  2024-10-08  6:47 ` [PATCH v10 5/5] drm/mediatek: Add blend_modes to mtk_plane_init() for different SoCs Jason-JH.Lin
@ 2024-10-08  6:52 ` Chen-Yu Tsai
  2024-10-08  7:07   ` Jason-JH Lin (林睿祥)
  2024-10-08  7:33 ` Markus Elfring
  6 siblings, 1 reply; 17+ messages in thread
From: Chen-Yu Tsai @ 2024-10-08  6:52 UTC (permalink / raw)
  To: Jason-JH.Lin
  Cc: Adam Thiede, Yassine Oudjana, Chun-Kuang Hu,
	AngeloGioacchino Del Regno, Shawn Sung, Alper Nebi Yasak,
	dri-devel, linux-mediatek, linux-kernel, linux-arm-kernel,
	Singo Chang, Nancy Lin, Project_Global_Chrome_Upstream_Group

On Tue, Oct 8, 2024 at 2:47 PM Jason-JH.Lin <jason-jh.lin@mediatek.com> wrote:
>
> Some SoCs do not support the ignore_pixl_alpha flag, which breaks the
> XRGB8888 format. Some SoCs do not support pre-multiplied pixel formats
> and extending configuration of OVL pre-multiplied color formats,
> such as MT8173.
>
> Fix the SoC degradation problem by this sreies.

Tested-by: Chen-Yu Tsai <wenst@chromium.org>

> ---
>
> Change in v10:
> 1. Fix the commit message and comment for OVL_CON_AEN

Please carry tested-by tags from people for cosmetic changes such as this.

> Change in v9:
> 1. Add the fix patch for the XRGB8888 downgrade issue of MT8173
> 2. Add the refine patch for ignore_pixel_alpha statement
>
> Change in v8:
> Remove blend_modes for not supported pre-multiplied SoCs to fix the
> return error from drm_plane_create_blend_mode_property().
>
> Change in v7:
> 1. Add the remove color format comment patch for OVL
> 2. Fix warning: 'const' type qualifier on return type has no effect
>
> Chnage in v6:
> 1. Use blend_modes instead of function pointer in OVL
> 2. Use ethdr instead of mdp_rdma to get blend_modes
> 3. Add 0 checking for adding blend_mode property for mtk_plane
>
> Change in v5:
> Add fix patch for mtk_plane
>
> Change in v4:
> Add lost cases of mtk_ovl_fmt_convert_with_blend
>
> Change in v3:
> Change MACRO approach to function pointer in driver data
>
> Change in v2:
> Fix build error and typo
>
> Change in v1:
> Add fix patch for OVL unsupport color format settings by driver data
>
> ---
>
> Jason-JH.Lin (5):
>   drm/mediatek: ovl: Fix XRGB format breakage for blend_modes
>     unsupported SoCs
>   drm/mediatek: ovl: Refine ignore_pixel_alpha comment and placement
>   drm/mediatek: ovl: Remove the color format comment for
>     ovl_fmt_convert()
>   drm/mediatek: ovl: Add blend_modes to driver data
>   drm/mediatek: Add blend_modes to mtk_plane_init() for different SoCs
>
>  drivers/gpu/drm/mediatek/mtk_crtc.c           |  1 +
>  drivers/gpu/drm/mediatek/mtk_ddp_comp.c       |  2 +
>  drivers/gpu/drm/mediatek/mtk_ddp_comp.h       | 10 +++
>  drivers/gpu/drm/mediatek/mtk_disp_drv.h       |  2 +
>  drivers/gpu/drm/mediatek/mtk_disp_ovl.c       | 70 ++++++++++++++-----
>  .../gpu/drm/mediatek/mtk_disp_ovl_adaptor.c   |  7 ++
>  drivers/gpu/drm/mediatek/mtk_ethdr.c          |  7 ++
>  drivers/gpu/drm/mediatek/mtk_ethdr.h          |  1 +
>  drivers/gpu/drm/mediatek/mtk_plane.c          | 15 ++--
>  drivers/gpu/drm/mediatek/mtk_plane.h          |  4 +-
>  10 files changed, 92 insertions(+), 27 deletions(-)
>
> --
> 2.43.0
>


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

* Re: [PATCH v10 0/5] Fix degradation problem of alpha blending series
  2024-10-08  6:52 ` [PATCH v10 0/5] Fix degradation problem of alpha blending series Chen-Yu Tsai
@ 2024-10-08  7:07   ` Jason-JH Lin (林睿祥)
  2024-10-08  7:17     ` Chen-Yu Tsai
  0 siblings, 1 reply; 17+ messages in thread
From: Jason-JH Lin (林睿祥) @ 2024-10-08  7:07 UTC (permalink / raw)
  To: wens@kernel.org
  Cc: linux-mediatek@lists.infradead.org, linux-kernel@vger.kernel.org,
	alpernebiyasak@gmail.com, Singo Chang (張興國),
	chunkuang.hu@kernel.org, Shawn Sung (宋孝謙),
	Nancy Lin (林欣螢),
	dri-devel@lists.freedesktop.org,
	Project_Global_Chrome_Upstream_Group, yassine.oudjana@gmail.com,
	me@adamthiede.com, linux-arm-kernel@lists.infradead.org,
	AngeloGioacchino Del Regno

On Tue, 2024-10-08 at 14:52 +0800, Chen-Yu Tsai wrote:
>  	 
> External email : Please do not click links or open attachments until
> you have verified the sender or the content.
>  On Tue, Oct 8, 2024 at 2:47 PM Jason-JH.Lin <
> jason-jh.lin@mediatek.com> wrote:
> >
> > Some SoCs do not support the ignore_pixl_alpha flag, which breaks
> the
> > XRGB8888 format. Some SoCs do not support pre-multiplied pixel
> formats
> > and extending configuration of OVL pre-multiplied color formats,
> > such as MT8173.
> >
> > Fix the SoC degradation problem by this sreies.
> 
> Tested-by: Chen-Yu Tsai <wenst@chromium.org>
> 
> > ---
> >
> > Change in v10:
> > 1. Fix the commit message and comment for OVL_CON_AEN
> 
> Please carry tested-by tags from people for cosmetic changes such as
> this.
> 
OK, I'm sorry about that.

I thought the cover letter won't exist when the whole series go into
the Linux mainline tree.

But it still can be seen on the patchwork.
So I'll remember to do this next time. Thanks again!

Regards,
Jason-JH.Lin

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

* Re: [PATCH v10 0/5] Fix degradation problem of alpha blending series
  2024-10-08  7:07   ` Jason-JH Lin (林睿祥)
@ 2024-10-08  7:17     ` Chen-Yu Tsai
  0 siblings, 0 replies; 17+ messages in thread
From: Chen-Yu Tsai @ 2024-10-08  7:17 UTC (permalink / raw)
  To: Jason-JH Lin (林睿祥)
  Cc: wens@kernel.org, linux-mediatek@lists.infradead.org,
	linux-kernel@vger.kernel.org, alpernebiyasak@gmail.com,
	Singo Chang (張興國), chunkuang.hu@kernel.org,
	Shawn Sung (宋孝謙),
	Nancy Lin (林欣螢),
	dri-devel@lists.freedesktop.org,
	Project_Global_Chrome_Upstream_Group, yassine.oudjana@gmail.com,
	me@adamthiede.com, linux-arm-kernel@lists.infradead.org,
	AngeloGioacchino Del Regno

On Tue, Oct 8, 2024 at 3:07 PM Jason-JH Lin (林睿祥)
<Jason-JH.Lin@mediatek.com> wrote:
>
> On Tue, 2024-10-08 at 14:52 +0800, Chen-Yu Tsai wrote:
> >
> > External email : Please do not click links or open attachments until
> > you have verified the sender or the content.
> >  On Tue, Oct 8, 2024 at 2:47 PM Jason-JH.Lin <
> > jason-jh.lin@mediatek.com> wrote:
> > >
> > > Some SoCs do not support the ignore_pixl_alpha flag, which breaks
> > the
> > > XRGB8888 format. Some SoCs do not support pre-multiplied pixel
> > formats
> > > and extending configuration of OVL pre-multiplied color formats,
> > > such as MT8173.
> > >
> > > Fix the SoC degradation problem by this sreies.
> >
> > Tested-by: Chen-Yu Tsai <wenst@chromium.org>
> >
> > > ---
> > >
> > > Change in v10:
> > > 1. Fix the commit message and comment for OVL_CON_AEN
> >
> > Please carry tested-by tags from people for cosmetic changes such as
> > this.
> >
> OK, I'm sorry about that.
>
> I thought the cover letter won't exist when the whole series go into
> the Linux mainline tree.
>
> But it still can be seen on the patchwork.

Yes. It's simply because people are lazy and don't want to reply to every
patch. Then I guess the tools were changed to support this behavior. :D

> So I'll remember to do this next time. Thanks again!
>
> Regards,
> Jason-JH.Lin
>
> ************* MEDIATEK Confidentiality Notice ********************
> The information contained in this e-mail message (including any
> attachments) may be confidential, proprietary, privileged, or otherwise
> exempt from disclosure under applicable laws. It is intended to be
> conveyed only to the designated recipient(s). Any use, dissemination,
> distribution, printing, retaining or copying of this e-mail (including its
> attachments) by unintended recipient(s) is strictly prohibited and may
> be unlawful. If you are not an intended recipient of this e-mail, or believe
> that you have received this e-mail in error, please notify the sender
> immediately (by replying to this e-mail), delete any and all copies of
> this e-mail (including any attachments) from your system, and do not
> disclose the content of this e-mail to any other person. Thank you!


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

* Re: [PATCH v10 0/5] Fix degradation problem of alpha blending series
  2024-10-08  6:47 [PATCH v10 0/5] Fix degradation problem of alpha blending series Jason-JH.Lin
                   ` (5 preceding siblings ...)
  2024-10-08  6:52 ` [PATCH v10 0/5] Fix degradation problem of alpha blending series Chen-Yu Tsai
@ 2024-10-08  7:33 ` Markus Elfring
  2024-10-09  1:33   ` Jason-JH Lin (林睿祥)
  6 siblings, 1 reply; 17+ messages in thread
From: Markus Elfring @ 2024-10-08  7:33 UTC (permalink / raw)
  To: Jason-JH Lin (林睿祥),
	Project_Global_Chrome_Upstream_Group, linux-mediatek,
	linux-arm-kernel, dri-devel, Adam Thiede,
	Angelo Gioacchino Del Regno, Chun-Kuang Hu, Yassine Oudjana
  Cc: LKML, Alper Nebi Yasak, Hsiao Chien Sung, Nancy Lin, Singo Chang

…
> Fix the SoC degradation problem by this sreies.

                                          series?


Regards,
Markus


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

* Re: [PATCH v10 1/5] drm/mediatek: ovl: Fix XRGB format breakage for blend_modes unsupported SoCs
  2024-10-08  6:47 ` [PATCH v10 1/5] drm/mediatek: ovl: Fix XRGB format breakage for blend_modes unsupported SoCs Jason-JH.Lin
@ 2024-10-08  7:55   ` Markus Elfring
  2024-10-09  1:34     ` Jason-JH Lin (林睿祥)
  2024-10-09  3:22   ` CK Hu (胡俊光)
  1 sibling, 1 reply; 17+ messages in thread
From: Markus Elfring @ 2024-10-08  7:55 UTC (permalink / raw)
  To: Jason-JH Lin (林睿祥),
	Project_Global_Chrome_Upstream_Group, linux-mediatek,
	linux-arm-kernel, dri-devel, Adam Thiede,
	Angelo Gioacchino Del Regno, Chun-Kuang Hu, Yassine Oudjana
  Cc: LKML, Alper Nebi Yasak, Nancy Lin,
	Shawn Sung (宋孝謙), Singo Chang

…
> Note that ignore pixel alpha bit is not supported if the SoC is not
> supported the blend_modes.

  supporting the blending modes?


> So it will break the original setting of XRGB8888 foramt for the

                                                    format?


> Signed-off-by: Jason-JH.Lin <jason-jh.lin@mediatek.com>

Would a personal name without a dot be preferred
according to the Developer's Certificate of Origin?
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/submitting-patches.rst?h=v6.12-rc2#n396

Regards,
Markus


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

* Re: [PATCH v10 4/5] drm/mediatek: ovl: Add blend_modes to driver data
  2024-10-08  6:47 ` [PATCH v10 4/5] drm/mediatek: ovl: Add blend_modes to driver data Jason-JH.Lin
@ 2024-10-08  8:16   ` Markus Elfring
  2024-10-09  3:34     ` Jason-JH Lin (林睿祥)
  0 siblings, 1 reply; 17+ messages in thread
From: Markus Elfring @ 2024-10-08  8:16 UTC (permalink / raw)
  To: Jason-JH Lin (林睿祥),
	Project_Global_Chrome_Upstream_Group, linux-mediatek,
	linux-arm-kernel, dri-devel, Adam Thiede,
	Angelo Gioacchino Del Regno, Chun-Kuang Hu, Yassine Oudjana
  Cc: LKML, Alper Nebi Yasak, Nancy Lin,
	Shawn Sung (宋孝謙), Singo Chang

…
> pre-multiplied is supported in the current platform.
…

                format would be?


Regards,
Markus


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

* Re: [PATCH v10 0/5] Fix degradation problem of alpha blending series
  2024-10-08  7:33 ` Markus Elfring
@ 2024-10-09  1:33   ` Jason-JH Lin (林睿祥)
  0 siblings, 0 replies; 17+ messages in thread
From: Jason-JH Lin (林睿祥) @ 2024-10-09  1:33 UTC (permalink / raw)
  To: linux-mediatek@lists.infradead.org, chunkuang.hu@kernel.org,
	Markus.Elfring@web.de, dri-devel@lists.freedesktop.org,
	Project_Global_Chrome_Upstream_Group,
	linux-arm-kernel@lists.infradead.org, me@adamthiede.com,
	yassine.oudjana@gmail.com, AngeloGioacchino Del Regno
  Cc: linux-kernel@vger.kernel.org, alpernebiyasak@gmail.com,
	Shawn Sung (宋孝謙),
	Singo Chang (張興國),
	Nancy Lin (林欣螢)

On Tue, 2024-10-08 at 09:33 +0200, Markus Elfring wrote:
>  	 
> External email : Please do not click links or open attachments until
> you have verified the sender or the content.
>  …
> > Fix the SoC degradation problem by this sreies.
> 
>                                           series?

Thanks! I'll fix this typo at the next version.

Regards,
Jason-JH.Lin

> 
> 
> Regards,
> Markus

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

* Re: [PATCH v10 1/5] drm/mediatek: ovl: Fix XRGB format breakage for blend_modes unsupported SoCs
  2024-10-08  7:55   ` Markus Elfring
@ 2024-10-09  1:34     ` Jason-JH Lin (林睿祥)
  0 siblings, 0 replies; 17+ messages in thread
From: Jason-JH Lin (林睿祥) @ 2024-10-09  1:34 UTC (permalink / raw)
  To: linux-mediatek@lists.infradead.org, chunkuang.hu@kernel.org,
	Markus.Elfring@web.de, dri-devel@lists.freedesktop.org,
	Project_Global_Chrome_Upstream_Group,
	linux-arm-kernel@lists.infradead.org, me@adamthiede.com,
	yassine.oudjana@gmail.com, AngeloGioacchino Del Regno
  Cc: linux-kernel@vger.kernel.org, alpernebiyasak@gmail.com,
	Nancy Lin (林欣螢),
	Singo Chang (張興國),
	Shawn Sung (宋孝謙)

On Tue, 2024-10-08 at 09:55 +0200, Markus Elfring wrote:
>  	 
> External email : Please do not click links or open attachments until
> you have verified the sender or the content.
>  …
> > Note that ignore pixel alpha bit is not supported if the SoC is not
> > supported the blend_modes.
> 
>   supporting the blending modes?
> 
> 
> > So it will break the original setting of XRGB8888 foramt for the
> 
>                                                     format?

Thanks! I'll fix this typo at the next version.

Regards,
Jason-JH.Lin

> 
> 
> > Signed-off-by: Jason-JH.Lin <jason-jh.lin@mediatek.com>
> 
> Would a personal name without a dot be preferred
> according to the Developer's Certificate of Origin?
> 
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/submitting-patches.rst?h=v6.12-rc2#n396
> 
> Regards,
> Markus

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

* Re: [PATCH v10 1/5] drm/mediatek: ovl: Fix XRGB format breakage for blend_modes unsupported SoCs
  2024-10-08  6:47 ` [PATCH v10 1/5] drm/mediatek: ovl: Fix XRGB format breakage for blend_modes unsupported SoCs Jason-JH.Lin
  2024-10-08  7:55   ` Markus Elfring
@ 2024-10-09  3:22   ` CK Hu (胡俊光)
  1 sibling, 0 replies; 17+ messages in thread
From: CK Hu (胡俊光) @ 2024-10-09  3:22 UTC (permalink / raw)
  To: Jason-JH Lin (林睿祥), me@adamthiede.com,
	chunkuang.hu@kernel.org, yassine.oudjana@gmail.com,
	AngeloGioacchino Del Regno
  Cc: linux-mediatek@lists.infradead.org, linux-kernel@vger.kernel.org,
	alpernebiyasak@gmail.com, Singo Chang (張興國),
	Shawn Sung (宋孝謙),
	Nancy Lin (林欣螢),
	dri-devel@lists.freedesktop.org,
	Project_Global_Chrome_Upstream_Group,
	linux-arm-kernel@lists.infradead.org

Hi, Jason:

On Tue, 2024-10-08 at 14:47 +0800, Jason-JH.Lin wrote:
> OVL_CON_AEN is for alpha blending enable.
> For the SoC that is supported the blend_modes, OVL_CON_AEN will always
> enabled to use constant alpha and then use the ignore_pixel_alpha bit
> to do the alpha blending for XRGB8888 format.
> Note that ignore pixel alpha bit is not supported if the SoC is not
> supported the blend_modes.
> So it will break the original setting of XRGB8888 foramt for the
> blend_modes unsupported SoCs, such as MT8173.
> 
> To fix the downgrade issue, enable alpha blending only when a valid
> blend_mode or has_alpha is set.

After fixing the typo mentioned by Markus,

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

> 
> Fixes: bc46eb5d5d77 ("drm/mediatek: Support DRM plane alpha in OVL")
> Signed-off-by: Jason-JH.Lin <jason-jh.lin@mediatek.com>
> ---
>  drivers/gpu/drm/mediatek/mtk_disp_ovl.c | 8 +++++++-
>  1 file changed, 7 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/mediatek/mtk_disp_ovl.c b/drivers/gpu/drm/mediatek/mtk_disp_ovl.c
> index 89b439dcf3a6..047cd1796a51 100644
> --- a/drivers/gpu/drm/mediatek/mtk_disp_ovl.c
> +++ b/drivers/gpu/drm/mediatek/mtk_disp_ovl.c
> @@ -473,8 +473,14 @@ void mtk_ovl_layer_config(struct device *dev, unsigned int idx,
>  
>  	con = ovl_fmt_convert(ovl, fmt, blend_mode);
>  	if (state->base.fb) {
> -		con |= OVL_CON_AEN;
>  		con |= state->base.alpha & OVL_CON_ALPHA;
> +
> +		/*
> +		 * For blend_modes supported SoCs, always enable alpha blending.
> +		 * For blend_modes unsupported SoCs, enable alpha blending when has_alpha is set.
> +		 */
> +		if (blend_mode || state->base.fb->format->has_alpha)
> +			con |= OVL_CON_AEN;
>  	}
>  
>  	/* CONST_BLD must be enabled for XRGB formats although the alpha channel

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

* Re: [PATCH v10 4/5] drm/mediatek: ovl: Add blend_modes to driver data
  2024-10-08  8:16   ` Markus Elfring
@ 2024-10-09  3:34     ` Jason-JH Lin (林睿祥)
  2024-10-09  6:13       ` [v10 " Markus Elfring
  0 siblings, 1 reply; 17+ messages in thread
From: Jason-JH Lin (林睿祥) @ 2024-10-09  3:34 UTC (permalink / raw)
  To: linux-mediatek@lists.infradead.org, chunkuang.hu@kernel.org,
	Markus.Elfring@web.de, dri-devel@lists.freedesktop.org,
	Project_Global_Chrome_Upstream_Group,
	linux-arm-kernel@lists.infradead.org, me@adamthiede.com,
	yassine.oudjana@gmail.com, AngeloGioacchino Del Regno
  Cc: linux-kernel@vger.kernel.org, alpernebiyasak@gmail.com,
	Nancy Lin (林欣螢),
	Singo Chang (張興國),
	Shawn Sung (宋孝謙)

On Tue, 2024-10-08 at 10:16 +0200, Markus Elfring wrote:
>  	 
> External email : Please do not click links or open attachments until
> you have verified the sender or the content.
>  …
> > pre-multiplied is supported in the current platform.
> …
> 
>                 format would be?

Hi Markus,

blend_modes is the driver data that describes the supported blend mode
in current platform no matter format would be any one.

This sentence is describing mtk_ovl_fmt_convert() will check if the
blend_modes included BIT(DRM_MODE_BLEND_PREMULTI).

Regards,
Jason-JH.Lin

> 
> 
> Regards,
> Markus

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

* Re: [v10 4/5] drm/mediatek: ovl: Add blend_modes to driver data
  2024-10-09  3:34     ` Jason-JH Lin (林睿祥)
@ 2024-10-09  6:13       ` Markus Elfring
  0 siblings, 0 replies; 17+ messages in thread
From: Markus Elfring @ 2024-10-09  6:13 UTC (permalink / raw)
  To: Jason-JH Lin (林睿祥),
	Project_Global_Chrome_Upstream_Group, linux-mediatek,
	linux-arm-kernel, dri-devel, Adam Thiede,
	Angelo Gioacchino Del Regno, Chun-Kuang Hu, Yassine Oudjana
  Cc: LKML, Alper Nebi Yasak, Nancy Lin (林欣螢),
	Shawn Sung (宋孝謙),
	Singo Chang (張興國)

>>  …
>>> pre-multiplied is supported in the current platform.
>> …
>>
>>                 format would be?
> blend_modes is the driver data that describes the supported blend mode
> in current platform no matter format would be any one.
>
> This sentence is describing mtk_ovl_fmt_convert() will check if the
> blend_modes included BIT(DRM_MODE_BLEND_PREMULTI).
Do you see another opportunity to improve the change description
as I indicated?

Regards,
Markus


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

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

Thread overview: 17+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-08  6:47 [PATCH v10 0/5] Fix degradation problem of alpha blending series Jason-JH.Lin
2024-10-08  6:47 ` [PATCH v10 1/5] drm/mediatek: ovl: Fix XRGB format breakage for blend_modes unsupported SoCs Jason-JH.Lin
2024-10-08  7:55   ` Markus Elfring
2024-10-09  1:34     ` Jason-JH Lin (林睿祥)
2024-10-09  3:22   ` CK Hu (胡俊光)
2024-10-08  6:47 ` [PATCH v10 2/5] drm/mediatek: ovl: Refine ignore_pixel_alpha comment and placement Jason-JH.Lin
2024-10-08  6:47 ` [PATCH v10 3/5] drm/mediatek: ovl: Remove the color format comment for ovl_fmt_convert() Jason-JH.Lin
2024-10-08  6:47 ` [PATCH v10 4/5] drm/mediatek: ovl: Add blend_modes to driver data Jason-JH.Lin
2024-10-08  8:16   ` Markus Elfring
2024-10-09  3:34     ` Jason-JH Lin (林睿祥)
2024-10-09  6:13       ` [v10 " Markus Elfring
2024-10-08  6:47 ` [PATCH v10 5/5] drm/mediatek: Add blend_modes to mtk_plane_init() for different SoCs Jason-JH.Lin
2024-10-08  6:52 ` [PATCH v10 0/5] Fix degradation problem of alpha blending series Chen-Yu Tsai
2024-10-08  7:07   ` Jason-JH Lin (林睿祥)
2024-10-08  7:17     ` Chen-Yu Tsai
2024-10-08  7:33 ` Markus Elfring
2024-10-09  1:33   ` Jason-JH Lin (林睿祥)

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