Skip to contentSkip to conversation

drm: create blend mode property on alpha-capable planes of simple drivers

PATCH In review Qinyun Tan 3 participants 16 messages Sep 1 – Sep 4

Subsystems (7)
lore
Share & tools
lore

Qinyun Tan

author
#0 lore raw

v2 cover drm: create blend mode property on alpha-capable planes of simple drivers

Since commit 860e748bddcc ("drm: ensure blend mode supported if pixel format with alpha exposed"), drm_mode_config_validate() warns when a plane exposes an alpha pixel format but does not create the "pixel blend mode" property. Several simple/virtual drivers trip this on driver load. I hit the ast one on an ASPEED AST2600 BMC:

[PLANE:37:plane-1] pixel format with alpha exposed but blend mode not setup

  WARNING: drivers/gpu/drm/drm_mode_config.c:872 at drm_mode_config_validate+0x48f/0x510 [drm]
  ...
  Call Trace:
   drm_dev_register+0x1ce/0x290 [drm]
   ast_pci_probe+0x19d/0x3f0 [ast]
   local_pci_probe+0x41/0x90

These four drivers share the same gap; this series covers ast, qxl, virtio-gpu and vboxvideo. Each patch creates the "pixel blend mode" property advertising the single blend mode the device actually implements, based on the following:

- ast: the hardware cursor blends with straight alpha per the ASPEED documentation (thanks Thomas), i.e. COVERAGE.
- qxl: the SPICE protocol explicitly defines the ALPHA cursor type as a "pre-multiplied ARGB8888 pixmap" [1], i.e. PREMULTI.
- virtio-gpu: the virtio spec does not define cursor alpha semantics; the host forwards the pixels verbatim and the remote cursor protocols among its frontends (SPICE alpha cursors, the VNC "Cursor With Alpha" encoding) define pre-multiplied alpha, i.e. PREMULTI.
- vboxvideo: the host frontend loads the pointer shape verbatim into an unpremultiplied ARGB image (QImage::Format_ARGB32) before handing it to the host cursor APIs, i.e. COVERAGE.

This follows the same approach as the already-merged i915 and nouveau fixes:

67e955e073c6 ("drm/i915/display: expose blend mode on alpha-capable planes") df0311845915 ("drm/nouveau/kms/nv50-: Unconditionally create blend_mode prop for wndws")

The ast patch is verified on AST2600 hardware: the warning is gone and the cursor plane exposes the "pixel blend mode" property. The qxl, virtio and vboxvideo patches follow the identical pattern and are compile-tested.

[1] https://www.spice-space.org/spice-protocol.html
("Cursor channel definition" section)

v2:
- ast: advertise DRM_MODE_BLEND_COVERAGE instead of PREMULTI, per Thomas Zimmermann's review and the ASPEED documentation.
- vboxvideo: advertise DRM_MODE_BLEND_COVERAGE instead of PREMULTI after checking how the VirtualBox host composites the pointer shape.
- qxl, virtio: code unchanged; commit messages now cite the protocol-level justification for PREMULTI.

Qinyun Tan (4):
drm/ast: create blend mode property on cursor plane drm/qxl: create blend mode property on primary and cursor planes drm/virtio: create blend mode property on cursor plane drm/vboxvideo: create blend mode property on planes

 drivers/gpu/drm/ast/ast_cursor.c       | 3 +++
 drivers/gpu/drm/qxl/qxl_display.c      | 4 ++++
 drivers/gpu/drm/vboxvideo/vbox_mode.c  | 4 ++++
 drivers/gpu/drm/virtio/virtgpu_plane.c | 4 ++++
 4 files changed, 15 insertions(+)
Signature · 1 line
2.43.7
author
#1 lore raw

PATCH v2 1/4 drm/ast: create blend mode property on cursor plane

Since commit 860e748bddcc ("drm: ensure blend mode supported if pixel format with alpha exposed"), drm_mode_config_validate() warns when a plane exposes an alpha pixel format but not the "pixel blend mode" property. The ast cursor plane (ARGB4444, ARGB8888) trips this on driver load:

[PLANE:37:plane-1] pixel format with alpha exposed but blend mode not setup

  WARNING: drivers/gpu/drm/drm_mode_config.c:872 at drm_mode_config_validate+0x48f/0x510 [drm]
  ...
  Call Trace:
   drm_dev_register+0x1ce/0x290 [drm]
   ast_pci_probe+0x19d/0x3f0 [ast]
   local_pci_probe+0x41/0x90

Per Thomas Zimmermann's review, the ASPEED documentation describes the hardware cursor as blending with straight (non-pre-multiplied) alpha, which corresponds to DRM_MODE_BLEND_COVERAGE. Expose a "pixel blend mode" property advertising only DRM_MODE_BLEND_COVERAGE to make the hardware semantics explicit and silence the warning.

Fixes 860e748bddcc ("drm: ensure blend mode supported if pixel format with alpha exposed")

---
v2: advertise DRM_MODE_BLEND_COVERAGE instead of PREMULTI, per Thomas Zimmermann's review and the ASPEED documentation.

 drivers/gpu/drm/ast/ast_cursor.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/gpu/drm/ast/ast_cursor.c +3 -0
index fd19c45f2abe2..690d4cd1db5ee 100644
@@ -25,6 +25,7 @@
 #include <linux/sizes.h>
 
 #include <drm/drm_atomic.h>
+#include <drm/drm_blend.h>
 #include <drm/drm_damage_helper.h>
 #include <drm/drm_format_helper.h>
 #include <drm/drm_gem_atomic_helper.h>
