[PATCH v2] drm/mediatek: ovl: Report coverage blending on older SoCs
From: Ryan Brue
Date: Mon Nov 23 2026 - 19:36:57 EST
Since commit 860e748bddcc ("drm: ensure blend mode supported if pixel
format with alpha exposed"), every OVL plane on MT2701, MT8167, MT8173
and MT8183 warns at boot:
[drm] [PLANE:37:plane-0] pixel format with alpha exposed but blend
mode not setup. Please fix.
These OVLs expose ARGB formats but don't have blend_modes in their driver
data, so no "pixel blend mode" property is created. They can't blend
premultiplied pixels: mtk_ovl_fmt_convert() always selects the
non-premultiplied color formats for them, which is the DRM "Coverage"
equation. Since commit 9813e158d13d ("drm/drm_blend: allow blend mode
property without PREMULTI") a coverage-only property is allowed, so
advertise it and drop the comment saying it couldn't be created.
The plane state then defaults to Coverage (1) instead of Pre-multiplied
(0), and mtk_ovl_layer_config() enables alpha blending for any non-zero
blend mode. On these SoCs that would set OVL_CON_AEN for XRGB formats
too, which they can't ignore the pixel alpha of, the breakage fixed by
commit 995d4d558eea ("drm/mediatek: ovl: Fix XRGB format breakage for
blend_modes unsupported SoCs"). Only look at the blend mode on SoCs that
support premultiplied blending, as mtk_ovl_fmt_convert() does, so these
SoCs keep enabling alpha blending for formats with alpha only.
Tested on MT8173 (Amazon Fire HD 10 2017). The warning is gone, every
plane reports a "pixel blend mode" of Coverage, and the OVL0 layer
registers are unchanged.
Signed-off-by: Ryan Brue <ryanbrue.dev@xxxxxxxxx>
---
Since 7.3, MT8173 and the other OVLs without premultiplied alpha log
"pixel format with alpha exposed but blend mode not setup" for every
plane at boot. They blend in coverage mode, and the blend mode helper
now accepts a coverage-only property, so this patch advertises that.
No register changes; tested on MT8173 (Amazon Fire HD 10 2017).
This patch was developed with the help of an LLM.
---
Changes in v2:
- Keep OVL_CON_AEN off for XRGB formats on the coverage-only SoCs: the
blend mode now defaults to Coverage (1), not 0, so only look at it
where premultiplied blending is supported (Sashiko).
- Correct the commit message, which said both defaults were non-zero.
- Link to v1: https://lore.kernel.org/r/20261120-rbrue-suez-mtk-ovl-coverage-v1-1-35040085fc37@xxxxxxxxx
---
drivers/gpu/drm/mediatek/mtk_disp_ovl.c | 20 +++++++++++---------
1 file changed, 11 insertions(+), 9 deletions(-)
diff --git a/drivers/gpu/drm/mediatek/mtk_disp_ovl.c b/drivers/gpu/drm/mediatek/mtk_disp_ovl.c
index 5445870716f9..efa19d02ccc1 100644
--- a/drivers/gpu/drm/mediatek/mtk_disp_ovl.c
+++ b/drivers/gpu/drm/mediatek/mtk_disp_ovl.c
@@ -412,12 +412,8 @@ static unsigned int mtk_ovl_fmt_convert(struct mtk_disp_ovl *ovl,
* 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 not, the hardware only blends in coverage mode, which is the only mode
+ * those platforms advertise.
*/
if (ovl->data->blend_modes & BIT(DRM_MODE_BLEND_PREMULTI))
blend_mode = state->base.pixel_blend_mode;
@@ -516,10 +512,11 @@ void mtk_ovl_layer_config(struct device *dev, unsigned int idx,
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.
+ * For SoCs supporting premultiplied blending, always enable alpha blending.
+ * For coverage-only SoCs, enable alpha blending when has_alpha is set.
*/
- if (blend_mode || state->base.fb->format->has_alpha)
+ if ((blend_mode && (ovl->data->blend_modes & BIT(DRM_MODE_BLEND_PREMULTI))) ||
+ state->base.fb->format->has_alpha)
con |= OVL_CON_AEN;
/*
@@ -667,6 +664,7 @@ static const struct mtk_disp_ovl_data mt2701_ovl_driver_data = {
.gmc_bits = 8,
.layer_nr = 4,
.fmt_rgb565_is_0 = false,
+ .blend_modes = BIT(DRM_MODE_BLEND_COVERAGE),
.formats = mt8173_formats,
.num_formats = ARRAY_SIZE(mt8173_formats),
};
@@ -677,6 +675,7 @@ static const struct mtk_disp_ovl_data mt8167_ovl_driver_data = {
.layer_nr = 4,
.fmt_rgb565_is_0 = true,
.smi_id_en = true,
+ .blend_modes = BIT(DRM_MODE_BLEND_COVERAGE),
.formats = mt8173_formats,
.num_formats = ARRAY_SIZE(mt8173_formats),
};
@@ -686,6 +685,7 @@ static const struct mtk_disp_ovl_data mt8173_ovl_driver_data = {
.gmc_bits = 8,
.layer_nr = 4,
.fmt_rgb565_is_0 = true,
+ .blend_modes = BIT(DRM_MODE_BLEND_COVERAGE),
.formats = mt8173_formats,
.num_formats = ARRAY_SIZE(mt8173_formats),
};
@@ -695,6 +695,7 @@ static const struct mtk_disp_ovl_data mt8183_ovl_driver_data = {
.gmc_bits = 10,
.layer_nr = 4,
.fmt_rgb565_is_0 = true,
+ .blend_modes = BIT(DRM_MODE_BLEND_COVERAGE),
.formats = mt8173_formats,
.num_formats = ARRAY_SIZE(mt8173_formats),
};
@@ -704,6 +705,7 @@ static const struct mtk_disp_ovl_data mt8183_ovl_2l_driver_data = {
.gmc_bits = 10,
.layer_nr = 2,
.fmt_rgb565_is_0 = true,
+ .blend_modes = BIT(DRM_MODE_BLEND_COVERAGE),
.formats = mt8173_formats,
.num_formats = ARRAY_SIZE(mt8173_formats),
};
---
base-commit: b6a9fa34ce4187cb69d3c588a4bbffc31ce5db8f
change-id: 20261118-rbrue-suez-mtk-ovl-coverage-198c11ba8b14
Best regards,
--
Ryan Brue <ryanbrue.dev@xxxxxxxxx>