From: Sean Anderson <sean.anderson@linux.dev>
To: "Klymenko, Anatoliy" <Anatoliy.Klymenko@amd.com>,
Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>,
"dri-devel@lists.freedesktop.org"
<dri-devel@lists.freedesktop.org>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
Mike Looijmans <mike.looijmans@topic.nl>,
David Airlie <airlied@gmail.com>,
Thomas Zimmermann <tzimmermann@suse.de>,
Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
Maxime Ripard <mripard@kernel.org>,
"linux-arm-kernel@lists.infradead.org"
<linux-arm-kernel@lists.infradead.org>,
Simona Vetter <simona@ffwll.ch>,
"Simek, Michal" <michal.simek@amd.com>
Subject: Re: [PATCH 3/3] drm: zynqmp: Add blend mode property to graphics plane
Date: Mon, 5 Jan 2026 14:58:25 -0500 [thread overview]
Message-ID: <c28be0ef-f6c9-42e3-8f7b-133a93378d48@linux.dev> (raw)
In-Reply-To: <MW4PR12MB7165CDDB17CF0855EA19AACDE6A6A@MW4PR12MB7165.namprd12.prod.outlook.com>
On 12/4/25 16:16, Klymenko, Anatoliy wrote:
> [AMD Official Use Only - AMD Internal Distribution Only]
>
> Hi Sean,
>
>> -----Original Message-----
>> From: Sean Anderson <sean.anderson@linux.dev>
>> Sent: Monday, November 17, 2025 7:36 AM
>> To: Klymenko, Anatoliy <Anatoliy.Klymenko@amd.com>; Laurent Pinchart
>> <laurent.pinchart@ideasonboard.com>; Tomi Valkeinen
>> <tomi.valkeinen@ideasonboard.com>; dri-devel@lists.freedesktop.org
>> Cc: linux-kernel@vger.kernel.org; Mike Looijmans <mike.looijmans@topic.nl>;
>> David Airlie <airlied@gmail.com>; Thomas Zimmermann
>> <tzimmermann@suse.de>; Maarten Lankhorst
>> <maarten.lankhorst@linux.intel.com>; Maxime Ripard <mripard@kernel.org>;
>> linux-arm-kernel@lists.infradead.org; Simona Vetter <simona@ffwll.ch>; Simek,
>> Michal <michal.simek@amd.com>
>> Subject: Re: [PATCH 3/3] drm: zynqmp: Add blend mode property to graphics
>> plane
>>
>> Caution: This message originated from an External Source. Use proper caution
>> when opening attachments, clicking links, or responding.
>>
>>
>> On 11/14/25 19:12, Klymenko, Anatoliy wrote:
>> > [AMD Official Use Only - AMD Internal Distribution Only]
>> >
>> >> -----Original Message-----
>> >> From: dri-devel <dri-devel-bounces@lists.freedesktop.org> On Behalf Of
>> Sean
>> >> Anderson
>> >> Sent: Thursday, November 13, 2025 3:07 PM
>> >> To: Klymenko, Anatoliy <Anatoliy.Klymenko@amd.com>; Laurent Pinchart
>> >> <laurent.pinchart@ideasonboard.com>; Tomi Valkeinen
>> >> <tomi.valkeinen@ideasonboard.com>; dri-devel@lists.freedesktop.org
>> >> Cc: linux-kernel@vger.kernel.org; Mike Looijmans
>> <mike.looijmans@topic.nl>;
>> >> David Airlie <airlied@gmail.com>; Thomas Zimmermann
>> >> <tzimmermann@suse.de>; Maarten Lankhorst
>> >> <maarten.lankhorst@linux.intel.com>; Maxime Ripard
>> <mripard@kernel.org>;
>> >> linux-arm-kernel@lists.infradead.org; Simona Vetter <simona@ffwll.ch>;
>> Simek,
>> >> Michal <michal.simek@amd.com>
>> >> Subject: Re: [PATCH 3/3] drm: zynqmp: Add blend mode property to graphics
>> >> plane
>> >>
>> >> Caution: This message originated from an External Source. Use proper
>> caution
>> >> when opening attachments, clicking links, or responding.
>> >>
>> >>
>> >> On 11/13/25 18:03, Klymenko, Anatoliy wrote:
>> >> > [AMD Official Use Only - AMD Internal Distribution Only]
>> >> >
>> >> > Hi Sean,
>> >> >
>> >> > Thank you for the patch.
>> >> >
>> >> >> -----Original Message-----
>> >> >> From: Sean Anderson <sean.anderson@linux.dev>
>> >> >> Sent: Thursday, November 13, 2025 12:37 PM
>> >> >> To: Laurent Pinchart <laurent.pinchart@ideasonboard.com>; Tomi
>> Valkeinen
>> >> >> <tomi.valkeinen@ideasonboard.com>; dri-devel@lists.freedesktop.org
>> >> >> Cc: linux-kernel@vger.kernel.org; Mike Looijmans
>> >> <mike.looijmans@topic.nl>;
>> >> >> David Airlie <airlied@gmail.com>; Thomas Zimmermann
>> >> >> <tzimmermann@suse.de>; Maarten Lankhorst
>> >> >> <maarten.lankhorst@linux.intel.com>; Klymenko, Anatoliy
>> >> >> <Anatoliy.Klymenko@amd.com>; Maxime Ripard <mripard@kernel.org>;
>> >> linux-
>> >> >> arm-kernel@lists.infradead.org; Simona Vetter <simona@ffwll.ch>;
>> Simek,
>> >> >> Michal <michal.simek@amd.com>; Sean Anderson
>> >> >> <sean.anderson@linux.dev>
>> >> >> Subject: [PATCH 3/3] drm: zynqmp: Add blend mode property to graphics
>> >> plane
>> >> >>
>> >> >> Caution: This message originated from an External Source. Use proper
>> >> caution
>> >> >> when opening attachments, clicking links, or responding.
>> >> >>
>> >> >>
>> >> >> 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. I'm not sure whether the
>> >> >> per-pixel alpha is pre-multiplied or not [1], but apparently it *must* be
>> >> >> pre-multiplied so I guess we have to advertise it.
>> >> >>
>> >> >> [1] All we get is "The alpha value available with the graphics stream
>> >> >> will define the transparency of the graphics."
>> >> >>
>> >> >> Signed-off-by: Sean Anderson <sean.anderson@linux.dev>
>> >> >> ---
>> >> >>
>> >> >> drivers/gpu/drm/xlnx/zynqmp_kms.c | 24 ++++++++++++++++++++++--
>> >> >> 1 file changed, 22 insertions(+), 2 deletions(-)
>> >> >>
>> >> >> diff --git a/drivers/gpu/drm/xlnx/zynqmp_kms.c
>> >> >> b/drivers/gpu/drm/xlnx/zynqmp_kms.c
>> >> >> index 456ada9ac003..fa1cfc16db36 100644
>> >> >> --- a/drivers/gpu/drm/xlnx/zynqmp_kms.c
>> >> >> +++ b/drivers/gpu/drm/xlnx/zynqmp_kms.c
>> >> >> @@ -61,6 +61,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);
>> >> >> @@ -117,9 +124,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
>> >> >> @@ -179,9 +190,18 @@ 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_PREMULTI);
>> >> >
>> >> > | BIT(DRM_MODE_BLEND_COVERAGE) - this is what implemented in the
>> >> hardware.
>> >>
>> >> Do you have a datasheet (or other) reference?
>> >>
>> >
>> > Yes https://docs.amd.com/v/u/en-US/ug1085-zynq-ultrascale-trm
>>
>> There is no mention of this in the TRM.
>>
>> | Video Blending is defined for two RGB video streams. One of these
>> | streams will be graphics that have an alpha value along with RGB
>> | stream. The alpha value available with the graphics stream will define
>> | the transparency of the graphics. Alpha value defined for blending
>> | function is always 8-bit. 1-bit alpha and 4-bit alpha are also
>> | supported, but these are scaled to 8-bits before they are used for
>> | alpha blending
>>
>> Please quote a specific section where the alpha blending formula is
>> documented.
>>
>
> Yes, there is no explicit alpha blending formula in the TRM, although
> absence of "premultiplied alpha" term anywhere in the doc suggests that
> alpha is treated as a straight. Anyways, I cooked a quick test that proved
> the straight alpha theory: https://github.com/onotole/zynqmp-dp-alpha
>
>> >> But in any case, DRM_MODE_BLEND_PREMULTI is mandatory even if we
>> >> don't support
>> >> it. See drm_plane_create_blend_mode_property for details.
>> >>
>> >
>> > No doubts here
>>
>> OK, so regardless of what the hardware does, we have to pretend to
>> support pre-multiplied alpha.
>>
>
> Yes, we my pretend so, or we may work around backward compatibility check
> in drm_plane_create_blend_mode_property by setting blend mode to
> DRM_MODE_BLEND_COVERAGE immediately and later reject plane states
> with DRM_MODE_BLEND_PREMULTI mode.
OK, I'll add a patch to allow blend mode without premulti for v2. The
comment on the function says that it's a default for old userspace, but
we don't have a userspace that expects a particular blend mode in the
first place.
--Sean
next prev parent reply other threads:[~2026-01-05 19:58 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-13 20:37 [PATCH 0/3] drm: zynqmp: Make the video plane primary Sean Anderson
2025-11-13 20:37 ` [PATCH 1/3] drm: zynqmp: Check property creation status Sean Anderson
2025-11-13 23:05 ` Klymenko, Anatoliy
2025-11-14 7:36 ` Thomas Zimmermann
2025-11-13 20:37 ` [PATCH 2/3] drm: zynqmp: Make the video plane primary Sean Anderson
2025-11-13 22:45 ` Klymenko, Anatoliy
2025-11-13 22:51 ` Sean Anderson
2025-11-15 0:57 ` Klymenko, Anatoliy
2025-11-17 16:09 ` Sean Anderson
2025-12-04 22:33 ` Klymenko, Anatoliy
2026-01-05 19:46 ` Sean Anderson
2025-11-13 20:37 ` [PATCH 3/3] drm: zynqmp: Add blend mode property to graphics plane Sean Anderson
2025-11-13 23:03 ` Klymenko, Anatoliy
2025-11-13 23:07 ` Sean Anderson
2025-11-15 0:12 ` Klymenko, Anatoliy
2025-11-17 15:35 ` Sean Anderson
2025-12-04 21:16 ` Klymenko, Anatoliy
2026-01-05 19:58 ` Sean Anderson [this message]
2025-11-13 23:59 ` Klymenko, Anatoliy
2025-11-14 15:35 ` Sean Anderson
2025-11-14 7:42 ` [PATCH 0/3] drm: zynqmp: Make the video plane primary Thomas Zimmermann
2025-11-14 15:35 ` Sean Anderson
2025-12-22 9:29 ` Mikko Rapeli
2025-12-22 9:42 ` Mikko Rapeli
2025-12-22 9:48 ` Tomi Valkeinen
2025-12-22 16:13 ` Mike Looijmans
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=c28be0ef-f6c9-42e3-8f7b-133a93378d48@linux.dev \
--to=sean.anderson@linux.dev \
--cc=Anatoliy.Klymenko@amd.com \
--cc=airlied@gmail.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
all inboxes | Powered by JetHome®