@@ -355,6 +356,8 @@ int ast_cursor_plane_init(struct ast_device *ast)
 	}
 	drm_plane_helper_add(cursor_plane, &ast_cursor_plane_helper_funcs);
 	drm_plane_enable_fb_damage_clips(cursor_plane);
+	drm_plane_create_blend_mode_property(cursor_plane,
+					     BIT(DRM_MODE_BLEND_COVERAGE));
 
 	return 0;
 }
Signature · 1 line
2.43.7
#2 lore raw

Re: [PATCH v2 1/4] drm/ast: create blend mode property on cursor plane

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: - [High] The cursor plane's initial atomic state for the blend mode property is set to an unsupported value…

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] The cursor plane's initial atomic state for the blend mode property is set to an unsupported value (DRM_MODE_BLEND_PREMULTI), which breaks atomic state restoration. --

commit 1ab10188d3825ff30d7b2814879afdf8a8dc65e6
Author: Qinyun Tan <[email protected]>
Subject: drm/ast: create blend mode property on cursor plane

This patch adds a blend mode property to the ast cursor plane to satisfy the drm_mode_config_validate() warning about missing blend modes on planes exposing an alpha pixel format. The newly created property only advertises DRM_MODE_BLEND_COVERAGE.

Quoted 4 lines
drivers/gpu/drm/ast/ast_cursor.c +0 -0
index fd19c45f2abe2..690d4cd1db5ee 100644

[ ... ]

drivers/gpu/drm/ast/ast_cursor.c int ast_cursor_plane_init(struct ast_device *ast) · line 360

Quoted 6 lines
drivers/gpu/drm/ast/ast_cursor.c +2 -0
@@ -355,6 +356,8 @@ int ast_cursor_plane_init(struct ast_device *ast)
 	}
 	drm_plane_helper_add(cursor_plane, &ast_cursor_plane_helper_funcs);
 	drm_plane_enable_fb_damage_clips(cursor_plane);
+	drm_plane_create_blend_mode_property(cursor_plane,
+					     BIT(DRM_MODE_BLEND_COVERAGE));

[Severity: High]
Does this mismatch with the default reset hook and break atomic state restoration?

The cursor plane uses DRM_GEM_SHADOW_PLANE_FUNCS in ast_cursor_plane_funcs, which defaults to drm_gem_reset_shadow_plane(). That function calls the core DRM helper __drm_atomic_helper_plane_state_init(), which hardcodes plane_state->pixel_blend_mode = DRM_MODE_BLEND_PREMULTI. The driver does not provide a custom .reset hook to override this default.

Since the blend mode property is created here to strictly support only DRM_MODE_BLEND_COVERAGE, it doesn't support the DRM_MODE_BLEND_PREMULTI value assigned by the default reset hook.

Because of this mismatch, userspace state queries will return an invalid enum value that is not in the property's valid enum mask. If a compositor attempts to save and restore this exact state using the atomic ioctl, drm_property_change_valid_get() will reject it with -EINVAL. This could break compositor initialization, virtual terminal switching, and read-modify-write atomic commits on the cursor plane.

Could we add a custom reset hook to initialize the blend mode to DRM_MODE_BLEND_COVERAGE, or include DRM_MODE_BLEND_PREMULTI in the property's valid enum mask?

Quoted 3 lines
drivers/gpu/drm/ast/ast_cursor.c +0 -0
 	return 0;
 }
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
#3 lore raw

Re: [PATCH v2 1/4] drm/ast: create blend mode property on cursor plane

In reply to Qinyun Tan

Hi,

thanks for the updated patch.

Did you see the review from the Sashiko bot?  The default value is PRE_MULTI, but the driver only supports COVERAGE.  This needs to be changed as part of this patch. The default assignment is at [1] in __drm_atomic_helper_plane_state_init().

The ast driver needs to override drm_plane_funcs.atomic_create_state for the cursor plane to update the value pixel_blend to COVERAGE for new plane states. Same goes for vbox.

[1] https://gitlab.freedesktop.org/drm/misc/kernel/-/blob/drm-misc-next/drivers/gpu/drm/drm_atomic_state_helper.c?ref_type=heads#L281

Best regards
Thomas

Am 01.09.26 um 10:32 schrieb Qinyun Tan:

Quoted 51 lines

Since commit 860e748bddcc ("drm: ensure blend mode supported if pixel format with alpha exposed"), drm_mode_config_validate() warns when a plane exposes an alpha pixel format but not the "pixel blend mode" property. The ast cursor plane (ARGB4444, ARGB8888) trips this on driver load:

   [PLANE:37:plane-1] pixel format with alpha exposed but blend mode not setup
   WARNING: drivers/gpu/drm/drm_mode_config.c:872 at drm_mode_config_validate+0x48f/0x510 [drm]
   ...
   Call Trace:
    drm_dev_register+0x1ce/0x290 [drm]
    ast_pci_probe+0x19d/0x3f0 [ast]
    local_pci_probe+0x41/0x90

Per Thomas Zimmermann's review, the ASPEED documentation describes the hardware cursor as blending with straight (non-pre-multiplied) alpha, which corresponds to DRM_MODE_BLEND_COVERAGE. Expose a "pixel blend mode" property advertising only DRM_MODE_BLEND_COVERAGE to make the hardware semantics explicit and silence the warning.

Fixes 860e748bddcc ("drm: ensure blend mode supported if pixel format with alpha exposed")

---
v2: advertise DRM_MODE_BLEND_COVERAGE instead of PREMULTI, per Thomas Zimmermann's review and the ASPEED documentation.

  drivers/gpu/drm/ast/ast_cursor.c | 3 +++
  1 file changed, 3 insertions(+)
