Hi, Icenowy,

On Tue, Sep 1, 2026 at 10:41 PM Icenowy Zheng <[email protected]> wrote:
>
> 在 2026-09-01二的 22:26 +0800,Icenowy Zheng写道:
> > 在 2026-09-01二的 18:10 +0800,Icenowy Zheng写道:
> > > 在 2026-09-01二的 17:59 +0800,Huacai Chen写道:
> > > > After commit 860e748bddcc929 ("drm: ensure blend mode supported
> > > > if
> > > > pixel
> > > > format with alpha exposed") we get warnings at boot:
> > > >
> > > > loongson 0000:00:06.1: [drm] [PLANE:41:ls-cursor-plane-0] pixel
> > > > format with alpha exposed but blend mode not setup. Please fix.
> > > > loongson 0000:00:06.1: [drm] [PLANE:46:ls-cursor-plane-1] pixel
> > > > format with alpha exposed but blend mode not setup. Please fix.
> > > >
> > > > The reason is the cursor plane supports color formats with alpha
> > > > but
> > > > the
> > > > driver doesn't create blend mode property, which triggers the
> > > > warning
> > > > in
> > > > validate_blend_mode_for_alpha_formats().
> > > >
> > > > The loongson DC only supports DRM_MODE_BLEND_PIXEL_NONE, so
> > > > create
> > > > blend
> > >
> > > I think this means alpha is ignored, which isn't the expected
> > > behavior
> > > for a cursor plane.
> > >
> > > I assume PREMULTI is more reasonable, although this would need some
> > > experiment.
> >
> > I hacked modetest to generate a cursor plane filled with r=g=0,
> > b=0xff,
> > a=0x40, and this cursor is quite visible on a white background --
> > which
> > seems to mean the blending mode is COVERAGE.
>
> BTW with a cursor filled with r=g=b=0xff, a=0x40, the pattern below is
> still visible, which means the cursor plane isn't premultiplied either.
I  discussed with Jianmin, he told me that the primary plane doesn't
support PREMULTI and COVERAGE, while the cursor plane doesn't support
PREMULTI but supports COVERAGE, so we can use COVERAGE here.


Huacai

>
> Thanks,
> Icenowy
>
> >
> > (Tested on 7A1000)
> >
> > Thanks,
> > Icenowy
> >
> > >
> > > Thanks,
> > > Icenowy
> > >
> > > > mode property with DRM_MODE_BLEND_PIXEL_NONE for cursor planes.
> > > >
> > > > Signed-off-by: Huacai Chen <[email protected]>
> > > > ---
> > > >  drivers/gpu/drm/loongson/lsdc_plane.c | 11 +++++++----
> > > >  1 file changed, 7 insertions(+), 4 deletions(-)
> > > >
> > > > diff --git a/drivers/gpu/drm/loongson/lsdc_plane.c
> > > > b/drivers/gpu/drm/loongson/lsdc_plane.c
> > > > index bea42215796d..efef25eaa659 100644
> > > > --- a/drivers/gpu/drm/loongson/lsdc_plane.c
> > > > +++ b/drivers/gpu/drm/loongson/lsdc_plane.c
> > > > @@ -7,6 +7,7 @@
> > > >
> > > >  #include <drm/drm_atomic.h>
> > > >  #include <drm/drm_atomic_helper.h>
> > > > +#include <drm/drm_blend.h>
> > > >  #include <drm/drm_framebuffer.h>
> > > >  #include <drm/drm_gem_atomic_helper.h>
> > > >  #include <drm/drm_print.h>
> > > > @@ -747,8 +748,9 @@ int ls7a1000_cursor_plane_init(struct
> > > > drm_device
> > > > *ddev,
> > > >                          struct drm_plane *plane,
> > > >                          unsigned int index)
> > > >  {
> > > > - struct lsdc_cursor *cursor = to_lsdc_cursor(plane);
> > > >   int ret;
> > > > + unsigned int blend_caps =
> > > > BIT(DRM_MODE_BLEND_PIXEL_NONE);
> > > > + struct lsdc_cursor *cursor = to_lsdc_cursor(plane);
> > > >
> > > >   ret = drm_universal_plane_init(ddev, plane, 1 << index,
> > > >                                  &lsdc_plane_funcs,
> > > > @@ -765,15 +767,16 @@ int ls7a1000_cursor_plane_init(struct
> > > > drm_device *ddev,
> > > >
> > > >   drm_plane_helper_add(plane,
> > > > &ls7a1000_cursor_plane_helper_funcs);
> > > >
> > > > - return 0;
> > > > + return drm_plane_create_blend_mode_property(plane,
> > > > blend_caps);
> > > >  }
> > > >
> > > >  int ls7a2000_cursor_plane_init(struct drm_device *ddev,
> > > >                          struct drm_plane *plane,
> > > >                          unsigned int index)
> > > >  {
> > > > - struct lsdc_cursor *cursor = to_lsdc_cursor(plane);
> > > >   int ret;
> > > > + unsigned int blend_caps =
> > > > BIT(DRM_MODE_BLEND_PIXEL_NONE);
> > > > + struct lsdc_cursor *cursor = to_lsdc_cursor(plane);
> > > >
> > > >   ret = drm_universal_plane_init(ddev, plane, 1 << index,
> > > >                                  &lsdc_plane_funcs,
> > > > @@ -790,5 +793,5 @@ int ls7a2000_cursor_plane_init(struct
> > > > drm_device
> > > > *ddev,
> > > >
> > > >   drm_plane_helper_add(plane,
> > > > &ls7a2000_cursor_plane_helper_funcs);
> > > >
> > > > - return 0;
> > > > + return drm_plane_create_blend_mode_property(plane,
> > > > blend_caps);
> > > >  }
>

Reply via email to