[PATCH 1/8] display: fix blend_mode for non-overlay planes

Bert Karwatzki <[email protected]>
Newsgroups org.freedesktop.lists.amd-gfx,org.kernel.vger.linux-kernel,org.kernel.vger.linux-next
Message-ID <[email protected]>
Previously drm_plane_create_blend_mode_property() was only called for
planes of type DRM_PLANE_TYPE_OVERLAY. Since commit commit 860e748bddcc
("drm: ensure blend mode supported if pixel format with alpha exposed")
this results in warnings from validate_blend_mode_for_alpha_formats().
We fix this here by calling drm_plane_create_blend_mode_property() for
all plane types if the plane is supporting a format with
per_pixel_alpha.

Signed-off-by: Bert Karwatzki <[email protected]>
---
 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_crtc.c  | 5 ++++-
 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_plane.c | 3 +--
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_crtc.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_crtc.c
index 62eac6e65334..a6a54351ea56 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_crtc.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_crtc.c
@@ -755,13 +755,16 @@ int amdgpu_dm_crtc_init(struct amdgpu_display_manager *dm,
 	struct drm_plane *cursor_plane;
 	bool has_degamma;
 	int res = -ENOMEM;
+	struct dc_plane_cap dummy_cap = {
+		.per_pixel_alpha = 1,
+	};
 
 	cursor_plane = kzalloc_obj(*cursor_plane);
 	if (!cursor_plane)
 		goto fail;
 
 	cursor_plane->type = DRM_PLANE_TYPE_CURSOR;
-	res = amdgpu_dm_plane_init(dm, cursor_plane, 0, NULL);
+	res = amdgpu_dm_plane_init(dm, cursor_plane, 0, &dummy_cap);
 
 	acrtc = kzalloc_obj(struct amdgpu_crtc);
 	if (!acrtc)
diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_plane.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_plane.c
index 824ef3ce5de0..4c0c6a8a0dac 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_plane.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_plane.c
@@ -2208,8 +2208,7 @@ int amdgpu_dm_plane_init(struct amdgpu_display_manager *dm,
 	if (res)
 		return res;
 
-	if (plane->type == DRM_PLANE_TYPE_OVERLAY &&
-	    plane_cap && plane_cap->per_pixel_alpha) {
+	if (plane_cap && plane_cap->per_pixel_alpha) {
 		unsigned int blend_caps = BIT(DRM_MODE_BLEND_PIXEL_NONE) |
 					  BIT(DRM_MODE_BLEND_PREMULTI) |
 					  BIT(DRM_MODE_BLEND_COVERAGE);
-- 
2.55.0
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.