drivers/gpu/drm/ast/ast_cursor.c +3 -0
index fd19c45f2abe2..690d4cd1db5ee 100644
@@ -25,6 +25,7 @@
  #include <linux/sizes.h>
 
  #include <drm/drm_atomic.h>
+#include <drm/drm_blend.h>
  #include <drm/drm_damage_helper.h>
  #include <drm/drm_format_helper.h>
  #include <drm/drm_gem_atomic_helper.h>
@@ -355,6 +356,8 @@ int ast_cursor_plane_init(struct ast_device *ast)
  	}
  	drm_plane_helper_add(cursor_plane, &ast_cursor_plane_helper_funcs);
  	drm_plane_enable_fb_damage_clips(cursor_plane);
+	drm_plane_create_blend_mode_property(cursor_plane,
+					     BIT(DRM_MODE_BLEND_COVERAGE));
 
  	return 0;
  }
Signature · 6 lines
--
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Frankenstr. 146, 90461 Nürnberg, Germany, www.suse.com
GF: Jochen Jaser, Andrew McDonald, (HRB 36809, AG Nürnberg)
#4 lore raw

Re: [PATCH v2 1/4] drm/ast: create blend mode property on cursor plane

Hi

Am 01.09.26 um 13:54 schrieb Thomas Zimmermann:

Quoted 7 lines

Hi,

thanks for the updated patch.

Did you see the review from the Sashiko bot?  The default value is PRE_MULTI, but the driver only supports COVERAGE.  This needs to be changed as part of this patch. The default assignment is at [1] in __drm_atomic_helper_plane_state_init().

The ast driver needs to override drm_plane_funcs.atomic_create_state for the cursor plane to update the value pixel_blend to COVERAGE for new plane states. Same goes for vbox.

Or even better: I just sent out a patch to pick the right default value for the plane state. Let's first see what comes out of this. Patch is at [1].

[1] https://lore.kernel.org/dri-devel/[email protected]/

Best regards
Thomas

Quoted 58 lines

[1] https://gitlab.freedesktop.org/drm/misc/kernel/-/blob/drm-misc-next/drivers/gpu/drm/drm_atomic_state_helper.c?ref_type=heads#L281

Best regards
Thomas

Am 01.09.26 um 10:32 schrieb Qinyun Tan:

Quoted 49 lines

Since commit 860e748bddcc ("drm: ensure blend mode supported if pixel format with alpha exposed"), drm_mode_config_validate() warns when a plane exposes an alpha pixel format but not the "pixel blend mode" property. The ast cursor plane (ARGB4444, ARGB8888) trips this on driver load:

   [PLANE:37:plane-1] pixel format with alpha exposed but blend mode not setup

   WARNING: drivers/gpu/drm/drm_mode_config.c:872 at drm_mode_config_validate+0x48f/0x510 [drm]
   ...
   Call Trace:
    drm_dev_register+0x1ce/0x290 [drm]
    ast_pci_probe+0x19d/0x3f0 [ast]
    local_pci_probe+0x41/0x90

Per Thomas Zimmermann's review, the ASPEED documentation describes the hardware cursor as blending with straight (non-pre-multiplied) alpha, which corresponds to DRM_MODE_BLEND_COVERAGE. Expose a "pixel blend mode" property advertising only DRM_MODE_BLEND_COVERAGE to make the hardware semantics explicit and silence the warning.

Fixes 860e748bddcc ("drm: ensure blend mode supported if pixel format with alpha exposed")

---
v2: advertise DRM_MODE_BLEND_COVERAGE instead of PREMULTI, per Thomas Zimmermann's review and the ASPEED documentation.

  drivers/gpu/drm/ast/ast_cursor.c | 3 +++

  1 file changed, 3 insertions(+)
drivers/gpu/drm/ast/ast_cursor.c +3 -0
index fd19c45f2abe2..690d4cd1db5ee 100644
@@ -25,6 +25,7 @@
   #include <linux/sizes.h>
     #include <drm/drm_atomic.h>
+#include <drm/drm_blend.h>
   #include <drm/drm_damage_helper.h>
   #include <drm/drm_format_helper.h>
   #include <drm/drm_gem_atomic_helper.h>
@@ -355,6 +356,8 @@ int ast_cursor_plane_init(struct ast_device *ast)
       }
       drm_plane_helper_add(cursor_plane, &ast_cursor_plane_helper_funcs);
       drm_plane_enable_fb_damage_clips(cursor_plane);
+    drm_plane_create_blend_mode_property(cursor_plane,
+                         BIT(DRM_MODE_BLEND_COVERAGE));
         return 0;
   }
Signature · 6 lines
--
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Frankenstr. 146, 90461 Nürnberg, Germany, www.suse.com
GF: Jochen Jaser, Andrew McDonald, (HRB 36809, AG Nürnberg)
author
#5 lore raw

Re: [PATCH v2 1/4] drm/ast: create blend mode property on cursor plane

Hi Thomas,

Quoted 9 lines · Thomas Zimmermann

Hi

Am 01.09.26 um 13:54 schrieb Thomas Zimmermann:

Quoted 6 lines

Hi,

thanks for the updated patch.

Did you see the review from the Sashiko bot?  The default value is PRE_MULTI, but the driver only supports COVERAGE.  This needs to be changed as part of this patch. The default assignment is at [1] in __drm_atomic_helper_plane_state_init().

Quoted 9 lines
Quoted 1 line

The ast driver needs to override drm_plane_funcs.atomic_create_state for the cursor plane to update the value pixel_blend to COVERAGE for new plane states. Same goes for vbox.

