mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Bert Karwatzki <spasswolf@web.de>
To: Leandro Ribeiro <leandro.ribeiro@collabora.com>,
	Alex Deucher <alexdeucher@gmail.com>,
	"Wentland, Harry" <Harry.Wentland@amd.com>,
	"Leo (Sunpeng) Li" <Sunpeng.Li@amd.com>,
	Alex Hung <alex.hung@amd.com>
Cc: Alex Deucher <alexander.deucher@amd.com>,
	linux-kernel@vger.kernel.org,  amd-gfx@lists.freedesktop.org,
	linux-next@vger.kernel.org, Jesse Zhang <jesse.zhang@amd.com>,
	Amber Lin <Amber.Lin@amd.com>,
	Mario Limonciello <mario.limonciello@amd.com>,
	spasswolf@web.de
Subject: Re: warnings from validate_blend_mode_for_alpha_formats() in next-20260715
Date: Sat, 18 Jul 2026 14:22:47 +0200	[thread overview]
Message-ID: <514c5423b98376e2e6f1fe4bb56c0f3607b4cd52.camel@web.de> (raw)
In-Reply-To: <cd96faf15c338157e49a858f9e4f94acba4c28ab.camel@web.de>

Am Samstag, dem 18.07.2026 um 11:21 +0200 schrieb Bert Karwatzki:
> Am Freitag, dem 17.07.2026 um 19:54 -0300 schrieb Leandro Ribeiro:
> > 
> > On 7/17/26 11:55 AM, Alex Deucher wrote:
> > > + Some display folks
> > > 
> > > On Fri, Jul 17, 2026 at 9:04 AM Bert Karwatzki <spasswolf@web.de> wrote:
> > > > 
> > > > commit 860e748bddcc ("drm: ensure blend mode supported if pixel format with alpha exposed")
> > > > introduces validate_blend_mode_for_alpha_formats() which prints warnings for amdpgu as
> > > > amdgpu only set blend_mode_property for planes of type DRM_PLANE_TYPE_OVERLAY. I tried to fix
> > > > this by removing he (plane->type == DRM_PLANE_TYPE_OVERLAY) check in amdgpu_dm_plane_init():
> > > > 
> > > >         printk(KERN_INFO "%s: plane=%px plane->type=0x%x plane_cap=%px\n", __func__, plane, plane->type, plane_cap);
> > > >         if (plane_cap)
> > > >                 printk(KERN_INFO "%s: per_pixel_alpha =%u\n", __func__, plane_cap->per_pixel_alpha);
> > > >         if (plane_cap && plane_cap->per_pixel_alpha) {
> > > >                 unsigned int blend_caps = BIT(DRM_MODE_BLEND_PIXEL_NONE) |
> > > >                                           BIT(DRM_MODE_BLEND_PREMULTI) |
> > > >                                           BIT(DRM_MODE_BLEND_COVERAGE);
> > > > 
> > > >                 printk(KERN_INFO "%s: creating alpha and blend mode properties for plane %px\n", __func__, plane);
> > > >                 drm_plane_create_alpha_property(plane);
> > > >                 drm_plane_create_blend_mode_property(plane, blend_caps);
> > > >         }
> > > > 
> > > > But this does not completely silence the warnings becuase for planes of type DRM_PLANE_TYPE_CURSOR plane_cap is NULL.
> > > > Is this a problem that should be fixed in amdgpu or is should validate_blend_mode_for_alpha_formats() only be called
> > > > for planes of certain types?
> > 
> > IMO validate_blend_mode_for_alpha_formats() should be called for all
> > types of planes. I can't think of anything special about a cursor plane
> > that would justify it being allowed to expose formats with alpha but not
> > the blend mode property.
> > 
> > I'm not familiar with the AMD codebase to suggest the best fix, but the
> > driver would need some way to know whether cursor planes are exposing
> > formats with alpha.
> > 
> > > > 
> > > > Bert Karwatzki
> > > > 
> 
> So I looked through the code and found that the cursor planes are initiallized by 
> amdgpu_dm_crtc_init() which calls amdgpu_dm_plane_init() with plane_cap = NULL.
> So I was able to silence the warning by introducing a dummy_plane_cap in amdgpu_dm_crtc_init()
> and dropping the plane->type check in amdgpu_dm_plane_init().
> 
> diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_crtc.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_crtc.c
> index d63688b9d93d..7fb118444d14 100644
> --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_crtc.c
> +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_crtc.c
> @@ -731,13 +731,17 @@ int amdgpu_dm_crtc_init(struct amdgpu_display_manager *dm,
>         struct drm_plane *cursor_plane;
>         bool has_degamma;
>         int res = -ENOMEM;
> +       struct dc_plane_cap dummy_cap = {
> +               .type = DC_PLANE_TYPE_DCE_RGB,
> +               .per_pixel_alpha = 1,
> +       };
>  
>         cursor_plane = kzalloc_obj(*cursor_plane);
>         if (!cursor_plane)
>                 goto fail;
>  
>         cursor_plane->type = DRM_PLANE_TYPE_CURSOR;
> -       res = amdgpu_dm_plane_init(dm, cursor_plane, 0, NULL);
> +       res = amdgpu_dm_plane_init(dm, cursor_plane, 0, &dummy_cap);
>  
>         acrtc = kzalloc_obj(struct amdgpu_crtc);
>         if (!acrtc)
> diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_plane.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_plane.c
> index 26f35434a92f..20785fb451dd 100644
> --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_plane.c
> +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_plane.c
> @@ -1932,8 +1932,7 @@ int amdgpu_dm_plane_init(struct amdgpu_display_manager *dm,
>         if (res)
>                 return res;
>  
> -       if (plane->type == DRM_PLANE_TYPE_OVERLAY &&
> -           plane_cap && plane_cap->per_pixel_alpha) {
> +       if (plane_cap && plane_cap->per_pixel_alpha) {
>                 unsigned int blend_caps = BIT(DRM_MODE_BLEND_PIXEL_NONE) |
>                                           BIT(DRM_MODE_BLEND_PREMULTI) |
>                                           BIT(DRM_MODE_BLEND_COVERAGE);
> 
> One can probably also omit the .type field in the dummy_cap struct and
> also does not have to check if plance_cap is NULL anymore.
> 
> Bert Karwatzki

This might seem problematic as this unconditionally sets per_pixel_alpha = true for cursor planes,
but currently the only pixel format used for cursor planes in amdgpu is DRM_FORMAT_ARGB8888:

$ grep -B 1 -A 3 'cursor_formats\[\]' drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_plane.c

static const u32 cursor_formats[] = {
	DRM_FORMAT_ARGB8888
};

Bert Karwatzki

      reply	other threads:[~2026-07-18 12:22 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-16 15:29 Bert Karwatzki
2026-07-17 14:55 ` Alex Deucher
2026-07-17 22:54   ` Leandro Ribeiro
2026-07-18  9:21     ` Bert Karwatzki
2026-07-18 12:22       ` Bert Karwatzki [this message]

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=514c5423b98376e2e6f1fe4bb56c0f3607b4cd52.camel@web.de \
    --to=spasswolf@web.de \
    --cc=Amber.Lin@amd.com \
    --cc=Harry.Wentland@amd.com \
    --cc=Sunpeng.Li@amd.com \
    --cc=alex.hung@amd.com \
    --cc=alexander.deucher@amd.com \
    --cc=alexdeucher@gmail.com \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=jesse.zhang@amd.com \
    --cc=leandro.ribeiro@collabora.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-next@vger.kernel.org \
    --cc=mario.limonciello@amd.com \
    /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

Powered by JetHome