[PATCH] drm/qxl: Add pixel blend mode property

oushixiong1025@163.com posted 1 patch 4 weeks, 1 day ago
drivers/gpu/drm/qxl/qxl_display.c | 15 ++++++++++++++-
1 file changed, 14 insertions(+), 1 deletion(-)
[PATCH] drm/qxl: Add pixel blend mode property
Posted by oushixiong1025@163.com 4 weeks, 1 day ago
From: Shixiong Ou <oushixiong@kylinos.cn>

The qxl primary and cursor 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():

[    4.252654] ------------[ cut here ]------------
[    4.252676] [PLANE:38:plane-0] pixel format with alpha exposed but blend mode not setup
[    4.252719] WARNING: drivers/gpu/drm/drm_mode_config.c:872 at drm_mode_config_validate
......
[    4.253089] Call trace:
[    4.253091]  drm_mode_config_validate+0x398/0x558 [drm] (P)
[    4.253177]  drm_dev_register+0x1cc/0x2a0 [drm]
[    4.253262]  qxl_pci_probe+0x120/0x1e0 [qxl]
[    4.253277]  local_pci_probe+0x48/0xb8
[    4.253287]  pci_call_probe+0x70/0x190
......

Blending is done by the host with premultiplied alpha, so create
the property with DRM_MODE_BLEND_PREMULTI as the only supported
mode.

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

diff --git a/drivers/gpu/drm/qxl/qxl_display.c b/drivers/gpu/drm/qxl/qxl_display.c
index 7f4178800afd..8193d08485f2 100644
--- a/drivers/gpu/drm/qxl/qxl_display.c
+++ b/drivers/gpu/drm/qxl/qxl_display.c
@@ -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>
@@ -991,13 +992,25 @@ static struct drm_plane *qxl_create_plane(struct qxl_device *qdev,
 	if (err)
 		goto free_plane;
 
+	/*
+	 * Both planes expose formats with an alpha channel. Blending is
+	 * done by the host with premultiplied alpha, which is also the
+	 * property's default value.
+	 */
+	err = drm_plane_create_blend_mode_property(plane,
+						   BIT(DRM_MODE_BLEND_PREMULTI));
+	if (err) {
+		drm_plane_cleanup(plane);
+		goto free_plane;
+	}
+
 	drm_plane_helper_add(plane, helper_funcs);
 
 	return plane;
 
 free_plane:
 	kfree(plane);
-	return ERR_PTR(-EINVAL);
+	return ERR_PTR(err);
 }
 
 static int qdev_crtc_init(struct drm_device *dev, int crtc_id)
-- 
2.25.1

No virus found
		Checked by Hillstone Network AntiVirus