Or even better: I just sent out a patch to pick the right default value for the plane state. Let's first see what comes out of this. Patch is at [1].

[1] https://lore.kernel.org/dri-devel/[email protected]/

Best regards
Thomas

Thanks! I did see the Sashiko bot report and had started on a v3 that overrides drm_plane_funcs.atomic_create_state in ast and vboxvideo (for vboxvideo on both the primary and cursor planes).

But your approach looks better to me: drm_plane_create_blend_mode_property() already picks DRM_MODE_BLEND_COVERAGE as the property default when PREMULTI is not supported, so initializing the plane state from the property default fixes this for every COVERAGE-only plane without per-driver boilerplate.

I'll hold off on v3 until your patch has settled.

Best regards,
Qinyun

Quoted 59 lines
Quoted 58 lines

[1] https://gitlab.freedesktop.org/drm/misc/kernel/-/blob/drm-misc-next/drivers/gpu/drm/drm_atomic_state_helper.c?ref_type=heads#L281

Best regards
Thomas

Am 01.09.26 um 10:32 schrieb Qinyun Tan:

Quoted 49 lines

Since commit 860e748bddcc ("drm: ensure blend mode supported if pixel format with alpha exposed"), drm_mode_config_validate() warns when a plane exposes an alpha pixel format but not the "pixel blend mode" property. The ast cursor plane (ARGB4444, ARGB8888) trips this on driver load:

   [PLANE:37:plane-1] pixel format with alpha exposed but blend mode not setup

   WARNING: drivers/gpu/drm/drm_mode_config.c:872 at drm_mode_config_validate+0x48f/0x510 [drm]
   ...
   Call Trace:
    drm_dev_register+0x1ce/0x290 [drm]
    ast_pci_probe+0x19d/0x3f0 [ast]
    local_pci_probe+0x41/0x90

Per Thomas Zimmermann's review, the ASPEED documentation describes the hardware cursor as blending with straight (non-pre-multiplied) alpha, which corresponds to DRM_MODE_BLEND_COVERAGE. Expose a "pixel blend mode" property advertising only DRM_MODE_BLEND_COVERAGE to make the hardware semantics explicit and silence the warning.

Fixes 860e748bddcc ("drm: ensure blend mode supported if pixel format with alpha exposed")

---
v2: advertise DRM_MODE_BLEND_COVERAGE instead of PREMULTI, per Thomas Zimmermann's review and the ASPEED documentation.

  drivers/gpu/drm/ast/ast_cursor.c | 3 +++

  1 file changed, 3 insertions(+)
drivers/gpu/drm/ast/ast_cursor.c +3 -0
index fd19c45f2abe2..690d4cd1db5ee 100644
@@ -25,6 +25,7 @@
   #include <linux/sizes.h>
     #include <drm/drm_atomic.h>
+#include <drm/drm_blend.h>
   #include <drm/drm_damage_helper.h>
   #include <drm/drm_format_helper.h>
   #include <drm/drm_gem_atomic_helper.h>
@@ -355,6 +356,8 @@ int ast_cursor_plane_init(struct ast_device *ast)
       }
       drm_plane_helper_add(cursor_plane, &ast_cursor_plane_helper_funcs);
       drm_plane_enable_fb_damage_clips(cursor_plane);
+    drm_plane_create_blend_mode_property(cursor_plane,
+                         BIT(DRM_MODE_BLEND_COVERAGE));
         return 0;
   }
#6 lore raw

Re: [PATCH v2 1/4] drm/ast: create blend mode property on cursor plane

Hi

Am 01.09.26 um 14:51 schrieb Qinyun Tan:

Quoted 25 lines

Hi Thomas,

Quoted 9 lines · Thomas Zimmermann

Hi

Am 01.09.26 um 13:54 schrieb Thomas Zimmermann:

Quoted 6 lines

Hi,

thanks for the updated patch.

Did you see the review from the Sashiko bot?  The default value is PRE_MULTI, but the driver only supports COVERAGE.  This needs to be changed as part of this patch. The default assignment is at [1] in __drm_atomic_helper_plane_state_init().

Quoted 8 lines
Quoted 1 line

The ast driver needs to override drm_plane_funcs.atomic_create_state for the cursor plane to update the value pixel_blend to COVERAGE for new plane states. Same goes for vbox.

Or even better: I just sent out a patch to pick the right default value for the plane state. Let's first see what comes out of this. Patch is at [1].

[1] https://lore.kernel.org/dri-devel/[email protected]/

Best regards
Thomas

Thanks! I did see the Sashiko bot report and had started on a v3 that overrides drm_plane_funcs.atomic_create_state in ast and vboxvideo (for vboxvideo on both the primary and cursor planes).

Quoted 7 lines

But your approach looks better to me: drm_plane_create_blend_mode_property() already picks DRM_MODE_BLEND_COVERAGE as the property default when PREMULTI is not supported, so initializing the plane state from the property default fixes this for every COVERAGE-only plane without per-driver boilerplate.

I'll hold off on v3 until your patch has settled.

Another patch just landed that fixes the problem:

https://gitlab.freedesktop.org/drm/misc/kernel/-/commit/c3080b58d81d3699cbf4dfd5ba860630fca96f4a

So I acked the rest of your series and I'll merge it in a few days. Thanks again for taking care of these drivers.

Best regards
Thomas

Quoted 61 lines

Best regards,
Qinyun

Quoted 56 lines
Quoted 56 lines

