[PATCH v2] drm/verisilicon: set blend mode for the cursor plane

Icenowy Zheng posted 1 patch 2 weeks, 1 day ago
drivers/gpu/drm/verisilicon/vs_cursor_plane.c | 2 ++
1 file changed, 2 insertions(+)
[PATCH v2] drm/verisilicon: set blend mode for the cursor plane
Posted by Icenowy Zheng 2 weeks, 1 day ago
Blend mode properties are now required to expose pixel formats w/ alpha.

Experiments show that the fixed blending mode for the cursor seems to be
COVERAGE:

- With a cursor plane filled with R=G=0, B=0xff, A=0x40, the cursor is
  visible on a pure-white background, which means the background is
  multiplied.
- With a cursor plane filled with R=G=B=0xff, A=0x40, the cursor isn't
  pure white and non-white patterns can be see through, which means the
  cursor is multiplied.

Add a fixed COVERAGE blend mode property for the cursor plane.

Signed-off-by: Icenowy Zheng <zhengxingda@iscas.ac.cn>
Reviewed-by: Thomas Zimmermann <tzimmermann@suse.de>
---
 drivers/gpu/drm/verisilicon/vs_cursor_plane.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/gpu/drm/verisilicon/vs_cursor_plane.c b/drivers/gpu/drm/verisilicon/vs_cursor_plane.c
index fa4f601dd0c87..da456dced88aa 100644
--- a/drivers/gpu/drm/verisilicon/vs_cursor_plane.c
+++ b/drivers/gpu/drm/verisilicon/vs_cursor_plane.c
@@ -11,6 +11,7 @@
 
 #include <drm/drm_atomic.h>
 #include <drm/drm_atomic_helper.h>
+#include <drm/drm_blend.h>
 #include <drm/drm_crtc.h>
 #include <drm/drm_fourcc.h>
 #include <drm/drm_framebuffer.h>
@@ -267,6 +268,7 @@ struct drm_plane *vs_cursor_plane_init(struct drm_device *drm_dev,
 		return plane;
 
 	drm_plane_helper_add(plane, &vs_cursor_plane_helper_funcs);
+	drm_plane_create_blend_mode_property(plane, BIT(DRM_MODE_BLEND_COVERAGE));
 
 	return plane;
 }
-- 
2.52.0
Re: [PATCH v2] drm/verisilicon: set blend mode for the cursor plane
Posted by Icenowy Zheng 1 week, 2 days ago
在 2026-09-10四的 17:49 +0800,Icenowy Zheng写道:
> Blend mode properties are now required to expose pixel formats w/
> alpha.
> 
> Experiments show that the fixed blending mode for the cursor seems to
> be
> COVERAGE:
> 
> - With a cursor plane filled with R=G=0, B=0xff, A=0x40, the cursor
> is
>   visible on a pure-white background, which means the background is
>   multiplied.
> - With a cursor plane filled with R=G=B=0xff, A=0x40, the cursor
> isn't
>   pure white and non-white patterns can be see through, which means
> the
>   cursor is multiplied.
> 
> Add a fixed COVERAGE blend mode property for the cursor plane.
> 
> Signed-off-by: Icenowy Zheng <zhengxingda@iscas.ac.cn>
> Reviewed-by: Thomas Zimmermann <tzimmermann@suse.de>

Applied onto drm-misc-fixes.

Thanks,
Icenowy

> ---
>  drivers/gpu/drm/verisilicon/vs_cursor_plane.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/gpu/drm/verisilicon/vs_cursor_plane.c
> b/drivers/gpu/drm/verisilicon/vs_cursor_plane.c
> index fa4f601dd0c87..da456dced88aa 100644
> --- a/drivers/gpu/drm/verisilicon/vs_cursor_plane.c
> +++ b/drivers/gpu/drm/verisilicon/vs_cursor_plane.c
> @@ -11,6 +11,7 @@
>  
>  #include <drm/drm_atomic.h>
>  #include <drm/drm_atomic_helper.h>
> +#include <drm/drm_blend.h>
>  #include <drm/drm_crtc.h>
>  #include <drm/drm_fourcc.h>
>  #include <drm/drm_framebuffer.h>
> @@ -267,6 +268,7 @@ struct drm_plane *vs_cursor_plane_init(struct
> drm_device *drm_dev,
>  		return plane;
>  
>  	drm_plane_helper_add(plane, &vs_cursor_plane_helper_funcs);
> +	drm_plane_create_blend_mode_property(plane,
> BIT(DRM_MODE_BLEND_COVERAGE));
>  
>  	return plane;
>  }