* [PATCH v2 0/4] drm: zynqmp: Make the video plane primary
@ 2026-01-06 16:42 Sean Anderson
2026-01-06 16:42 ` [PATCH v2 1/4] drm/drm_blend: Allow specifying blend mode default Sean Anderson
` (4 more replies)
0 siblings, 5 replies; 6+ messages in thread
From: Sean Anderson @ 2026-01-06 16:42 UTC (permalink / raw)
To: Laurent Pinchart, Tomi Valkeinen, dri-devel
Cc: Simona Vetter, Thomas Zimmermann, linux-kernel, Maxime Ripard,
David Airlie, linux-arm-kernel, Michal Simek, Anatoliy Klymenko,
Maarten Lankhorst, Mike Looijmans, Sean Anderson
The graphics plane does not support XRGB8888, which is the default mode
X uses for 24-bit color. Because of this, X must be set to use 16-bit
color, which has a measurable performance penalty. Make the video plane
the primary plane as it natively supports XRGB8888. An alternative
approach to add XRGB8888 to the graphics plane is discussed in [1], as
well as in patch 2.
[1] https://lore.kernel.org/dri-devel/20250627145058.6880-1-mike.looijmans@topic.nl/
Changes in v2:
- Allow specifying blend mode default
- Advertise coverage instead of premulti, since that's what the hardware
supports.
- Set default blend mode to none since that's what the default was
before this series.
Sean Anderson (4):
drm/drm_blend: Allow specifying blend mode default
drm: zynqmp: Check property creation status
drm: zynqmp: Make the video plane primary
drm: zynqmp: Add blend mode property to graphics plane
drivers/gpu/drm/drm_blend.c | 22 ++++++-------
drivers/gpu/drm/xlnx/zynqmp_kms.c | 53 +++++++++++++++++++++++++------
include/drm/drm_blend.h | 26 +++++++++++++--
3 files changed, 78 insertions(+), 23 deletions(-)
--
2.35.1.1320.gc452695387.dirty
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH v2 1/4] drm/drm_blend: Allow specifying blend mode default
2026-01-06 16:42 [PATCH v2 0/4] drm: zynqmp: Make the video plane primary Sean Anderson
@ 2026-01-06 16:42 ` Sean Anderson
2026-01-06 16:42 ` [PATCH v2 2/4] drm: zynqmp: Check property creation status Sean Anderson
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Sean Anderson @ 2026-01-06 16:42 UTC (permalink / raw)
To: Laurent Pinchart, Tomi Valkeinen, dri-devel
Cc: Simona Vetter, Thomas Zimmermann, linux-kernel, Maxime Ripard,
David Airlie, linux-arm-kernel, Michal Simek, Anatoliy Klymenko,
Maarten Lankhorst, Mike Looijmans, Sean Anderson
Not all devices support pre-multiplied blend mode. In these cases,
userspace cannot expect this mode to be the default, since the hardware
cannot produce it (and could not default to it before a blend mode
property existed). Therefore, add a variant of
drm_plane_create_blend_mode_property that allows specifying the default.
Signed-off-by: Sean Anderson <sean.anderson@linux.dev>
---
Changes in v2:
- New
drivers/gpu/drm/drm_blend.c | 22 ++++++++++------------
include/drm/drm_blend.h | 26 ++++++++++++++++++++++++--
2 files changed, 34 insertions(+), 14 deletions(-)
diff --git a/drivers/gpu/drm/drm_blend.c b/drivers/gpu/drm/drm_blend.c
index 6852d73c931c..fac0f1478385 100644
--- a/drivers/gpu/drm/drm_blend.c
+++ b/drivers/gpu/drm/drm_blend.c
@@ -546,12 +546,10 @@ int drm_atomic_normalize_zpos(struct drm_device *dev,
EXPORT_SYMBOL(drm_atomic_normalize_zpos);
/**
- * drm_plane_create_blend_mode_property - create a new blend mode property
+ * drm_plane_create_blend_mode_default - create a new blend mode property
* @plane: drm plane
- * @supported_modes: bitmask of supported modes, must include
- * BIT(DRM_MODE_BLEND_PREMULTI). Current DRM assumption is
- * that alpha is premultiplied, and old userspace can break if
- * the property defaults to anything else.
+ * @supported_modes: bitmask of supported modes, must include BIT(@def)
+ * @def: Default blend mode
*
* This creates a new property describing the blend mode.
*
@@ -571,11 +569,11 @@ EXPORT_SYMBOL(drm_atomic_normalize_zpos);
* pre-multiplied and will do so when blending them to the background color
* values.
*
- * RETURNS:
- * Zero for success or -errno
+ * Return: Zero for success or -errno
*/
-int drm_plane_create_blend_mode_property(struct drm_plane *plane,
- unsigned int supported_modes)
+int drm_plane_create_blend_mode_default(struct drm_plane *plane,
+ unsigned int supported_modes,
+ unsigned int def)
{
struct drm_device *dev = plane->dev;
struct drm_property *prop;
@@ -590,7 +588,7 @@ int drm_plane_create_blend_mode_property(struct drm_plane *plane,
int i;
if (WARN_ON((supported_modes & ~valid_mode_mask) ||
- ((supported_modes & BIT(DRM_MODE_BLEND_PREMULTI)) == 0)))
+ !(supported_modes & BIT(def))))
return -EINVAL;
prop = drm_property_create(dev, DRM_MODE_PROP_ENUM,
@@ -615,9 +613,9 @@ int drm_plane_create_blend_mode_property(struct drm_plane *plane,
}
}
- drm_object_attach_property(&plane->base, prop, DRM_MODE_BLEND_PREMULTI);
+ drm_object_attach_property(&plane->base, prop, def);
plane->blend_mode_property = prop;
return 0;
}
-EXPORT_SYMBOL(drm_plane_create_blend_mode_property);
+EXPORT_SYMBOL(drm_plane_create_blend_mode_default);
diff --git a/include/drm/drm_blend.h b/include/drm/drm_blend.h
index 88bdfec3bd88..244f0694d0a5 100644
--- a/include/drm/drm_blend.h
+++ b/include/drm/drm_blend.h
@@ -56,6 +56,28 @@ int drm_plane_create_zpos_immutable_property(struct drm_plane *plane,
unsigned int zpos);
int drm_atomic_normalize_zpos(struct drm_device *dev,
struct drm_atomic_state *state);
-int drm_plane_create_blend_mode_property(struct drm_plane *plane,
- unsigned int supported_modes);
+int drm_plane_create_blend_mode_default(struct drm_plane *plane,
+ unsigned int supported_modes,
+ unsigned int def);
+
+/**
+ * drm_plane_create_blend_mode_property - create a new blend mode property
+ * @plane: drm plane
+ * @supported_modes: bitmask of supported modes, must include
+ * BIT(DRM_MODE_BLEND_PREMULTI). Current DRM assumption is
+ * that alpha is premultiplied, and old userspace can break if
+ * the property defaults to anything else.
+ *
+ * This creates a new property describing the blend mode. See
+ * drm_plane_create_blend_mode_default() for details.
+ *
+ * Return: Zero for success or -errno
+ */
+static inline int
+drm_plane_create_blend_mode_property(struct drm_plane *plane,
+ unsigned int supported_modes)
+{
+ return drm_plane_create_blend_mode_default(plane, supported_modes,
+ DRM_MODE_BLEND_PREMULTI);
+}
#endif
--
2.35.1.1320.gc452695387.dirty
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH v2 2/4] drm: zynqmp: Check property creation status
2026-01-06 16:42 [PATCH v2 0/4] drm: zynqmp: Make the video plane primary Sean Anderson
2026-01-06 16:42 ` [PATCH v2 1/4] drm/drm_blend: Allow specifying blend mode default Sean Anderson
@ 2026-01-06 16:42 ` Sean Anderson
2026-01-06 16:42 ` [PATCH v2 3/4] drm: zynqmp: Make the video plane primary Sean Anderson
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Sean Anderson @ 2026-01-06 16:42 UTC (permalink / raw)
To: Laurent Pinchart, Tomi Valkeinen, dri-devel
Cc: Simona Vetter, Thomas Zimmermann, linux-kernel, Maxime Ripard,
David Airlie, linux-arm-kernel, Michal Simek, Anatoliy Klymenko,
Maarten Lankhorst, Mike Looijmans, Sean Anderson
Make sure to return an error in the event that we can't create our
properties.
Fixes: 650f12042b85 ("drm: xlnx: zynqmp_dpsub: Add global alpha support")
Fixes: 8c772f0b2b8e ("drm: xlnx: zynqmp_dpsub: Expose plane ordering to userspace")
Signed-off-by: Sean Anderson <sean.anderson@linux.dev>
Reviewed-by: Anatoliy Klymenko <anatoliy.klymenko@amd.com>
Reviewed-by: Thomas Zimmermann <tzimmermann@suse.de>
---
(no changes since v1)
drivers/gpu/drm/xlnx/zynqmp_kms.c | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/drivers/gpu/drm/xlnx/zynqmp_kms.c b/drivers/gpu/drm/xlnx/zynqmp_kms.c
index 02f3a7d78cf8..816bea4ea986 100644
--- a/drivers/gpu/drm/xlnx/zynqmp_kms.c
+++ b/drivers/gpu/drm/xlnx/zynqmp_kms.c
@@ -175,9 +175,15 @@ static int zynqmp_dpsub_create_planes(struct zynqmp_dpsub *dpsub)
drm_plane_helper_add(plane, &zynqmp_dpsub_plane_helper_funcs);
- drm_plane_create_zpos_immutable_property(plane, i);
- if (i == ZYNQMP_DPSUB_LAYER_GFX)
- drm_plane_create_alpha_property(plane);
+ ret = drm_plane_create_zpos_immutable_property(plane, i);
+ if (ret)
+ return ret;
+
+ if (i == ZYNQMP_DPSUB_LAYER_GFX) {
+ ret = drm_plane_create_alpha_property(plane);
+ if (ret)
+ return ret;
+ }
}
return 0;
--
2.35.1.1320.gc452695387.dirty
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH v2 3/4] drm: zynqmp: Make the video plane primary
2026-01-06 16:42 [PATCH v2 0/4] drm: zynqmp: Make the video plane primary Sean Anderson
2026-01-06 16:42 ` [PATCH v2 1/4] drm/drm_blend: Allow specifying blend mode default Sean Anderson
2026-01-06 16:42 ` [PATCH v2 2/4] drm: zynqmp: Check property creation status Sean Anderson
@ 2026-01-06 16:42 ` Sean Anderson
2026-01-06 16:42 ` [PATCH v2 4/4] drm: zynqmp: Add blend mode property to graphics plane Sean Anderson
2026-01-22 13:48 ` [PATCH v2 0/4] drm: zynqmp: Make the video plane primary Tomi Valkeinen
4 siblings, 0 replies; 6+ messages in thread
From: Sean Anderson @ 2026-01-06 16:42 UTC (permalink / raw)
To: Laurent Pinchart, Tomi Valkeinen, dri-devel
Cc: Simona Vetter, Thomas Zimmermann, linux-kernel, Maxime Ripard,
David Airlie, linux-arm-kernel, Michal Simek, Anatoliy Klymenko,
Maarten Lankhorst, Mike Looijmans, Sean Anderson
The zynqmp has two planes: "video" and "graphics". The video plane
- Is on the bottom (zpos=0) (except when chroma keying as the master plane)
- Supports "live" input (e.g. from an external source)
- Supports RGB, YUV, and YCbCr formats, including XRGB8888
- Does not support transparency, except via chroma keying (colorkey)
- Must cover the entire screen (translation/resizing not supported)
The graphics plane
- Is on the top (zpos=1)
- Supports "live" input (e.g. from an external source)
- Supports RGB and YUV444 formats, but not XRGB8888
- Supports transparency either via
- Global alpha channel, which disables per-pixel alpha when enabled
- Per-pixel alpha, which cannot be used with global alpha
- Chroma keying (colorkey)
- Must cover the entire screen (translation/resizing not supported)
Currently the graphics plane is the primary plane. Make the video plane
the primary plane:
- The video plane supports XRGB8888, which is the default 24-bit
colorspace for X. This results in improved performance when compared
to RGB565.
- The graphics plane can be used as an overlay because it has a higher
z-pos and supports a per-pixel alpha channel. Unfortunately, clients
like weston cannot currently take advantage of this because they
expect overlay planes to support translation/resizing.
One downside to this approach could be that the graphics plane has worse
support for YUV and YCBCr, so it may be more difficult to compose video
streams into the window of a media player. However, no existing software
could rely on this because there is no way to enable the per-pixel alpha
channel when the graphics plane is enabled. This makes it impossible to
"carve out" an area in the graphics plane where the video plane shows
through. This limitation is addressed in the next patch, but it means we
do not need to worry about compatibility in this area.
An alternate approach could be to pretend that the graphics plane
supports XRGB8888 by using the supported ARGB8888 mode instead and
enabling the global alpha channel. However, this would rule out ever
using the per-pixel alpha channel.
Signed-off-by: Sean Anderson <sean.anderson@linux.dev>
---
(no changes since v1)
drivers/gpu/drm/xlnx/zynqmp_kms.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/gpu/drm/xlnx/zynqmp_kms.c b/drivers/gpu/drm/xlnx/zynqmp_kms.c
index 816bea4ea986..284acb23c53e 100644
--- a/drivers/gpu/drm/xlnx/zynqmp_kms.c
+++ b/drivers/gpu/drm/xlnx/zynqmp_kms.c
@@ -162,8 +162,8 @@ static int zynqmp_dpsub_create_planes(struct zynqmp_dpsub *dpsub)
if (!formats)
return -ENOMEM;
- /* Graphics layer is primary, and video layer is overlay. */
- type = i == ZYNQMP_DPSUB_LAYER_VID
+ /* Graphics layer is overlay, and video layer is primary. */
+ type = i == ZYNQMP_DPSUB_LAYER_GFX
? DRM_PLANE_TYPE_OVERLAY : DRM_PLANE_TYPE_PRIMARY;
ret = drm_universal_plane_init(&dpsub->drm->dev, plane, 0,
&zynqmp_dpsub_plane_funcs,
@@ -323,7 +323,7 @@ static const struct drm_crtc_funcs zynqmp_dpsub_crtc_funcs = {
static int zynqmp_dpsub_create_crtc(struct zynqmp_dpsub *dpsub)
{
- struct drm_plane *plane = &dpsub->drm->planes[ZYNQMP_DPSUB_LAYER_GFX];
+ struct drm_plane *plane = &dpsub->drm->planes[ZYNQMP_DPSUB_LAYER_VID];
struct drm_crtc *crtc = &dpsub->drm->crtc;
int ret;
--
2.35.1.1320.gc452695387.dirty
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH v2 4/4] drm: zynqmp: Add blend mode property to graphics plane
2026-01-06 16:42 [PATCH v2 0/4] drm: zynqmp: Make the video plane primary Sean Anderson
` (2 preceding siblings ...)
2026-01-06 16:42 ` [PATCH v2 3/4] drm: zynqmp: Make the video plane primary Sean Anderson
@ 2026-01-06 16:42 ` Sean Anderson
2026-01-22 13:48 ` [PATCH v2 0/4] drm: zynqmp: Make the video plane primary Tomi Valkeinen
4 siblings, 0 replies; 6+ messages in thread
From: Sean Anderson @ 2026-01-06 16:42 UTC (permalink / raw)
To: Laurent Pinchart, Tomi Valkeinen, dri-devel
Cc: Simona Vetter, Thomas Zimmermann, linux-kernel, Maxime Ripard,
David Airlie, linux-arm-kernel, Michal Simek, Anatoliy Klymenko,
Maarten Lankhorst, Mike Looijmans, Sean Anderson
When global alpha is enabled, per-pixel alpha is ignored. Allow
userspace to explicitly specify whether to use per-pixel alpha by
exposing it through the blend mode property. The reference manual
doesn't say whether the per-pixel alpha is pre-multiplied or not, but
Anatoliy created a test case that shows alpha is not pre-multiplied [1].
By default alpha is disabled, since this matches the behavior before
this patch.
[1] https://lore.kernel.org/dri-devel/MW4PR12MB7165CDDB17CF0855EA19AACDE6A6A@MW4PR12MB7165.namprd12.prod.outlook.com/
Signed-off-by: Sean Anderson <sean.anderson@linux.dev>
---
Changes in v2:
- Advertise coverage instead of premulti, since that's what the hardware
supports.
- Set default blend mode to none since that's what the default was
before this series.
drivers/gpu/drm/xlnx/zynqmp_kms.c | 35 ++++++++++++++++++++++++++++---
1 file changed, 32 insertions(+), 3 deletions(-)
diff --git a/drivers/gpu/drm/xlnx/zynqmp_kms.c b/drivers/gpu/drm/xlnx/zynqmp_kms.c
index 284acb23c53e..aadba00921c1 100644
--- a/drivers/gpu/drm/xlnx/zynqmp_kms.c
+++ b/drivers/gpu/drm/xlnx/zynqmp_kms.c
@@ -62,6 +62,13 @@ static int zynqmp_dpsub_plane_atomic_check(struct drm_plane *plane,
if (!new_plane_state->crtc)
return 0;
+ if (new_plane_state->pixel_blend_mode != DRM_MODE_BLEND_PIXEL_NONE &&
+ new_plane_state->alpha >> 8 != 0xff) {
+ drm_dbg_kms(plane->dev,
+ "Plane alpha must be 1.0 when using pixel alpha\n");
+ return -EINVAL;
+ }
+
crtc_state = drm_atomic_get_crtc_state(state, new_plane_state->crtc);
if (IS_ERR(crtc_state))
return PTR_ERR(crtc_state);
@@ -118,9 +125,13 @@ static void zynqmp_dpsub_plane_atomic_update(struct drm_plane *plane,
zynqmp_disp_layer_update(layer, new_state);
- if (plane->index == ZYNQMP_DPSUB_LAYER_GFX)
- zynqmp_disp_blend_set_global_alpha(dpsub->disp, true,
+ if (plane->index == ZYNQMP_DPSUB_LAYER_GFX) {
+ bool blend = plane->state->pixel_blend_mode ==
+ DRM_MODE_BLEND_PIXEL_NONE;
+
+ zynqmp_disp_blend_set_global_alpha(dpsub->disp, blend,
plane->state->alpha >> 8);
+ }
/*
* Unconditionally enable the layer, as it may have been disabled
@@ -137,11 +148,18 @@ static const struct drm_plane_helper_funcs zynqmp_dpsub_plane_helper_funcs = {
.atomic_disable = zynqmp_dpsub_plane_atomic_disable,
};
+void zynqmp_dpsub_plane_atomic_reset(struct drm_plane *plane)
+{
+ drm_atomic_helper_plane_reset(plane);
+ if (plane->state)
+ plane->state->pixel_blend_mode = DRM_MODE_BLEND_PIXEL_NONE;
+}
+
static const struct drm_plane_funcs zynqmp_dpsub_plane_funcs = {
.update_plane = drm_atomic_helper_update_plane,
.disable_plane = drm_atomic_helper_disable_plane,
.destroy = drm_plane_cleanup,
- .reset = drm_atomic_helper_plane_reset,
+ .reset = zynqmp_dpsub_plane_atomic_reset,
.atomic_duplicate_state = drm_atomic_helper_plane_duplicate_state,
.atomic_destroy_state = drm_atomic_helper_plane_destroy_state,
};
@@ -180,9 +198,20 @@ static int zynqmp_dpsub_create_planes(struct zynqmp_dpsub *dpsub)
return ret;
if (i == ZYNQMP_DPSUB_LAYER_GFX) {
+ unsigned int blend_modes =
+ BIT(DRM_MODE_BLEND_PIXEL_NONE) |
+ BIT(DRM_MODE_BLEND_COVERAGE);
+ unsigned int def = DRM_MODE_BLEND_COVERAGE;
+
ret = drm_plane_create_alpha_property(plane);
if (ret)
return ret;
+
+ ret = drm_plane_create_blend_mode_default(plane,
+ blend_modes,
+ def);
+ if (ret)
+ return ret;
}
}
--
2.35.1.1320.gc452695387.dirty
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH v2 0/4] drm: zynqmp: Make the video plane primary
2026-01-06 16:42 [PATCH v2 0/4] drm: zynqmp: Make the video plane primary Sean Anderson
` (3 preceding siblings ...)
2026-01-06 16:42 ` [PATCH v2 4/4] drm: zynqmp: Add blend mode property to graphics plane Sean Anderson
@ 2026-01-22 13:48 ` Tomi Valkeinen
4 siblings, 0 replies; 6+ messages in thread
From: Tomi Valkeinen @ 2026-01-22 13:48 UTC (permalink / raw)
To: Sean Anderson, Laurent Pinchart, dri-devel
Cc: Simona Vetter, Thomas Zimmermann, linux-kernel, Maxime Ripard,
David Airlie, linux-arm-kernel, Michal Simek, Anatoliy Klymenko,
Maarten Lankhorst, Mike Looijmans
Hi,
On 06/01/2026 18:42, Sean Anderson wrote:
> The graphics plane does not support XRGB8888, which is the default mode
> X uses for 24-bit color. Because of this, X must be set to use 16-bit
> color, which has a measurable performance penalty. Make the video plane
> the primary plane as it natively supports XRGB8888. An alternative
> approach to add XRGB8888 to the graphics plane is discussed in [1], as
> well as in patch 2.
>
> [1] https://lore.kernel.org/dri-devel/20250627145058.6880-1-mike.looijmans@topic.nl/
>
> Changes in v2:
> - Allow specifying blend mode default
> - Advertise coverage instead of premulti, since that's what the hardware
> supports.
> - Set default blend mode to none since that's what the default was
> before this series.
>
> Sean Anderson (4):
> drm/drm_blend: Allow specifying blend mode default
> drm: zynqmp: Check property creation status
> drm: zynqmp: Make the video plane primary
> drm: zynqmp: Add blend mode property to graphics plane
>
> drivers/gpu/drm/drm_blend.c | 22 ++++++-------
> drivers/gpu/drm/xlnx/zynqmp_kms.c | 53 +++++++++++++++++++++++++------
> include/drm/drm_blend.h | 26 +++++++++++++--
> 3 files changed, 78 insertions(+), 23 deletions(-)
>
I think the series looks fine, but there's still the main question of
whether making video plane primary is the best choice. I'll summarize my
understanding of our two options here:
1) Make video plane primary plane, and thus graphics plane an overlay
plane. The downside here is that, at least to me, the plane types feel
like they are the wrong way around, and any existing code that depends
on the plane type may start to fail. That said, the plane type is
supposed to be a legacy thing, and a modern userspace should just look
at the plane properties to decide how to use them (which raises the
question of why is X/Weston even failing).
2) Add XRGB format to the graphics plane. This should work fine too, as
long as we make sure using XRGB with per-pixel alpha will fail (i.e.
only global alpha supported with XRGB). Afaics that could be done with a
check in atomic_check.
Does anyone have strong arguments for either of these options?
Tomi
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2026-01-22 13:48 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-01-06 16:42 [PATCH v2 0/4] drm: zynqmp: Make the video plane primary Sean Anderson
2026-01-06 16:42 ` [PATCH v2 1/4] drm/drm_blend: Allow specifying blend mode default Sean Anderson
2026-01-06 16:42 ` [PATCH v2 2/4] drm: zynqmp: Check property creation status Sean Anderson
2026-01-06 16:42 ` [PATCH v2 3/4] drm: zynqmp: Make the video plane primary Sean Anderson
2026-01-06 16:42 ` [PATCH v2 4/4] drm: zynqmp: Add blend mode property to graphics plane Sean Anderson
2026-01-22 13:48 ` [PATCH v2 0/4] drm: zynqmp: Make the video plane primary Tomi Valkeinen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox