All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/amd/display: fix missing blend-mode-prop warning
@ 2026-07-22 18:32 Melissa Wen
  2026-07-22 18:44 ` sashiko-bot
  0 siblings, 1 reply; 2+ messages in thread
From: Melissa Wen @ 2026-07-22 18:32 UTC (permalink / raw)
  To: harry.wentland, sunpeng.li, siqueira, alexander.deucher,
	christian.koenig, airlied, simona, daniels, leandro.ribeiro,
	pekka.paalanen
  Cc: amd-gfx, dri-devel, kernel-dev

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 <mwen@igalia.com>
---
 .../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


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] drm/amd/display: fix missing blend-mode-prop warning
  2026-07-22 18:32 [PATCH] drm/amd/display: fix missing blend-mode-prop warning Melissa Wen
@ 2026-07-22 18:44 ` sashiko-bot
  0 siblings, 0 replies; 2+ messages in thread
From: sashiko-bot @ 2026-07-22 18:44 UTC (permalink / raw)
  To: Melissa Wen; +Cc: dri-devel

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] The patch leaves the blend mode warning unresolved for most DCE platforms, and incorrectly advertises unsupported blend modes for DCE110 primary planes.
--

--- Patch [1]: [PATCH] drm/amd/display: fix missing blend-mode-prop warning ---
commit 5b22da875a02b052ccb2b1f44b116e2e68afa2f7
Author: Melissa Wen <mwen@igalia.com>

    drm/amd/display: fix missing blend-mode-prop warning

    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.

> 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 26f35434a92f0..9a41cdd39ccf0 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
> @@ -1932,7 +1932,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) |
> @@ -1940,6 +1945,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);

[Severity: Medium]
Will this leave the blend mode warning unresolved for most DCE platforms, and
incorrectly advertise unsupported blend modes for DCE110 primary planes?

On DCE hardware where plane_cap->per_pixel_alpha is 0 (such as DCE100 and
DCE112), amdgpu_dm_plane_get_plane_formats() still unconditionally exposes
DRM_FORMAT_ARGB8888. Because of this, the DRM core's
validate_blend_mode_for_alpha_formats() will continue to warn on boot since
the plane has an alpha format but no blend mode property.

Additionally, on DCE110 where per_pixel_alpha is 1, this patch attaches the
blend mode property with PREMULTI, COVERAGE, and NONE. However, does the DCE
hardware sequencer (dce_set_blender_mode) ignore
plane_state->pre_multiplied_alpha and hardcode alpha blending? If so, the
advertised blend modes will silently fail to work, which violates the API
contract.

> +	} 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) {

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260722183240.626522-1-mwen@igalia.com?part=1

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-07-22 18:45 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-22 18:32 [PATCH] drm/amd/display: fix missing blend-mode-prop warning Melissa Wen
2026-07-22 18:44 ` sashiko-bot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.