validate_blend_mode_for_alpha_formats() warns when a plane supports
formats with alpha but doesn't expose the blend mode property. Fix this
by adding the same blend modes to primary plane, since they are all
universal planes in DCN-generation. Cursor planes support ARGB8888
format and CURSOR_MODE_COLOR_PRE_MULTIPLIED_ALPHA is set by default
(other color formats are not implemented), so only expose support to
PREMULTI, which is the default blend mode on DRM.
Fixes: 860e748bddcc ("drm: ensure blend mode supported if pixel format with
alpha exposed")
Signed-off-by: Melissa Wen <[email protected]>
---
.../drm/amd/display/amdgpu_dm/amdgpu_dm_plane.c | 14 +++++++++++++-
1 file changed, 13 insertions(+), 1 deletion(-)
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 1b564cfe2120..cfc780608682 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
@@ -1923,7 +1923,12 @@ int amdgpu_dm_plane_init(struct amdgpu_display_manager
*dm,
if (res)
return res;
- if (plane->type == DRM_PLANE_TYPE_OVERLAY &&
+ /* TODO: per_pixel_alpha is not set to DCE planes. Check what blend
+ * modes are supported in DCE-generation planes, i.e.
+ * DC_PLANE_TYPE_DCE_RGB and expose blend mode property accordingly.
+ */
+ if ((plane->type == DRM_PLANE_TYPE_OVERLAY ||
+ plane->type == DRM_PLANE_TYPE_PRIMARY) &&
plane_cap && plane_cap->per_pixel_alpha) {
unsigned int blend_caps = BIT(DRM_MODE_BLEND_PIXEL_NONE) |
BIT(DRM_MODE_BLEND_PREMULTI) |
@@ -1931,6 +1936,13 @@ int amdgpu_dm_plane_init(struct amdgpu_display_manager
*dm,
drm_plane_create_alpha_property(plane);
drm_plane_create_blend_mode_property(plane, blend_caps);
+ } else if (plane->type == DRM_PLANE_TYPE_CURSOR) {
+ /* Cursor color format is set to
+ * CURSOR_MODE_COLOR_PRE_MULTIPLIED_ALPHA by default, so only
+ * advertise DRM_MODE_BLEND_PREMULTI blend mode for this type
+ * of plane.
+ */
+ drm_plane_create_blend_mode_property(plane,
BIT(DRM_MODE_BLEND_PREMULTI));
}
if (plane->type == DRM_PLANE_TYPE_PRIMARY) {
--
2.53.0