Skip to contentSkip to conversation

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

PATCH Superseded Qinyun Tan 2 participants 7 messages Sep 1

Subsystems (7)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Qinyun Tan

author
#0 lore raw

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.

These planes have always blended with pre-multiplied alpha: the hardware (or host-side compositor for the virtual drivers) is fixed function with no configurable blend mode, and userspace has historically assumed pre-multiplied blending when the property is not attached, which is also the documented default of the property. So each patch simply exposes the "pixel blend mode" property advertising only DRM_MODE_BLEND_PREMULTI, making the existing semantics explicit and silencing the warning. No functional change.

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 now exposes the "pixel blend mode" property with Pre-multiplied as the only and current value. The qxl, virtio and vboxvideo patches follow the identical pattern and are compile-tested.

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 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

The hardware cursor has always blended with pre-multiplied alpha and userspace assumes that blend mode when the property is not attached. Expose a "pixel blend mode" property advertising only DRM_MODE_BLEND_PREMULTI to make the existing semantics explicit and silence the warning. No functional change.

Fixes 860e748bddcc ("drm: ensure blend mode supported if pixel format with alpha exposed")
---
 drivers/gpu/drm/ast/ast_cursor.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/gpu/drm/ast/ast_cursor.c +3 -0
index fd19c45f2abe2..08d93ac7f7cb8 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_PREMULTI));
 
 	return 0;
 }
Signature · 1 line
2.43.7
author
#4 lore raw

PATCH 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.

The planes have always blended with pre-multiplied alpha and userspace assumes that blend mode when the property is not attached. Expose a "pixel blend mode" property advertising only DRM_MODE_BLEND_PREMULTI to make the existing semantics explicit and silence the warning. No functional change.

Fixes 860e748bddcc ("drm: ensure blend mode supported if pixel format with alpha exposed")
---
 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
author
#5 lore raw

PATCH 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 cursor has always blended with pre-multiplied alpha and userspace assumes that blend mode when the property is not attached. Expose a "pixel blend mode" property advertising only DRM_MODE_BLEND_PREMULTI to make the existing 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")
---
 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
author
#6 lore raw

PATCH 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.

The planes have always blended with pre-multiplied alpha and userspace assumes that blend mode when the property is not attached. Expose a "pixel blend mode" property advertising only DRM_MODE_BLEND_PREMULTI to make the existing semantics explicit and silence the warning. No functional change.

Fixes 860e748bddcc ("drm: ensure blend mode supported if pixel format with alpha exposed")
---
 drivers/gpu/drm/vboxvideo/vbox_mode.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/gpu/drm/vboxvideo/vbox_mode.c +4 -0
index 8e4e5fc9d3c5a..658803646eee2 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_PREMULTI));
+
 	return plane;
 
 free_plane:
Signature · 1 line
2.43.7
#2 lore raw

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

In reply to Qinyun Tan

Hi

Am 01.09.26 um 08:50 schrieb Qinyun Tan:

Quoted 39 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

The hardware cursor has always blended with pre-multiplied alpha and userspace assumes that blend mode when the property is not attached. Expose a "pixel blend mode" property advertising only DRM_MODE_BLEND_PREMULTI to make the existing semantics explicit and silence the warning. No functional change.

Fixes 860e748bddcc ("drm: ensure blend mode supported if pixel format with alpha exposed")
---
  drivers/gpu/drm/ast/ast_cursor.c | 3 +++
  1 file changed, 3 insertions(+)
drivers/gpu/drm/ast/ast_cursor.c +1 -0
index fd19c45f2abe2..08d93ac7f7cb8 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>

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

Quoted 5 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_PREMULTI));

AFAIU the available documentation, AST hardware corresponds to DRM_MODE_BLEND_COVERAGE.

Best regards
Thomas

Quoted 3 lines
drivers/gpu/drm/ast/ast_cursor.c +0 -0
  	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
#3 lore raw

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

Hi Thomas,

Quoted 40 lines · Thomas Zimmermann

Hi

Am 01.09.26 um 08:50 schrieb Qinyun Tan:

Quoted 37 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

The hardware cursor has always blended with pre-multiplied alpha and userspace assumes that blend mode when the property is not attached. Expose a "pixel blend mode" property advertising only DRM_MODE_BLEND_PREMULTI to make the existing semantics explicit and silence the warning. No functional change.

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

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

  1 file changed, 3 insertions(+)
drivers/gpu/drm/ast/ast_cursor.c +1 -0
index fd19c45f2abe2..08d93ac7f7cb8 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>
Quoted 9 lines

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_PREMULTI));

AFAIU the available documentation, AST hardware corresponds to DRM_MODE_BLEND_COVERAGE.

Thanks for the correction.

I'll send a v2 that declares DRM_MODE_BLEND_COVERAGE for the ast cursor plane instead.

Quoted 6 lines

Best regards
Thomas

Quoted 2 lines
drivers/gpu/drm/ast/ast_cursor.c +0 -0
         return 0;
   }