From 44139872f22350b1e6c45da80e414caca81f11f5 Mon Sep 17 00:00:00 2001 From: Ray Wu Date: Tue, 8 Sep 2026 18:10:57 +0800 Subject: [PATCH] drm/amd/display: Attach blend mode property for alpha planes [Why & How] drm_mode_config_validate() warns when a plane exposes an alpha-capable pixel format without a blend_mode_property. amdgpu DM only created that property for overlay planes, so PRIMARY and CURSOR triggered the warning on every probe and reload in kernel 7.2. Create the blend mode property for every plane that advertises an alpha format. Keep overlay-only alpha_property. Cursor advertises only pre-multiplied blend mode because native cursor programming is pre-multiplied. Assisted-by: Cursor:Claude-Opus-4.8 Signed-off-by: Ray Wu Signed-off-by: Fangzhi Zuo Reviewed-by: Sun peng (Leo) Li Tested-by: Dan Wheeler Signed-off-by: Alex Deucher --- .../amd/display/amdgpu_dm/amdgpu_dm_plane.c | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) 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 5fd854d27000..f7424ec4ae08 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 @@ -2230,6 +2230,21 @@ static const struct drm_plane_funcs dm_plane_funcs = { DRM_PANIC_PLANE_FUNCS, }; +static bool amdgpu_dm_plane_exposes_alpha_format(const struct drm_plane *plane) +{ + unsigned int i; + + for (i = 0; i < plane->format_count; i++) { + const struct drm_format_info *fmt = + drm_format_info(plane->format_types[i]); + + if (fmt && fmt->has_alpha) + return true; + } + + return false; +} + int amdgpu_dm_plane_init(struct amdgpu_display_manager *dm, struct drm_plane *plane, unsigned long possible_crtcs, @@ -2312,6 +2327,21 @@ int amdgpu_dm_plane_init(struct amdgpu_display_manager *dm, drm_plane_create_zpos_immutable_property(plane, 255); } + /* + * drm_mode_config_validate() warns about planes exposing a pixel format + * with alpha but no blend mode property, so attach one to every plane + * advertising such a format. + */ + if (amdgpu_dm_plane_exposes_alpha_format(plane)) { + unsigned int blend_caps = BIT(DRM_MODE_BLEND_PREMULTI); + + if (plane->type != DRM_PLANE_TYPE_CURSOR) + blend_caps |= BIT(DRM_MODE_BLEND_PIXEL_NONE) | + BIT(DRM_MODE_BLEND_COVERAGE); + + drm_plane_create_blend_mode_property(plane, blend_caps); + } + if ((plane->type == DRM_PLANE_TYPE_PRIMARY || plane->type == DRM_PLANE_TYPE_OVERLAY) && plane_cap &&