* [PATCH RESEND] drm/sun4i: report coverage pixel blending for alpha-capable planes
@ 2026-11-17 9:19 Yang Siyuan
2026-11-17 16:35 ` Jernej Škrabec
0 siblings, 1 reply; 2+ messages in thread
From: Yang Siyuan @ 2026-11-17 9:19 UTC (permalink / raw)
To: Chen-Yu Tsai
Cc: Jernej Skrabec, Maarten Lankhorst, Maxime Ripard,
Thomas Zimmermann, Simona Vetter, Samuel Holland, dri-devel,
linux-arm-kernel, linux-sunxi, linux-kernel
Linux 7.3 added validate_blend_mode_for_alpha_formats(), which warns once
per plane that exposes a pixel format with an alpha channel but has no
blend mode property:
sun4i-drm display-engine: [drm] [PLANE:35:plane-0] pixel format with
alpha exposed but blend mode not setup. Please fix.
The mixer blends a layer using its own alpha channel: ALPHA_MODE is set
to PIXEL when plane alpha is opaque and to COMBINED otherwise, while
BLEND_PREMULTIPLY keeps its reset value. That is straight alpha, i.e. the
DRM "coverage" blending equation.
Advertise exactly DRM_MODE_BLEND_COVERAGE on every layer that can expose
an alpha format (UI always, VI on DE3 and later). This matches the
existing register programming, keeps userspace behaviour unchanged and
satisfies the new validation. Premultiplied blending would require
driving BLEND_PREMULTIPLY and is left as a follow-up.
Fixes: 860e748bddcc ("drm: ensure blend mode supported if pixel format with alpha exposed")
Signed-off-by: Yang Siyuan <hsyysy@163.com>
---
drivers/gpu/drm/sun4i/sun8i_ui_layer.c | 13 +++++++++++++
drivers/gpu/drm/sun4i/sun8i_vi_layer.c | 14 ++++++++++++++
2 files changed, 27 insertions(+)
diff --git a/drivers/gpu/drm/sun4i/sun8i_ui_layer.c b/drivers/gpu/drm/sun4i/sun8i_ui_layer.c
index 7d894e1eb..ef059ac47 100644
--- a/drivers/gpu/drm/sun4i/sun8i_ui_layer.c
+++ b/drivers/gpu/drm/sun4i/sun8i_ui_layer.c
@@ -283,6 +283,19 @@ struct sun8i_layer *sun8i_ui_layer_init_one(struct drm_device *drm,
return ERR_PTR(ret);
}
+ /*
+ * The mixer blends the layer using its own alpha channel with the
+ * pixels not premultiplied (BLEND_PREMULTIPLY keeps its reset value),
+ * which is the DRM "coverage" equation. Report it so that the blend
+ * mode validation in drm_mode_config_validate() is satisfied.
+ */
+ ret = drm_plane_create_blend_mode_property(&layer->plane,
+ BIT(DRM_MODE_BLEND_COVERAGE));
+ if (ret) {
+ dev_err(drm->dev, "Couldn't add blend mode property\n");
+ return ERR_PTR(ret);
+ }
+
ret = drm_plane_create_zpos_property(&layer->plane, index,
0, plane_cnt - 1);
if (ret) {
diff --git a/drivers/gpu/drm/sun4i/sun8i_vi_layer.c b/drivers/gpu/drm/sun4i/sun8i_vi_layer.c
index 92dd5a97f..b6771576b 100644
--- a/drivers/gpu/drm/sun4i/sun8i_vi_layer.c
+++ b/drivers/gpu/drm/sun4i/sun8i_vi_layer.c
@@ -470,6 +470,20 @@ struct sun8i_layer *sun8i_vi_layer_init_one(struct drm_device *drm,
}
}
+ /*
+ * Only DE3 and later expose pixel formats with an alpha channel, and
+ * the mixer blends them with straight alpha (coverage), same as the UI
+ * layer.
+ */
+ if (layer->cfg->de_type >= SUN8I_MIXER_DE3) {
+ ret = drm_plane_create_blend_mode_property(&layer->plane,
+ BIT(DRM_MODE_BLEND_COVERAGE));
+ if (ret) {
+ dev_err(drm->dev, "Couldn't add blend mode property\n");
+ return ERR_PTR(ret);
+ }
+ }
+
ret = drm_plane_create_zpos_property(&layer->plane, index,
0, plane_cnt - 1);
if (ret) {
base-commit: 091b06388b117fefdcb63336ac09956a4914b961
--
2.56.0
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: [PATCH RESEND] drm/sun4i: report coverage pixel blending for alpha-capable planes
2026-11-17 9:19 [PATCH RESEND] drm/sun4i: report coverage pixel blending for alpha-capable planes Yang Siyuan
@ 2026-11-17 16:35 ` Jernej Škrabec
0 siblings, 0 replies; 2+ messages in thread
From: Jernej Škrabec @ 2026-11-17 16:35 UTC (permalink / raw)
To: Chen-Yu Tsai, linux-sunxi
Cc: Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann,
Simona Vetter, Samuel Holland, dri-devel, linux-arm-kernel,
linux-sunxi, linux-kernel, Yang Siyuan
Dne torek, 17. november 2026 ob 10:19:32 Srednjeevropski standardni čas je Yang Siyuan napisal(a):
> Linux 7.3 added validate_blend_mode_for_alpha_formats(), which warns once
> per plane that exposes a pixel format with an alpha channel but has no
> blend mode property:
>
> sun4i-drm display-engine: [drm] [PLANE:35:plane-0] pixel format with
> alpha exposed but blend mode not setup. Please fix.
>
> The mixer blends a layer using its own alpha channel: ALPHA_MODE is set
> to PIXEL when plane alpha is opaque and to COMBINED otherwise, while
> BLEND_PREMULTIPLY keeps its reset value. That is straight alpha, i.e. the
> DRM "coverage" blending equation.
>
> Advertise exactly DRM_MODE_BLEND_COVERAGE on every layer that can expose
> an alpha format (UI always, VI on DE3 and later). This matches the
> existing register programming, keeps userspace behaviour unchanged and
> satisfies the new validation. Premultiplied blending would require
> driving BLEND_PREMULTIPLY and is left as a follow-up.
The subject says drm/sun4i, but the DE1 backend planes (sun4i_layer.c)
also expose ARGB8888/ARGB4444/ARGB1555 without a blend mode property, so
A10/A20/A31/A33 still trigger the warning. Either handle them in a separate
patch or say in the commit message that this one only covers the DE2+
mixer.
>
> Fixes: 860e748bddcc ("drm: ensure blend mode supported if pixel format with alpha exposed")
This is incorrect. That patch only added general check. Drop the tag.
> Signed-off-by: Yang Siyuan <hsyysy@163.com>
> ---
> drivers/gpu/drm/sun4i/sun8i_ui_layer.c | 13 +++++++++++++
> drivers/gpu/drm/sun4i/sun8i_vi_layer.c | 14 ++++++++++++++
> 2 files changed, 27 insertions(+)
>
> diff --git a/drivers/gpu/drm/sun4i/sun8i_ui_layer.c b/drivers/gpu/drm/sun4i/sun8i_ui_layer.c
> index 7d894e1eb..ef059ac47 100644
> --- a/drivers/gpu/drm/sun4i/sun8i_ui_layer.c
> +++ b/drivers/gpu/drm/sun4i/sun8i_ui_layer.c
> @@ -283,6 +283,19 @@ struct sun8i_layer *sun8i_ui_layer_init_one(struct drm_device *drm,
> return ERR_PTR(ret);
> }
>
> + /*
> + * The mixer blends the layer using its own alpha channel with the
> + * pixels not premultiplied (BLEND_PREMULTIPLY keeps its reset value),
> + * which is the DRM "coverage" equation. Report it so that the blend
> + * mode validation in drm_mode_config_validate() is satisfied.
> + */
Above comment doesn't add much value.
> + ret = drm_plane_create_blend_mode_property(&layer->plane,
> + BIT(DRM_MODE_BLEND_COVERAGE));
> + if (ret) {
> + dev_err(drm->dev, "Couldn't add blend mode property\n");
> + return ERR_PTR(ret);
> + }
> +
> ret = drm_plane_create_zpos_property(&layer->plane, index,
> 0, plane_cnt - 1);
> if (ret) {
> diff --git a/drivers/gpu/drm/sun4i/sun8i_vi_layer.c b/drivers/gpu/drm/sun4i/sun8i_vi_layer.c
> index 92dd5a97f..b6771576b 100644
> --- a/drivers/gpu/drm/sun4i/sun8i_vi_layer.c
> +++ b/drivers/gpu/drm/sun4i/sun8i_vi_layer.c
> @@ -470,6 +470,20 @@ struct sun8i_layer *sun8i_vi_layer_init_one(struct drm_device *drm,
> }
> }
>
> + /*
> + * Only DE3 and later expose pixel formats with an alpha channel, and
> + * the mixer blends them with straight alpha (coverage), same as the UI
> + * layer.
> + */
And neither this.
Best regards,
Jernej
> + if (layer->cfg->de_type >= SUN8I_MIXER_DE3) {
> + ret = drm_plane_create_blend_mode_property(&layer->plane,
> + BIT(DRM_MODE_BLEND_COVERAGE));
> + if (ret) {
> + dev_err(drm->dev, "Couldn't add blend mode property\n");
> + return ERR_PTR(ret);
> + }
> + }
> +
> ret = drm_plane_create_zpos_property(&layer->plane, index,
> 0, plane_cnt - 1);
> if (ret) {
> base-commit: 091b06388b117fefdcb63336ac09956a4914b961
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-11-17 16:35 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-17 9:19 [PATCH RESEND] drm/sun4i: report coverage pixel blending for alpha-capable planes Yang Siyuan
2026-11-17 16:35 ` Jernej Škrabec
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®