[1] https://gitlab.freedesktop.org/drm/misc/kernel/-/blob/drm-misc-next/drivers/gpu/drm/drm_atomic_state_helper.c?ref_type=heads#L281

Best regards
Thomas

Am 01.09.26 um 10:32 schrieb Qinyun Tan:

Quoted 49 lines

Since commit 860e748bddcc ("drm: ensure blend mode supported if pixel format with alpha exposed"), drm_mode_config_validate() warns when a plane exposes an alpha pixel format but not the "pixel blend mode" property. The ast cursor plane (ARGB4444, ARGB8888) trips this on driver load:

   [PLANE:37:plane-1] pixel format with alpha exposed but blend mode not setup

    WARNING: drivers/gpu/drm/drm_mode_config.c:872 at drm_mode_config_validate+0x48f/0x510 [drm]
    ...
    Call Trace:
     drm_dev_register+0x1ce/0x290 [drm]
     ast_pci_probe+0x19d/0x3f0 [ast]
     local_pci_probe+0x41/0x90

Per Thomas Zimmermann's review, the ASPEED documentation describes the hardware cursor as blending with straight (non-pre-multiplied) alpha, which corresponds to DRM_MODE_BLEND_COVERAGE. Expose a "pixel blend mode" property advertising only DRM_MODE_BLEND_COVERAGE to make the hardware semantics explicit and silence the warning.

Fixes 860e748bddcc ("drm: ensure blend mode supported if pixel format with alpha exposed")

---
v2: advertise DRM_MODE_BLEND_COVERAGE instead of PREMULTI, per Thomas Zimmermann's review and the ASPEED documentation.

   drivers/gpu/drm/ast/ast_cursor.c | 3 +++
   1 file changed, 3 insertions(+)
drivers/gpu/drm/ast/ast_cursor.c +3 -0
index fd19c45f2abe2..690d4cd1db5ee 100644
@@ -25,6 +25,7 @@
   #include <linux/sizes.h>
     #include <drm/drm_atomic.h>
+#include <drm/drm_blend.h>
   #include <drm/drm_damage_helper.h>
   #include <drm/drm_format_helper.h>
   #include <drm/drm_gem_atomic_helper.h>
@@ -355,6 +356,8 @@ int ast_cursor_plane_init(struct ast_device *ast)
       }
       drm_plane_helper_add(cursor_plane, &ast_cursor_plane_helper_funcs);
       drm_plane_enable_fb_damage_clips(cursor_plane);
+    drm_plane_create_blend_mode_property(cursor_plane,
+                         BIT(DRM_MODE_BLEND_COVERAGE));
         return 0;
   }
Signature · 6 lines
--
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Frankenstr. 146, 90461 Nürnberg, Germany, www.suse.com
GF: Jochen Jaser, Andrew McDonald, (HRB 36809, AG Nürnberg)
author
#7 lore raw

Re: [PATCH v2 1/4] drm/ast: create blend mode property on cursor plane

Hi,Thomas.

Quoted 7 lines · Thomas Zimmermann

Another patch just landed that fixes the problem:

https://gitlab.freedesktop.org/drm/misc/kernel/-/commit/c3080b58d81d3699cbf4dfd5ba860630fca96f4a

So I acked the rest of your series and I'll merge it in a few days. Thanks again for taking care of these drivers.

Great, that resolves the blend mode default concern.

Thanks for the reviews and for picking up the series! Glad I could contribute a little to these drivers -- happy to help again next time something comes up.

Best regards,
Qinyun

Quoted 4 lines

Best regards
Thomas

maintainer Reviewed-by Tested-by on v2 1/4
#8 lore raw

Re: [PATCH v2 1/4] drm/ast: create blend mode property on cursor plane

In reply to Qinyun Tan

Am 01.09.26 um 10:32 schrieb Qinyun Tan:

Quoted 20 lines

Since commit 860e748bddcc ("drm: ensure blend mode supported if pixel format with alpha exposed"), drm_mode_config_validate() warns when a plane exposes an alpha pixel format but not the "pixel blend mode" property. The ast cursor plane (ARGB4444, ARGB8888) trips this on driver load:

   [PLANE:37:plane-1] pixel format with alpha exposed but blend mode not setup
   WARNING: drivers/gpu/drm/drm_mode_config.c:872 at drm_mode_config_validate+0x48f/0x510 [drm]
   ...
   Call Trace:
    drm_dev_register+0x1ce/0x290 [drm]
    ast_pci_probe+0x19d/0x3f0 [ast]
    local_pci_probe+0x41/0x90

Per Thomas Zimmermann's review, the ASPEED documentation describes the hardware cursor as blending with straight (non-pre-multiplied) alpha, which corresponds to DRM_MODE_BLEND_COVERAGE. Expose a "pixel blend mode" property advertising only DRM_MODE_BLEND_COVERAGE to make the hardware semantics explicit and silence the warning.

Quoted 3 lines
Fixes 860e748bddcc ("drm: ensure blend mode supported if pixel format with alpha exposed")
Quoted 28 lines

---
v2: advertise DRM_MODE_BLEND_COVERAGE instead of PREMULTI, per Thomas Zimmermann's review and the ASPEED documentation.

  drivers/gpu/drm/ast/ast_cursor.c | 3 +++
  1 file changed, 3 insertions(+)
drivers/gpu/drm/ast/ast_cursor.c +3 -0
index fd19c45f2abe2..690d4cd1db5ee 100644
@@ -25,6 +25,7 @@
  #include <linux/sizes.h>
 
  #include <drm/drm_atomic.h>
+#include <drm/drm_blend.h>
  #include <drm/drm_damage_helper.h>
  #include <drm/drm_format_helper.h>
  #include <drm/drm_gem_atomic_helper.h>
