From: Sean Anderson <sean.anderson@linux.dev>
To: Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>,
dri-devel@lists.freedesktop.org
Cc: Simona Vetter <simona@ffwll.ch>,
Thomas Zimmermann <tzimmermann@suse.de>,
linux-kernel@vger.kernel.org, Maxime Ripard <mripard@kernel.org>,
David Airlie <airlied@gmail.com>,
linux-arm-kernel@lists.infradead.org,
Michal Simek <michal.simek@amd.com>,
Anatoliy Klymenko <anatoliy.klymenko@amd.com>,
Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
Mike Looijmans <mike.looijmans@topic.nl>,
Sean Anderson <sean.anderson@linux.dev>
Subject: [PATCH v2 1/4] drm/drm_blend: Allow specifying blend mode default
Date: Tue, 6 Jan 2026 11:42:44 -0500 [thread overview]
Message-ID: <20260106164247.472544-2-sean.anderson@linux.dev> (raw)
In-Reply-To: <20260106164247.472544-1-sean.anderson@linux.dev>
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
next prev parent reply other threads:[~2026-01-06 16:43 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
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 [this message]
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260106164247.472544-2-sean.anderson@linux.dev \
--to=sean.anderson@linux.dev \
--cc=airlied@gmail.com \
--cc=anatoliy.klymenko@amd.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=laurent.pinchart@ideasonboard.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=maarten.lankhorst@linux.intel.com \
--cc=michal.simek@amd.com \
--cc=mike.looijmans@topic.nl \
--cc=mripard@kernel.org \
--cc=simona@ffwll.ch \
--cc=tomi.valkeinen@ideasonboard.com \
--cc=tzimmermann@suse.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox