mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] drm/virtio: Add pixel blend mode property to cursor plane
@ 2026-08-28  9:01 oushixiong1025
  2026-09-20 18:21 ` Dmitry Osipenko
  0 siblings, 1 reply; 4+ messages in thread
From: oushixiong1025 @ 2026-08-28  9:01 UTC (permalink / raw)
  To: David Airlie
  Cc: Gerd Hoffmann, Dmitry Osipenko, Gurchetan Singh, Chia-I Wu,
	Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann,
	Simona Vetter, dri-devel, virtualization, linux-kernel,
	Shixiong Ou, Ye Liu

From: Shixiong Ou <oushixiong@kylinos.cn>

The cursor plane exposes a format with an alpha channel
(DRM_FORMAT_ARGB8888) without a pixel blend mode property. Since
commit 860e748bddcc ("drm: ensure blend mode supported if pixel
format with alpha exposed") this triggers a warning during
drm_mode_config_validate():

[    0.649020] ------------[ cut here ]------------
[    0.649040] [PLANE:36:plane-1] pixel format with alpha exposed but blend mode not setup
[    0.649081] WARNING: drivers/gpu/drm/drm_mode_config.c:872 at drm_mode_config_validate
......
[    0.649761] Call trace:
[    0.649764]  drm_mode_config_validate+0x398/0x558 [drm] (P)
[    0.649912]  drm_dev_register+0x1cc/0x2a0 [drm]
[    0.650058]  virtio_gpu_probe+0xd4/0x1c0 [virtio_gpu]
[    0.650088]  virtio_dev_probe+0x1c8/0x310
......
[    0.650261] ---[ end trace 0000000000000000 ]---


Create the property with the only supported blend mode,
DRM_MODE_BLEND_PREMULTI, which is also the property's default and
matches what userspace had to assume before the property existed.

Reported-by: Ye Liu <liuye@kylinos.cn>
Signed-off-by: Shixiong Ou <oushixiong@kylinos.cn>
---
 drivers/gpu/drm/virtio/virtgpu_plane.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/drivers/gpu/drm/virtio/virtgpu_plane.c b/drivers/gpu/drm/virtio/virtgpu_plane.c
index 1d1b27ece62a..11771c943ea6 100644
--- a/drivers/gpu/drm/virtio/virtgpu_plane.c
+++ b/drivers/gpu/drm/virtio/virtgpu_plane.c
@@ -24,6 +24,7 @@
  */
 
 #include <drm/drm_atomic_helper.h>
+#include <drm/drm_blend.h>
 #include <drm/drm_damage_helper.h>
 #include <drm/drm_fourcc.h>
 #include <drm/drm_gem_atomic_helper.h>
@@ -588,6 +589,7 @@ struct drm_plane *virtio_gpu_plane_init(struct virtio_gpu_device *vgdev,
 	struct drm_plane *plane;
 	const uint32_t *formats;
 	int nformats;
+	int ret;
 
 	if (type == DRM_PLANE_TYPE_CURSOR) {
 		formats = virtio_gpu_cursor_formats;
@@ -610,5 +612,17 @@ struct drm_plane *virtio_gpu_plane_init(struct virtio_gpu_device *vgdev,
 	if (type == DRM_PLANE_TYPE_PRIMARY)
 		drm_plane_enable_fb_damage_clips(plane);
 
+	if (type == DRM_PLANE_TYPE_CURSOR) {
+		/*
+		 * The cursor plane exposes a format with an alpha channel,
+		 * which requires a blend mode property. The host blends
+		 * premultiplied alpha, matching the property's default.
+		 */
+		ret = drm_plane_create_blend_mode_property(plane,
+							   BIT(DRM_MODE_BLEND_PREMULTI));
+		if (ret)
+			return ERR_PTR(ret);
+	}
+
 	return plane;
 }
-- 
2.25.1

No virus found
		Checked by Hillstone Network AntiVirus


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] drm/virtio: Add pixel blend mode property to cursor plane
  2026-08-28  9:01 [PATCH] drm/virtio: Add pixel blend mode property to cursor plane oushixiong1025
@ 2026-09-20 18:21 ` Dmitry Osipenko
       [not found]   ` <CGME20261001180058eucas1p1506f92fdf0e1417404bb8025f181ae30@eucas1p1.samsung.com>
  0 siblings, 1 reply; 4+ messages in thread
From: Dmitry Osipenko @ 2026-09-20 18:21 UTC (permalink / raw)
  To: oushixiong1025, David Airlie
  Cc: Gerd Hoffmann, Gurchetan Singh, Chia-I Wu, Maarten Lankhorst,
	Maxime Ripard, Thomas Zimmermann, Simona Vetter, dri-devel,
	virtualization, linux-kernel, Shixiong Ou, Ye Liu

On 8/28/26 12:01, oushixiong1025@163.com wrote:
> From: Shixiong Ou <oushixiong@kylinos.cn>
> 
> The cursor plane exposes a format with an alpha channel
> (DRM_FORMAT_ARGB8888) without a pixel blend mode property. Since
> commit 860e748bddcc ("drm: ensure blend mode supported if pixel
> format with alpha exposed") this triggers a warning during
> drm_mode_config_validate():
> 
> [    0.649020] ------------[ cut here ]------------
> [    0.649040] [PLANE:36:plane-1] pixel format with alpha exposed but blend mode not setup
> [    0.649081] WARNING: drivers/gpu/drm/drm_mode_config.c:872 at drm_mode_config_validate
> ......
> [    0.649761] Call trace:
> [    0.649764]  drm_mode_config_validate+0x398/0x558 [drm] (P)
> [    0.649912]  drm_dev_register+0x1cc/0x2a0 [drm]
> [    0.650058]  virtio_gpu_probe+0xd4/0x1c0 [virtio_gpu]
> [    0.650088]  virtio_dev_probe+0x1c8/0x310
> ......
> [    0.650261] ---[ end trace 0000000000000000 ]---
> 
> 
> Create the property with the only supported blend mode,
> DRM_MODE_BLEND_PREMULTI, which is also the property's default and
> matches what userspace had to assume before the property existed.
> 
> Reported-by: Ye Liu <liuye@kylinos.cn>
> Signed-off-by: Shixiong Ou <oushixiong@kylinos.cn>
> ---
>  drivers/gpu/drm/virtio/virtgpu_plane.c | 14 ++++++++++++++
>  1 file changed, 14 insertions(+)
> 
> diff --git a/drivers/gpu/drm/virtio/virtgpu_plane.c b/drivers/gpu/drm/virtio/virtgpu_plane.c
> index 1d1b27ece62a..11771c943ea6 100644
> --- a/drivers/gpu/drm/virtio/virtgpu_plane.c
> +++ b/drivers/gpu/drm/virtio/virtgpu_plane.c
> @@ -24,6 +24,7 @@
>   */
>  
>  #include <drm/drm_atomic_helper.h>
> +#include <drm/drm_blend.h>
>  #include <drm/drm_damage_helper.h>
>  #include <drm/drm_fourcc.h>
>  #include <drm/drm_gem_atomic_helper.h>
> @@ -588,6 +589,7 @@ struct drm_plane *virtio_gpu_plane_init(struct virtio_gpu_device *vgdev,
>  	struct drm_plane *plane;
>  	const uint32_t *formats;
>  	int nformats;
> +	int ret;
>  
>  	if (type == DRM_PLANE_TYPE_CURSOR) {
>  		formats = virtio_gpu_cursor_formats;
> @@ -610,5 +612,17 @@ struct drm_plane *virtio_gpu_plane_init(struct virtio_gpu_device *vgdev,
>  	if (type == DRM_PLANE_TYPE_PRIMARY)
>  		drm_plane_enable_fb_damage_clips(plane);
>  
> +	if (type == DRM_PLANE_TYPE_CURSOR) {
> +		/*
> +		 * The cursor plane exposes a format with an alpha channel,
> +		 * which requires a blend mode property. The host blends
> +		 * premultiplied alpha, matching the property's default.
> +		 */
> +		ret = drm_plane_create_blend_mode_property(plane,
> +							   BIT(DRM_MODE_BLEND_PREMULTI));
> +		if (ret)
> +			return ERR_PTR(ret);
> +	}
> +
>  	return plane;
>  }

Applied to misc-fixes, thanks!

-- 
Best regards,
Dmitry

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] drm/virtio: Add pixel blend mode property to cursor plane
       [not found]   ` <CGME20261001180058eucas1p1506f92fdf0e1417404bb8025f181ae30@eucas1p1.samsung.com>
