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 <[email protected]> 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 via email to