@@ -355,6 +356,8 @@ int ast_cursor_plane_init(struct ast_device *ast)
  	}
  	drm_plane_helper_add(cursor_plane, &ast_cursor_plane_helper_funcs);
  	drm_plane_enable_fb_damage_clips(cursor_plane);
+	drm_plane_create_blend_mode_property(cursor_plane,
+					     BIT(DRM_MODE_BLEND_COVERAGE));
 
  	return 0;
  }
Signature · 6 lines
--
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Frankenstr. 146, 90461 Nürnberg, Germany, www.suse.com
GF: Jochen Jaser, Andrew McDonald, (HRB 36809, AG Nürnberg)
author
#9 lore raw

PATCH v2 2/4 drm/qxl: create blend mode property on primary and cursor planes

In reply to Qinyun Tan

Since commit 860e748bddcc ("drm: ensure blend mode supported if pixel format with alpha exposed"), drm_mode_config_validate() warns when a plane exposes an alpha pixel format but not the "pixel blend mode" property. Both the qxl primary and cursor planes expose ARGB8888 and trip this on driver load.

qxl submits cursors as SPICE_CURSOR_TYPE_ALPHA, which the SPICE protocol explicitly defines as a "pre-multiplied ARGB8888 pixmap" (Spice Protocol, "Cursor channel definition" section [1]). This matches the blend mode userspace has always assumed when the property is not attached. Expose a "pixel blend mode" property advertising only DRM_MODE_BLEND_PREMULTI to make these semantics explicit and silence the warning. The primary plane is the bottom-most plane so its blend mode has no visible effect; advertise the same value there for consistency. No functional change.

[1] https://www.spice-space.org/spice-protocol.html

Fixes 860e748bddcc ("drm: ensure blend mode supported if pixel format with alpha exposed")

---
v2: no code change; cite the SPICE protocol definition of the ALPHA cursor type in the commit message.

 drivers/gpu/drm/qxl/qxl_display.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/gpu/drm/qxl/qxl_display.c +4 -0
index 7f4178800afd7..0cd1456cca347 100644
@@ -30,6 +30,7 @@
 #include <drm/drm_drv.h>
 #include <drm/drm_atomic.h>
 #include <drm/drm_atomic_helper.h>
+#include <drm/drm_blend.h>
 #include <drm/drm_edid.h>
 #include <drm/drm_encoder.h>
 #include <drm/drm_framebuffer.h>
@@ -993,6 +994,9 @@ static struct drm_plane *qxl_create_plane(struct qxl_device *qdev,
 
 	drm_plane_helper_add(plane, helper_funcs);
 
+	drm_plane_create_blend_mode_property(plane,
+					     BIT(DRM_MODE_BLEND_PREMULTI));
+
 	return plane;
 
 free_plane:
Signature · 1 line
2.43.7
maintainer Reviewed-by on v2 2/4
#10 lore raw

Re: [PATCH v2 2/4] drm/qxl: create blend mode property on primary and cursor planes

Am 01.09.26 um 10:32 schrieb Qinyun Tan:

Quoted 16 lines

Since commit 860e748bddcc ("drm: ensure blend mode supported if pixel format with alpha exposed"), drm_mode_config_validate() warns when a plane exposes an alpha pixel format but not the "pixel blend mode" property. Both the qxl primary and cursor planes expose ARGB8888 and trip this on driver load.

qxl submits cursors as SPICE_CURSOR_TYPE_ALPHA, which the SPICE protocol explicitly defines as a "pre-multiplied ARGB8888 pixmap" (Spice Protocol, "Cursor channel definition" section [1]). This matches the blend mode userspace has always assumed when the property is not attached. Expose a "pixel blend mode" property advertising only DRM_MODE_BLEND_PREMULTI to make these semantics explicit and silence the warning. The primary plane is the bottom-most plane so its blend mode has no visible effect; advertise the same value there for consistency. No functional change.

Quoted 4 lines

[1] https://www.spice-space.org/spice-protocol.html

Fixes 860e748bddcc ("drm: ensure blend mode supported if pixel format with alpha exposed")
Quoted 29 lines

---
v2: no code change; cite the SPICE protocol definition of the ALPHA cursor type in the commit message.

  drivers/gpu/drm/qxl/qxl_display.c | 4 ++++
  1 file changed, 4 insertions(+)
drivers/gpu/drm/qxl/qxl_display.c +4 -0
index 7f4178800afd7..0cd1456cca347 100644
@@ -30,6 +30,7 @@
  #include <drm/drm_drv.h>
  #include <drm/drm_atomic.h>
  #include <drm/drm_atomic_helper.h>
+#include <drm/drm_blend.h>
  #include <drm/drm_edid.h>
  #include <drm/drm_encoder.h>
  #include <drm/drm_framebuffer.h>
@@ -993,6 +994,9 @@ static struct drm_plane *qxl_create_plane(struct qxl_device *qdev,
 
  	drm_plane_helper_add(plane, helper_funcs);
 
+	drm_plane_create_blend_mode_property(plane,
+					     BIT(DRM_MODE_BLEND_PREMULTI));
+
  	return plane;
 
  free_plane:
Signature · 6 lines
--
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Frankenstr. 146, 90461 Nürnberg, Germany, www.suse.com
GF: Jochen Jaser, Andrew McDonald, (HRB 36809, AG Nürnberg)
author
#11 lore raw

PATCH v2 3/4 drm/virtio: create blend mode property on cursor plane

In reply to Qinyun Tan

Since commit 860e748bddcc ("drm: ensure blend mode supported if pixel format with alpha exposed"), drm_mode_config_validate() warns when a plane exposes an alpha pixel format but not the "pixel blend mode" property. The virtio-gpu cursor plane (HOST_ARGB8888) trips this.

The virtio-gpu specification does not define the cursor alpha semantics. The host forwards the cursor pixels verbatim to its display frontends, and the remote cursor protocols among them (SPICE alpha cursors, the VNC "Cursor With Alpha" encoding) both define pre-multiplied alpha, matching what userspace has always assumed when the property is not attached. Expose a "pixel blend mode" property advertising only DRM_MODE_BLEND_PREMULTI to make these semantics explicit and silence the warning. The primary plane only exposes HOST_XRGB8888, so the call is gated to the cursor. No functional change.

Fixes 860e748bddcc ("drm: ensure blend mode supported if pixel format with alpha exposed")

---
v2: no code change; explain the protocol-level justification for PREMULTI in the commit message.

 drivers/gpu/drm/virtio/virtgpu_plane.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/gpu/drm/virtio/virtgpu_plane.c +4 -0
index 1d1b27ece62a7..640815af40980 100644
@@ -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>
@@ -609,6 +610,9 @@ 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);
+	else if (type == DRM_PLANE_TYPE_CURSOR)
+		drm_plane_create_blend_mode_property(plane,
+						     BIT(DRM_MODE_BLEND_PREMULTI));
 
 	return plane;
 }
