drm: rockchip: add drm_plane_create_blend_mode_property
Subsystems (4)
PATCH v2 1/1 drm: rockchip: add drm_plane_create_blend_mode_property
A validate_blend_mode_for_alpha_formats() function was added that fills the kernel log with warnings for Rockchip VOP version 1 SoCs. Add a drm_plane_create_blend_mode_property() function as fix. VOP version 1 doesn't support blending with a pixel alpha background layer, only with a constant alpha. Advertise blending capability with DRM_MODE_BLEND_PIXEL_NONE.
---
Changed V2:
Add comment line
--- drivers/gpu/drm/rockchip/rockchip_drm_vop.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/gpu/drm/rockchip/rockchip_drm_vop.c +2 -0
@@ -1850,6 +1850,8 @@ static void vop_plane_add_properties(struct drm_plane *plane,if (flags)drm_plane_create_rotation_property (plane,DRM_MODE_ROTATE_0 ,DRM_MODE_ROTATE_0 | flags); +drm_plane_create_blend_mode_property (plane, +BIT (DRM_MODE_BLEND_PIXEL_NONE )); }static int vop_create_crtc (struct vop *vop)
---
base-commit: 9d80aa4617b32f5054c5aa471d06b66704854935
change-id: 20260909-blend-c89d2c9f6984
Best regards,
Signature · 1 line
Johan Jonker <[email protected]>
[email protected]
AI reviewThank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: - [High] The patch advertises DRM_MODE_BLEND_PIXEL_NONE as the only supported blend mode for all planes.…
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] The patch advertises DRM_MODE_BLEND_PIXEL_NONE as the only supported blend mode for all planes. However, the driver internally hardcodes pre-multiplied alpha blending for overlay planes, contradicting the advertised property and causing performance regressions in compositors. --
commit 7635dc169cfab0b1a798ba56a1baaa9f77713842
Author: Johan Jonker <[email protected]>
drm: rockchip: add drm_plane_create_blend_mode_property
A validate_blend_mode_for_alpha_formats() function was added that fills the kernel log with warnings for Rockchip VOP version 1 SoCs. Add a drm_plane_create_blend_mode_property() function as fix. VOP version 1 doesn't support blending with a pixel alpha background layer, only with a constant alpha. Advertise blending capability with DRM_MODE_BLEND_PIXEL_NONE.
drivers/gpu/drm/rockchip/rockchip_drm_vop.c static void vop_plane_add_properties(struct drm_plane *plane, · line 1854
Quoted 10 lines
drivers/gpu/drm/rockchip/rockchip_drm_vop.c +2
-0@@ -1850,6 +1850,8 @@ static void vop_plane_add_properties(struct drm_plane *plane,if (flags)drm_plane_create_rotation_property (plane,DRM_MODE_ROTATE_0 ,DRM_MODE_ROTATE_0 | flags); +drm_plane_create_blend_mode_property (plane, +BIT (DRM_MODE_BLEND_PIXEL_NONE ));
[Severity: High]
Does advertising only DRM_MODE_BLEND_PIXEL_NONE here cause a performance regression for userspace compositors?
When compositors query this property and see only DRM_MODE_BLEND_PIXEL_NONE is supported, they may assume the hardware cannot perform alpha blending at all and fall back to software or GPU composition for translucent layers like cursors and ARGB windows.
Also, does this contradict the blending mode currently programmed in the driver? Looking at vop_plane_atomic_update(), the driver explicitly programs pre-multiplied alpha blending for overlay planes if the format has alpha:
drivers/gpu/drm/rockchip/rockchip_drm_vop.c:vop_plane_atomic_update() {
...
if (fb->format->has_alpha && win_index > 0) {
...
val = SRC_ALPHA_EN(1) | SRC_COLOR_M0(ALPHA_SRC_PRE_MUL) |
...
...
VOP_WIN_SET(vop, win, alpha_pre_mul, ALPHA_SRC_PRE_MUL);
...
}
}Since the driver hardcodes pre-multiplied alpha for these planes, does this violate the advertised API contract of only supporting DRM_MODE_BLEND_PIXEL_NONE?
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
Quoted 6 lines · Johan Jonker
A
validate_blend_mode_for_alpha_formats()function was added that fills the kernel log with warnings for Rockchip VOP version 1 SoCs. Add adrm_plane_create_blend_mode_property()function as fix. VOP version 1 doesn't support blending with a pixel alpha background layer, only with a constant alpha. Advertise blending capability withDRM_MODE_BLEND_PIXEL_NONE.
On a 7.3-rc1 kernel without this patch, I saw the following:
Rock64 (RK3328):
```sh root@rock64-test:~# dmesg --level 4 | grep PLANE [ 7.567004] rockchip-drm display-subsystem: [drm] [PLANE:35:plane-0] pixel format with alpha exposed but blend mode not setup. Please fix. [ 7.567083] rockchip-drm display-subsystem: [drm] [PLANE:38:plane-1] pixel format with alpha exposed but blend mode not setup. Please fix. [ 7.567132] rockchip-drm display-subsystem: [drm] [PLANE:42:plane-2] pixel format with alpha exposed but blend mode not setup. Please fix. ```
RockPro64 (RK3399):
```sh root@rockpro64:~# dmesg --level 4 | grep PLANE [ 5.695597] rockchip-drm display-subsystem: [drm] [PLANE:35:plane-0] pixel format with alpha exposed but blend mode not setup. Please fix. [ 5.695636] rockchip-drm display-subsystem: [drm] [PLANE:38:plane-1] pixel format with alpha exposed but blend mode not setup. Please fix. [ 5.695665] rockchip-drm display-subsystem: [drm] [PLANE:42:plane-2] pixel format with alpha exposed but blend mode not setup. Please fix. [ 5.695692] rockchip-drm display-subsystem: [drm] [PLANE:45:plane-3] pixel format with alpha exposed but blend mode not setup. Please fix. [ 5.695718] rockchip-drm display-subsystem: [drm] [PLANE:48:plane-4] pixel format with alpha exposed but blend mode not setup. Please fix. [ 5.695745] rockchip-drm display-subsystem: [drm] [PLANE:51:plane-5] pixel format with alpha exposed but blend mode not setup. Please fix. ```
And on a (7.3-rc4) kernel *with* this patch, those warnings were gone. Thanks! Feel free to include
Cheers,
Diederik
Quoted 28 lines
Signed-off-by Johan Jonker <[email protected]>---
Changed V2:
Add comment line--- drivers/gpu/drm/rockchip/rockchip_drm_vop.c | 2 ++ 1 file changed, 2 insertions(+)drivers/gpu/drm/rockchip/rockchip_drm_vop.c +2
-1@@ -1850,6 +1850,8 @@ static void vop_plane_add_properties(struct drm_plane *plane,if (flags)drm_plane_create_rotation_property (plane,DRM_MODE_ROTATE_0 ,DRM_MODE_ROTATE_0 | flags); +drm_plane_create_blend_mode_property (plane, +BIT (DRM_MODE_BLEND_PIXEL_NONE )); }static int vop_create_crtc (struct vop *vop) ---base-commit:
9d80aa4617b32f5054c5aa471d06b66704854935
change-id: 20260909-blend-c89d2c9f6984Best regards,