@ 2026-10-01 18:00     ` Marek Szyprowski
  2026-10-02 10:26       ` Dmitry Osipenko
  0 siblings, 1 reply; 4+ messages in thread
From: Marek Szyprowski @ 2026-10-01 18:00 UTC (permalink / raw)
  To: Dmitry Osipenko, oushixiong1025, David Airlie
  Cc: Gerd Hoffmann, Gurchetan Singh, Chia-I Wu, Maarten Lankhorst,
	Maxime Ripard, Thomas Zimmermann, Simona Vetter, dri-devel,
	virtualization, linux-kernel, Shixiong Ou, Ye Liu

On 20.09.2026 20:21, Dmitry Osipenko wrote:
> On 8/28/26 12:01, oushixiong1025@163.com wrote:
>> From: Shixiong Ou <oushixiong@kylinos.cn>
>>
>> The cursor plane exposes a format with an alpha channel
>> (DRM_FORMAT_ARGB8888) without a pixel blend mode property. Since
>> commit 860e748bddcc ("drm: ensure blend mode supported if pixel
>> format with alpha exposed") this triggers a warning during
>> drm_mode_config_validate():
>>
>> [    0.649020] ------------[ cut here ]------------
>> [    0.649040] [PLANE:36:plane-1] pixel format with alpha exposed but blend mode not setup
>> [    0.649081] WARNING: drivers/gpu/drm/drm_mode_config.c:872 at drm_mode_config_validate
>> ......
>> [    0.649761] Call trace:
>> [    0.649764]  drm_mode_config_validate+0x398/0x558 [drm] (P)
>> [    0.649912]  drm_dev_register+0x1cc/0x2a0 [drm]
>> [    0.650058]  virtio_gpu_probe+0xd4/0x1c0 [virtio_gpu]
>> [    0.650088]  virtio_dev_probe+0x1c8/0x310
>> ......
>> [    0.650261] ---[ end trace 0000000000000000 ]---
>>
>>
>> Create the property with the only supported blend mode,
>> DRM_MODE_BLEND_PREMULTI, which is also the property's default and
>> matches what userspace had to assume before the property existed.
>>
>> Reported-by: Ye Liu <liuye@kylinos.cn>
>> Signed-off-by: Shixiong Ou <oushixiong@kylinos.cn>
>> ---
>>  drivers/gpu/drm/virtio/virtgpu_plane.c | 14 ++++++++++++++
>>  1 file changed, 14 insertions(+)
>>
>> diff --git a/drivers/gpu/drm/virtio/virtgpu_plane.c b/drivers/gpu/drm/virtio/virtgpu_plane.c
>> index 1d1b27ece62a..11771c943ea6 100644
>> --- a/drivers/gpu/drm/virtio/virtgpu_plane.c
>> +++ b/drivers/gpu/drm/virtio/virtgpu_plane.c
>> @@ -24,6 +24,7 @@
>>   */
>>  
>>  #include <drm/drm_atomic_helper.h>
>> +#include <drm/drm_blend.h>
>>  #include <drm/drm_damage_helper.h>
>>  #include <drm/drm_fourcc.h>
>>  #include <drm/drm_gem_atomic_helper.h>
>> @@ -588,6 +589,7 @@ struct drm_plane *virtio_gpu_plane_init(struct virtio_gpu_device *vgdev,
>>  	struct drm_plane *plane;
>>  	const uint32_t *formats;
>>  	int nformats;
>> +	int ret;
>>  
>>  	if (type == DRM_PLANE_TYPE_CURSOR) {
>>  		formats = virtio_gpu_cursor_formats;
>> @@ -610,5 +612,17 @@ struct drm_plane *virtio_gpu_plane_init(struct virtio_gpu_device *vgdev,
>>  	if (type == DRM_PLANE_TYPE_PRIMARY)
>>  		drm_plane_enable_fb_damage_clips(plane);
>>  
>> +	if (type == DRM_PLANE_TYPE_CURSOR) {
>> +		/*
>> +		 * The cursor plane exposes a format with an alpha channel,
>> +		 * which requires a blend mode property. The host blends
>> +		 * premultiplied alpha, matching the property's default.
>> +		 */
>> +		ret = drm_plane_create_blend_mode_property(plane,
>> +							   BIT(DRM_MODE_BLEND_PREMULTI));
>> +		if (ret)
>> +			return ERR_PTR(ret);
>> +	}
>> +
>>  	return plane;
>>  }
> Applied to misc-fixes, thanks!


This duplicates commit f2e64f450c16 ("drm/virtio: create blend mode property on cursor
plane") merged a bit earlier, what in turn results in double call to
drm_plane_create_blend_mode_property() what confuses userspace (modetest tool crashes).

Best regards
-- 
Marek Szyprowski, PhD
Samsung R&D Institute Poland


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] drm/virtio: Add pixel blend mode property to cursor plane
  2026-10-01 18:00     ` Marek Szyprowski
@ 2026-10-02 10:26       ` Dmitry Osipenko
  0 siblings, 0 replies; 4+ messages in thread
From: Dmitry Osipenko @ 2026-10-02 10:26 UTC (permalink / raw)
  To: Marek Szyprowski, oushixiong1025, David Airlie
  Cc: Gerd Hoffmann, Gurchetan Singh, Chia-I Wu, Maarten Lankhorst,
	Maxime Ripard, Thomas Zimmermann, Simona Vetter, dri-devel,
	virtualization, linux-kernel, Shixiong Ou, Ye Liu

On 10/1/26 21:00, Marek Szyprowski wrote:
> On 20.09.2026 20:21, Dmitry Osipenko wrote:
>> On 8/28/26 12:01, oushixiong1025@163.com wrote:
>>> From: Shixiong Ou <oushixiong@kylinos.cn>
>>>
>>> The cursor plane exposes a format with an alpha channel
>>> (DRM_FORMAT_ARGB8888) without a pixel blend mode property. Since
>>> commit 860e748bddcc ("drm: ensure blend mode supported if pixel
>>> format with alpha exposed") this triggers a warning during
>>> drm_mode_config_validate():
>>>
>>> [    0.649020] ------------[ cut here ]------------
>>> [    0.649040] [PLANE:36:plane-1] pixel format with alpha exposed but blend mode not setup
>>> [    0.649081] WARNING: drivers/gpu/drm/drm_mode_config.c:872 at drm_mode_config_validate
>>> ......
>>> [    0.649761] Call trace:
>>> [    0.649764]  drm_mode_config_validate+0x398/0x558 [drm] (P)
>>> [    0.649912]  drm_dev_register+0x1cc/0x2a0 [drm]
>>> [    0.650058]  virtio_gpu_probe+0xd4/0x1c0 [virtio_gpu]
>>> [    0.650088]  virtio_dev_probe+0x1c8/0x310
>>> ......
>>> [    0.650261] ---[ end trace 0000000000000000 ]---
>>>
>>>
>>> Create the property with the only supported blend mode,
>>> DRM_MODE_BLEND_PREMULTI, which is also the property's default and
>>> matches what userspace had to assume before the property existed.
>>>
>>> Reported-by: Ye Liu <liuye@kylinos.cn>
>>> Signed-off-by: Shixiong Ou <oushixiong@kylinos.cn>
>>> ---
>>>  drivers/gpu/drm/virtio/virtgpu_plane.c | 14 ++++++++++++++
>>>  1 file changed, 14 insertions(+)
>>>
>>> diff --git a/drivers/gpu/drm/virtio/virtgpu_plane.c b/drivers/gpu/drm/virtio/virtgpu_plane.c
>>> index 1d1b27ece62a..11771c943ea6 100644
>>> --- a/drivers/gpu/drm/virtio/virtgpu_plane.c
>>> +++ b/drivers/gpu/drm/virtio/virtgpu_plane.c
>>> @@ -24,6 +24,7 @@
>>>   */
>>>  
>>>  #include <drm/drm_atomic_helper.h>
>>> +#include <drm/drm_blend.h>
>>>  #include <drm/drm_damage_helper.h>
>>>  #include <drm/drm_fourcc.h>
>>>  #include <drm/drm_gem_atomic_helper.h>
>>> @@ -588,6 +589,7 @@ struct drm_plane *virtio_gpu_plane_init(struct virtio_gpu_device *vgdev,
>>>  	struct drm_plane *plane;
>>>  	const uint32_t *formats;
>>>  	int nformats;
>>> +	int ret;
>>>  
>>>  	if (type == DRM_PLANE_TYPE_CURSOR) {
>>>  		formats = virtio_gpu_cursor_formats;
>>> @@ -610,5 +612,17 @@ struct drm_plane *virtio_gpu_plane_init(struct virtio_gpu_device *vgdev,
>>>  	if (type == DRM_PLANE_TYPE_PRIMARY)
>>>  		drm_plane_enable_fb_damage_clips(plane);
>>>  
>>> +	if (type == DRM_PLANE_TYPE_CURSOR) {
>>> +		/*
>>> +		 * The cursor plane exposes a format with an alpha channel,
>>> +		 * which requires a blend mode property. The host blends
>>> +		 * premultiplied alpha, matching the property's default.
>>> +		 */
>>> +		ret = drm_plane_create_blend_mode_property(plane,
>>> +							   BIT(DRM_MODE_BLEND_PREMULTI));
>>> +		if (ret)
>>> +			return ERR_PTR(ret);
>>> +	}
>>> +
>>>  	return plane;
>>>  }
>> Applied to misc-fixes, thanks!
> 
> 
> This duplicates commit f2e64f450c16 ("drm/virtio: create blend mode property on cursor
> plane") merged a bit earlier, what in turn results in double call to
> drm_plane_create_blend_mode_property() what confuses userspace (modetest tool crashes).
Good catch, will revert this patch. Thanks!

-- 
Best regards,
Dmitry

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-10-02 10:27 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-08-28  9:01 [PATCH] drm/virtio: Add pixel blend mode property to cursor plane oushixiong1025
2026-09-20 18:21 ` Dmitry Osipenko
     [not found]   ` <CGME20261001180058eucas1p1506f92fdf0e1417404bb8025f181ae30@eucas1p1.samsung.com>
2026-10-01 18:00     ` Marek Szyprowski
2026-10-02 10:26       ` Dmitry Osipenko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®