* [PATCH V2] drm/loongson: Create blend mode property for cursor plane
@ 2026-09-02 13:21 Huacai Chen
2026-09-02 13:32 ` sashiko-bot
2026-09-02 15:29 ` Icenowy Zheng
0 siblings, 2 replies; 5+ messages in thread
From: Huacai Chen @ 2026-09-02 13:21 UTC (permalink / raw)
To: David Airlie, Simona Vetter, Huacai Chen, Jianmin Lv, Qianhai Wu,
Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, Mingcong Bai,
Xi Ruoyao
Cc: Icenowy Zheng, dri-devel, 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 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 <chenhuacai@loongson.cn>
---
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 <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) | 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);
+ 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);
}
--
2.52.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH V2] drm/loongson: Create blend mode property for cursor plane
2026-09-02 13:21 [PATCH V2] drm/loongson: Create blend mode property for cursor plane Huacai Chen
@ 2026-09-02 13:32 ` sashiko-bot
2026-09-02 15:29 ` Icenowy Zheng
1 sibling, 0 replies; 5+ messages in thread
From: sashiko-bot @ 2026-09-02 13:32 UTC (permalink / raw)
To: Huacai Chen; +Cc: dri-devel
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 <chenhuacai@kernel.org>
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_ARGB8888);
...
}
And similarly for the ls7a2000 hardware:
ls7a2000_cursor_plane_atomic_update() {
...
ops->update_cfg(cursor, cursor_size, CURSOR_FORMAT_ARGB8888);
...
}
It appears the hardware is unconditionally programmed to use alpha blending
(CURSOR_FORMAT_ARGB8888) 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/20260902132152.3170934-1-chenhuacai@loongson.cn?part=1
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH V2] drm/loongson: Create blend mode property for cursor plane
2026-09-02 13:21 [PATCH V2] drm/loongson: Create blend mode property for cursor plane Huacai Chen
2026-09-02 13:32 ` sashiko-bot
@ 2026-09-02 15:29 ` Icenowy Zheng
2026-09-03 2:27 ` Jianmin Lv
1 sibling, 1 reply; 5+ messages in thread
From: Icenowy Zheng @ 2026-09-02 15:29 UTC (permalink / raw)
To: Huacai Chen, David Airlie, Simona Vetter, Huacai Chen, Jianmin Lv,
Qianhai Wu, Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann,
Mingcong Bai, Xi Ruoyao
Cc: dri-devel
在 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 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 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 <chenhuacai@loongson.cn>
> ---
> 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 <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) |
> 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 XRGB8888 instead of ARGB8888.
Thanks,
Icenowy
> + 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);
> }
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH V2] drm/loongson: Create blend mode property for cursor plane
2026-09-02 15:29 ` Icenowy Zheng
@ 2026-09-03 2:27 ` Jianmin Lv
2026-09-03 6:05 ` Huacai Chen
0 siblings, 1 reply; 5+ messages in thread
From: Jianmin Lv @ 2026-09-03 2:27 UTC (permalink / raw)
To: Icenowy Zheng, Huacai Chen, David Airlie, Simona Vetter,
Huacai Chen, Qianhai Wu, Maarten Lankhorst, Maxime Ripard,
Thomas Zimmermann, Mingcong Bai, Xi Ruoyao
Cc: dri-devel
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 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 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 <chenhuacai@loongson.cn>
>> ---
>> 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 <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) |
>> 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 XRGB8888 instead of ARGB8888.
>
> 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);
>> }
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH V2] drm/loongson: Create blend mode property for cursor plane
2026-09-03 2:27 ` Jianmin Lv
@ 2026-09-03 6:05 ` Huacai Chen
0 siblings, 0 replies; 5+ messages in thread
From: Huacai Chen @ 2026-09-03 6:05 UTC (permalink / raw)
To: Jianmin Lv
Cc: Icenowy Zheng, Huacai Chen, David Airlie, Simona Vetter,
Qianhai Wu, Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann,
Mingcong Bai, Xi Ruoyao, dri-devel
On Thu, Sep 3, 2026 at 10:41 AM Jianmin Lv <lvjianmin@loongson.cn> 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 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 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 <chenhuacai@loongson.cn>
> >> ---
> >> 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 <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) |
> >> 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 XRGB8888 instead of ARGB8888.
> >
> > 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);
> >> }
>
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2026-09-03 6:05 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-09-02 13:21 [PATCH V2] drm/loongson: Create blend mode property for cursor plane Huacai Chen
2026-09-02 13:32 ` sashiko-bot
2026-09-02 15:29 ` Icenowy Zheng
2026-09-03 2:27 ` Jianmin Lv
2026-09-03 6:05 ` Huacai Chen
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.