From: Shixiong Ou <[email protected]> The vkms planes expose formats with an alpha channel but do not create the 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():
[ 993.538979] ------------[ cut here ]------------ [ 993.539000] [PLANE:35:plane-0] pixel format with alpha exposed but blend mode not setup [ 993.539063] WARNING: drivers/gpu/drm/drm_mode_config.c:872 at drm_mode_config_validate ...... [ 993.539578] Call trace: [ 993.539580] drm_mode_config_validate+0x398/0x558 [drm] (P) [ 993.539707] drm_dev_register+0x1cc/0x2a0 [drm] [ 993.539832] vkms_create+0x184/0x1d0 [vkms] [ 993.539854] vkms_init+0x78/0xff8 [vkms] ...... The vkms composer only blends premultiplied alpha, see pre_mul_alpha_blend(), so create the property with DRM_MODE_BLEND_PREMULTI as the only supported mode. Reported-by: Ye Liu <[email protected]> Signed-off-by: Shixiong Ou <[email protected]> Reviewed-by: Leandro Ribeiro <[email protected]> --- v1->v2: - Update the stale comment above pre_mul_alpha_blend(): the DRM-wide premultiplied-alpha assumption no longer holds, vkms only implements the pre-multiplied blend mode.(Leandro Ribeiro) drivers/gpu/drm/vkms/vkms_composer.c | 8 ++++---- drivers/gpu/drm/vkms/vkms_plane.c | 10 ++++++++++ 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/vkms/vkms_composer.c b/drivers/gpu/drm/vkms/vkms_composer.c index a238d40a49f9..c9e1cb10849e 100644 --- a/drivers/gpu/drm/vkms/vkms_composer.c +++ b/drivers/gpu/drm/vkms/vkms_composer.c @@ -36,10 +36,10 @@ static u16 pre_mul_blend_channel(u16 src, u16 dst, u16 alpha) * The pixels [@x_start;@x_start+@pixel_count) in stage_buffer are blended at * [@x_start;@x_start+@pixel_count) in output_buffer. * - * The current DRM assumption is that pixel color values have been already - * pre-multiplied with the alpha channel values. See more - * drm_plane_create_blend_mode_property(). Also, this formula assumes a - * completely opaque background. + * vkms only implements the pre-multiplied blend mode (see + * drm_plane_create_blend_mode_property()), so the pixel color values are + * expected to be already pre-multiplied with the alpha channel values. + * Also, this formula assumes a completely opaque background. */ static void pre_mul_alpha_blend(const struct line_buffer *stage_buffer, struct line_buffer *output_buffer, int x_start, int pixel_count) diff --git a/drivers/gpu/drm/vkms/vkms_plane.c b/drivers/gpu/drm/vkms/vkms_plane.c index 6ee5c3f3207c..c4272f5f0354 100644 --- a/drivers/gpu/drm/vkms/vkms_plane.c +++ b/drivers/gpu/drm/vkms/vkms_plane.c @@ -276,6 +276,7 @@ struct vkms_plane *vkms_plane_init(struct vkms_device *vkmsdev, { struct drm_device *dev = &vkmsdev->drm; struct vkms_plane *plane; + int ret; plane = drmm_universal_plane_alloc(dev, struct vkms_plane, base, 0, &vkms_plane_funcs, @@ -287,6 +288,15 @@ struct vkms_plane *vkms_plane_init(struct vkms_device *vkmsdev, drm_plane_helper_add(&plane->base, &vkms_plane_helper_funcs); + /* + * The vkms composer only blends premultiplied alpha, see + * pre_mul_alpha_blend(), so that is the only supported mode. + */ + ret = drm_plane_create_blend_mode_property(&plane->base, + BIT(DRM_MODE_BLEND_PREMULTI)); + if (ret) + return ERR_PTR(ret); + drm_plane_create_rotation_property(&plane->base, DRM_MODE_ROTATE_0, DRM_MODE_ROTATE_MASK | DRM_MODE_REFLECT_MASK); -- 2.25.1 No virus found Checked by Hillstone Network AntiVirus