Signature · 1 line
2.43.7
maintainer Reviewed-by on v2 3/4
#12 lore raw

Re: [PATCH v2 3/4] drm/virtio: create blend mode property on cursor plane

Am 01.09.26 um 10:32 schrieb Qinyun Tan:

Quoted 16 lines

Since commit 860e748bddcc ("drm: ensure blend mode supported if pixel format with alpha exposed"), drm_mode_config_validate() warns when a plane exposes an alpha pixel format but not the "pixel blend mode" property. The virtio-gpu cursor plane (HOST_ARGB8888) trips this.

The virtio-gpu specification does not define the cursor alpha semantics. The host forwards the cursor pixels verbatim to its display frontends, and the remote cursor protocols among them (SPICE alpha cursors, the VNC "Cursor With Alpha" encoding) both define pre-multiplied alpha, matching what userspace has always assumed when the property is not attached. Expose a "pixel blend mode" property advertising only DRM_MODE_BLEND_PREMULTI to make these semantics explicit and silence the warning. The primary plane only exposes HOST_XRGB8888, so the call is gated to the cursor. No functional change.

Quoted 2 lines
Fixes 860e748bddcc ("drm: ensure blend mode supported if pixel format with alpha exposed")
Quoted 29 lines

---
v2: no code change; explain the protocol-level justification for PREMULTI in the commit message.

  drivers/gpu/drm/virtio/virtgpu_plane.c | 4 ++++
  1 file changed, 4 insertions(+)
drivers/gpu/drm/virtio/virtgpu_plane.c +4 -0
index 1d1b27ece62a7..640815af40980 100644
@@ -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>
@@ -609,6 +610,9 @@ 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);
+	else if (type == DRM_PLANE_TYPE_CURSOR)
+		drm_plane_create_blend_mode_property(plane,
+						     BIT(DRM_MODE_BLEND_PREMULTI));
 
  	return plane;
  }
Signature · 6 lines
--
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Frankenstr. 146, 90461 Nürnberg, Germany, www.suse.com
GF: Jochen Jaser, Andrew McDonald, (HRB 36809, AG Nürnberg)
author
#13 lore raw

PATCH v2 4/4 drm/vboxvideo: create blend mode property on planes

In reply to Qinyun Tan

Since commit 860e748bddcc ("drm: ensure blend mode supported if pixel format with alpha exposed"), drm_mode_config_validate() warns when a plane exposes an alpha pixel format but not the "pixel blend mode" property. Both the vboxvideo primary and cursor planes expose ARGB8888 and trip this on driver load.

VirtualBox draws the cursor through the host windowing system, which treats the guest-supplied pointer shape as straight (non-pre-multiplied) alpha: the host frontend loads the pixels verbatim into an unpremultiplied ARGB image before handing them to the host cursor APIs. This corresponds to DRM_MODE_BLEND_COVERAGE. Expose a "pixel blend mode" property advertising only DRM_MODE_BLEND_COVERAGE to make these semantics explicit and silence the warning. The primary plane's alpha channel is ignored by the host (opaque blit) and it is the bottom-most plane anyway; advertise the same value there for consistency.

Fixes 860e748bddcc ("drm: ensure blend mode supported if pixel format with alpha exposed")

---
v2: advertise DRM_MODE_BLEND_COVERAGE instead of PREMULTI after checking how the VirtualBox host composites the pointer shape.

 drivers/gpu/drm/vboxvideo/vbox_mode.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/gpu/drm/vboxvideo/vbox_mode.c +4 -0
index 8e4e5fc9d3c5a..3c41238a82685 100644
@@ -15,6 +15,7 @@
 
 #include <drm/drm_atomic.h>
 #include <drm/drm_atomic_helper.h>
+#include <drm/drm_blend.h>
 #include <drm/drm_edid.h>
 #include <drm/drm_fb_helper.h>
 #include <drm/drm_fourcc.h>
