Re: [PATCH V2] drm/loongson: Create blend mode property for cursor plane
On Thu, Sep 3, 2026 at 10:41 AM Jianmin Lv wrote:
>
>
>
> On 2026/9/2 下午11:29, Icenowy Zheng wrote:
> > 在 2026-09-02三的 21:21 +0800,Huacai Chen写道:
> >> After commit 860e748bddcc929 ("drm: ensure blend mode supported if
> >> pixel
> >> format with alpha exposed") we get warnings at boot:
> >>
> >> loongson :00:06.1: [drm] [PLANE:41:ls-cursor-plane-0] pixel
> >> format with alpha exposed but blend mode not setup. Please fix.
> >> loongson :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 HW doesn't support DRM_MODE_BLEND_PREMULTI, so create
> >> a blend mode with "DRM_MODE_BLEND_PIXEL_NONE |
> >> DRM_MODE_BLEND_COVERAGE"
> >> for cursor planes.
> >>
> >> Signed-off-by: Huacai Chen
> >> ---
> >> 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..969b2aaa4fd0 100644
> >> --- a/drivers/gpu/drm/loongson/lsdc_plane.c
> >> +++ b/drivers/gpu/drm/loongson/lsdc_plane.c
> >> @@ -7,6 +7,7 @@
> >>
> >> #include
> >> #include
> >> +#include
> >> #include
> >> #include
> >> #include
> >> @@ -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) |
> >> BIT(DRM_MODE_BLEND_COVERAGE);
> >> +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) |
> >> BIT(DRM_MODE_BLEND_COVERAGE);
> >
> > I think code needs to be present for setting up PIXEL_NONE blend mode,
> > if it's exposed.
> >
> > Personally, from my copy of 龙芯 7A2000 桥片用户手册 V1.0, I can find no
> > information of a PIXEL_NONE blend mode -- there's no bits controlling
> > the enablement of blending (except for completely disabling the
> > cursor), and the format has no option of XRGB instead of ARGB.
> >
> > Thanks,
> > Icenowy
> >
> Agree, COVERAGE mode is internally fixed in the chip with no register to
> control.
OK, I will remove PIXEL_NONE in V3.
Huacai
> >> +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);
> >> }
>
Re: [PATCH V2] drm/loongson: Create blend mode property for cursor plane
On 2026/9/2 下午11:29, Icenowy Zheng wrote:
在 2026-09-02三的 21:21 +0800,Huacai Chen写道:
After commit 860e748bddcc929 ("drm: ensure blend mode supported if
pixel
format with alpha exposed") we get warnings at boot:
loongson :00:06.1: [drm] [PLANE:41:ls-cursor-plane-0] pixel
format with alpha exposed but blend mode not setup. Please fix.
loongson :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 HW doesn't support DRM_MODE_BLEND_PREMULTI, so create
a blend mode with "DRM_MODE_BLEND_PIXEL_NONE |
DRM_MODE_BLEND_COVERAGE"
for cursor planes.
Signed-off-by: Huacai Chen
---
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..969b2aaa4fd0 100644
--- a/drivers/gpu/drm/loongson/lsdc_plane.c
+++ b/drivers/gpu/drm/loongson/lsdc_plane.c
@@ -7,6 +7,7 @@
#include
#include
+#include
#include
#include
#include
@@ -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) |
BIT(DRM_MODE_BLEND_COVERAGE);
+ 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) |
BIT(DRM_MODE_BLEND_COVERAGE);
I think code needs to be present for setting up PIXEL_NONE blend mode,
if it's exposed.
Personally, from my copy of 龙芯 7A2000 桥片用户手册 V1.0, I can find no
information of a PIXEL_NONE blend mode -- there's no bits controlling
the enablement of blending (except for completely disabling the
cursor), and the format has no option of XRGB instead of ARGB.
Thanks,
Icenowy
Agree, COVERAGE mode is internally fixed in the chip with no register to
control.
+ 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);
}
Re: [PATCH V2] drm/loongson: Create blend mode property for cursor plane
Thank you for your contribution! Sashiko AI review found 1 potential issue(s)
to consider:
- [Medium] The cursor plane's blend mode property advertises support for
DRM_MODE_BLEND_PIXEL_NONE, but the driver never reads or implements this mode,
causing it to incorrectly behave as DRM_MODE_BLEND_COVERAGE.
--
commit 0fb989e37bfbacfc53639e07453dacd08e37bac4
Author: Huacai Chen
drm/loongson: Create blend mode property for cursor plane
This commit fixes boot warnings by exposing a blend mode property for cursor
planes that use pixel formats with alpha. It configures the planes to expose
support for both DRM_MODE_BLEND_PIXEL_NONE and DRM_MODE_BLEND_COVERAGE.
> diff --git a/drivers/gpu/drm/loongson/lsdc_plane.c
> b/drivers/gpu/drm/loongson/lsdc_plane.c
> index bea42215796d4..969b2aaa4fd09 100644
> --- a/drivers/gpu/drm/loongson/lsdc_plane.c
> +++ b/drivers/gpu/drm/loongson/lsdc_plane.c
[ ... ]
> @@ -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);
> }
[Severity: Medium]
Does this driver actually support DRM_MODE_BLEND_PIXEL_NONE?
The blend caps advertise DRM_MODE_BLEND_PIXEL_NONE, allowing userspace to
request disabling alpha blending on the cursor plane. However, looking at
the atomic update path for this hardware:
ls7a1000_cursor_plane_atomic_update() {
...
ops->update_cfg(cursor, CURSOR_SIZE_32X32, CURSOR_FORMAT_ARGB);
...
}
And similarly for the ls7a2000 hardware:
ls7a2000_cursor_plane_atomic_update() {
...
ops->update_cfg(cursor, cursor_size, CURSOR_FORMAT_ARGB);
...
}
It appears the hardware is unconditionally programmed to use alpha blending
(CURSOR_FORMAT_ARGB) regardless of the plane_state->pixel_blend_mode
value.
If userspace sets the pixel blend mode to None, won't it silently continue
using alpha coverage instead of rendering an opaque cursor?
--
Sashiko AI review ·
https://sashiko.dev/#/patchset/[email protected]?part=1