@@ -540,6 +541,9 @@ static struct drm_plane *vbox_create_plane(struct vbox_private *vbox,
 
 	drm_plane_helper_add(plane, helper_funcs);
 
+	drm_plane_create_blend_mode_property(plane,
+					     BIT(DRM_MODE_BLEND_COVERAGE));
+
 	return plane;
 
 free_plane:
Signature · 1 line
2.43.7
#14 lore raw

Re: [PATCH v2 4/4] drm/vboxvideo: create blend mode property on planes

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: - [High] The plane's pixel_blend_mode atomic state defaults to DRM_MODE_BLEND_PREMULTI, but the driver only…

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] The plane's pixel_blend_mode atomic state defaults to DRM_MODE_BLEND_PREMULTI, but the driver only exposes DRM_MODE_BLEND_COVERAGE, resulting in an invalid initial atomic state that causes atomic commits to fail. --

commit e1e7e08f37513293cd7928eb76a6d3c06de1c985
Author: Qinyun Tan <[email protected]>

drm/vboxvideo: create blend mode property on planes

This commit exposes a "pixel blend mode" property advertising only DRM_MODE_BLEND_COVERAGE for vboxvideo primary and cursor planes to match host compositing semantics and silence a DRM core warning.

Quoted 4 lines
drivers/gpu/drm/vboxvideo/vbox_mode.c +0 -0
index 8e4e5fc9d3c5a..3c41238a82685 100644

[ ... ]

drivers/gpu/drm/vboxvideo/vbox_mode.c static struct drm_plane *vbox_create_plane(struct vbox_private *vbox, · line 546

Quoted 7 lines
drivers/gpu/drm/vboxvideo/vbox_mode.c +3 -0
@@ -540,6 +541,9 @@ static struct drm_plane *vbox_create_plane(struct vbox_private *vbox,
 
 	drm_plane_helper_add(plane, helper_funcs);
 
+	drm_plane_create_blend_mode_property(plane,
+					     BIT(DRM_MODE_BLEND_COVERAGE));
+

[Severity: High]
Will this cause atomic commits to fail with -EINVAL due to an invalid initial atomic state?

The blend mode property is restricted here to allow only DRM_MODE_BLEND_COVERAGE. However, the primary plane uses drm_atomic_helper_plane_reset() and the cursor plane uses DRM_GEM_SHADOW_PLANE_FUNCS (which provides drm_gem_reset_shadow_plane()).

Both of these default reset hooks rely on __drm_atomic_helper_plane_state_reset(), which unconditionally hardcodes the initial state to PREMULTI:

__drm_atomic_helper_plane_state_reset() {
    ...
    state->pixel_blend_mode = DRM_MODE_BLEND_PREMULTI;
    ...
}

Since the driver does not provide a custom reset hook to override this default and explicitly set plane_state->pixel_blend_mode to DRM_MODE_BLEND_COVERAGE, does this leave the initial atomic state set to a mode (PREMULTI) that isn't supported by the property?

If generic compositors read this initial state and pass it back during commits, will the DRM core's validation reject it because the property only exposes COVERAGE?

Quoted 3 lines
drivers/gpu/drm/vboxvideo/vbox_mode.c +0 -0
 	return plane;
 
 free_plane:
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=4
maintainer Acked-by on v2 4/4
#15 lore raw

Re: [PATCH v2 4/4] drm/vboxvideo: create blend mode property on planes

In reply to Qinyun Tan

Am 01.09.26 um 10:32 schrieb Qinyun Tan:

Quoted 17 lines

Since commit 860e748bddcc ("drm: ensure blend mode supported if pixel format with alpha exposed"), drm_mode_config_validate() warns when a plane exposes an alpha pixel format but not the "pixel blend mode" property. Both the vboxvideo primary and cursor planes expose ARGB8888 and trip this on driver load.

VirtualBox draws the cursor through the host windowing system, which treats the guest-supplied pointer shape as straight (non-pre-multiplied) alpha: the host frontend loads the pixels verbatim into an unpremultiplied ARGB image before handing them to the host cursor APIs. This corresponds to DRM_MODE_BLEND_COVERAGE. Expose a "pixel blend mode" property advertising only DRM_MODE_BLEND_COVERAGE to make these semantics explicit and silence the warning. The primary plane's alpha channel is ignored by the host (opaque blit) and it is the bottom-most plane anyway; advertise the same value there for consistency.

Quoted 2 lines
Fixes 860e748bddcc ("drm: ensure blend mode supported if pixel format with alpha exposed")
Quoted 29 lines

---
v2: advertise DRM_MODE_BLEND_COVERAGE instead of PREMULTI after checking how the VirtualBox host composites the pointer shape.

  drivers/gpu/drm/vboxvideo/vbox_mode.c | 4 ++++
  1 file changed, 4 insertions(+)
drivers/gpu/drm/vboxvideo/vbox_mode.c +4 -0
index 8e4e5fc9d3c5a..3c41238a82685 100644
@@ -15,6 +15,7 @@
 
  #include <drm/drm_atomic.h>
  #include <drm/drm_atomic_helper.h>
+#include <drm/drm_blend.h>
  #include <drm/drm_edid.h>
  #include <drm/drm_fb_helper.h>
  #include <drm/drm_fourcc.h>
@@ -540,6 +541,9 @@ static struct drm_plane *vbox_create_plane(struct vbox_private *vbox,
 
  	drm_plane_helper_add(plane, helper_funcs);
 
+	drm_plane_create_blend_mode_property(plane,
+					     BIT(DRM_MODE_BLEND_COVERAGE));
+
  	return plane;
 
  free_plane:
Signature · 6 lines
--
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Frankenstr. 146, 90461 Nürnberg, Germany, www.suse.com
GF: Jochen Jaser, Andrew McDonald, (HRB 36809, AG Nürnberg)