All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3 0/3] drm/atomic-state-helper: fixes for blend-mode-prop warning
@ 2026-08-13 14:30 Melissa Wen
  2026-08-13 14:30 ` [PATCH v3 1/3] drm/atomic-state-helper: set pixel_blend_mode to prop default on reset Melissa Wen
                   ` (3 more replies)
  0 siblings, 4 replies; 8+ messages in thread
From: Melissa Wen @ 2026-08-13 14:30 UTC (permalink / raw)
  To: airlied, alexander.deucher, christian.koenig, daniels,
	harry.wentland, leandro.ribeiro, maarten.lankhorst, mripard,
	pekka.paalanen, simona, siqueira, sunpeng.li, tzimmermann
  Cc: Alex Hung, Daniel Wheeler, kernel-dev, Lyude Paul, amd-gfx,
	dri-devel

PREMULTI was the default DRM blend mode until 9813e158d13d
("drm/drm_blend: allow blend mode property without PREMULTI") introduced
the possibility of exposing the blend mode property without PREMULTI
being supported. However, __drm_atomic_helper_plane_state_init() still
resets pixel_blend_mode to PREMULTI (hardcoded), ignoring the supported
mode in this property. In the same series, 860e748bddcc ("drm: ensure
blend mode supported if pixel format with alpha exposed") starts warning
drivers that supports alpha formats in a given planes but doesn't
support blend mode property, which includes AMD primary and cursor
planes.

For AMD DCN families, overlay and primary planes support the three blend
modes, and therefore PREMULTI is still the default mode. So the warning
can be fixed by just creating blend mode properties for primary planes
too. PREMULTI is the default/unique mode for cursor planes in DCN and
DCE driver. However, looks like PIXEL_NONE is the unique blend mode
supported by DCE-generation driver. I don't have the hardware to check
it out, but looking at the code I understand that, even if the hardware
can do PREMULTI or COVERAGE, the way it programs registers doesn't make
these other blend modes actually available.

Bearing this in mind, this series is organized as follow:

- Patch 1 fixes the pixel_blend_mode reset when the blend mode property
  is advertised without PREMULTI support. It's needed for AMD
  DCE-generation (patch 3) and I think with this we can also remove a
  workaround in nouveau nv50_wndw_default_state() caused by the
  hardcoded PREMULTI default value [1].

- Patch 2 fixes the missing-blend-mode-property warning for DCN primary
  plane and for DCN+DCE cursor plane. The alpha property keeps only on
  overlay planes because looks like this is not supported by AMD primary
  planes and it doesn't affect the blend mode warning we are targetting.
  Enabling alpha properties to primary was also causing -EINVAL on IGT
  alpha tests because it started testing primary planes and disabling it
  (which is not allowed by the AMD display driver).

- Patch 3 fixes the warning for DCE primary plane, but I detached this
  solution from the previous patch because I don't have hardware to
  validate if my assumption about PIXEL_NONE-only is correct.

[1] https://lore.kernel.org/dri-devel/20260720215058.398210-3-lyude@redhat.com/

[v1]: https://lore.kernel.org/dri-devel/20260722183240.626522-1-mwen@igalia.com/
Changes:
- new patch for pixel_blend_mode default value other than PREMULTI.
- remove DCE11 which supports per_pixel_alpha but doesn't support DCN_UNIVERSAL_PLANE.
- new patch for the primary plane blend mode on DCE-generations

[v2]: https://lore.kernel.org/dri-devel/20260804140758.107683-1-mwen@igalia.com/
Changes:
- keep alpha property only for overlay planes (looks like primary plane
  doesn't actually support it) - alpha prop in primary planes causes IGT
  test failures with RX 7900 XT on a 4k60 HP U27 as reported by Daniel
  Wheeler.
- improve readability of if conditions (Alex H)
- add Leandro's r-b tags.

Best Regards,

Melissa

Melissa Wen (3):
  drm/atomic-state-helper: set pixel_blend_mode to prop default on reset
  drm/amd/display: fix missing blend-mode-prop warning for DCN
  drm/amd/display: advertise PIXEL_NONE as blend mode for DCE generations

 .../amd/display/amdgpu_dm/amdgpu_dm_plane.c   | 25 ++++++++++++++++---
 drivers/gpu/drm/drm_atomic_state_helper.c     |  7 ++++++
 2 files changed, 29 insertions(+), 3 deletions(-)

-- 
2.53.0


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

* [PATCH v3 1/3] drm/atomic-state-helper: set pixel_blend_mode to prop default on reset
  2026-08-13 14:30 [PATCH v3 0/3] drm/atomic-state-helper: fixes for blend-mode-prop warning Melissa Wen
@ 2026-08-13 14:30 ` Melissa Wen
  2026-08-13 14:30 ` [PATCH v3 2/3] drm/amd/display: fix missing blend-mode-prop warning for DCN Melissa Wen
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 8+ messages in thread
From: Melissa Wen @ 2026-08-13 14:30 UTC (permalink / raw)
  To: airlied, alexander.deucher, christian.koenig, daniels,
	harry.wentland, leandro.ribeiro, maarten.lankhorst, mripard,
	pekka.paalanen, simona, siqueira, sunpeng.li, tzimmermann
  Cc: Alex Hung, Daniel Wheeler, kernel-dev, Lyude Paul, amd-gfx,
	dri-devel

In __drm_atomic_helper_plane_state_init(), pixel_blend_mode is always
reset to DRM_MODE_BLEND_PREMULTI. That was consistent while
drm_plane_create_blend_mode_property() required PREMULTI in the
supported modes, but it now falls back to COVERAGE or PIXEL_NONE when
the driver doesn't support PREMULTI. The hardcoded default may therefore
not be a blend mode the hardware can do, nor one the property
advertises.

Initialize pixel_blend_mode from the blend mode property default
instead, keeping DRM_MODE_BLEND_PREMULTI for planes without the
property.

Fixes: 9813e158d13d ("drm/drm_blend: allow blend mode property without PREMULTI")
Reviewed-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
Signed-off-by: Melissa Wen <mwen@igalia.com>
---
 drivers/gpu/drm/drm_atomic_state_helper.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/gpu/drm/drm_atomic_state_helper.c b/drivers/gpu/drm/drm_atomic_state_helper.c
index d90d1d7c9cf9..a2ef272e9f27 100644
--- a/drivers/gpu/drm/drm_atomic_state_helper.c
+++ b/drivers/gpu/drm/drm_atomic_state_helper.c
@@ -278,7 +278,14 @@ void __drm_atomic_helper_plane_state_init(struct drm_plane_state *plane_state,
 	plane_state->rotation = DRM_MODE_ROTATE_0;
 
 	plane_state->alpha = DRM_BLEND_ALPHA_OPAQUE;
+
 	plane_state->pixel_blend_mode = DRM_MODE_BLEND_PREMULTI;
+	if (plane->blend_mode_property) {
+		if (!drm_object_property_get_default_value(&plane->base,
+							   plane->blend_mode_property,
+							   &val))
+			plane_state->pixel_blend_mode = val;
+	}
 
 	if (plane->color_encoding_property) {
 		if (!drm_object_property_get_default_value(&plane->base,
-- 
2.53.0


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

* [PATCH v3 2/3] drm/amd/display: fix missing blend-mode-prop warning for DCN
  2026-08-13 14:30 [PATCH v3 0/3] drm/atomic-state-helper: fixes for blend-mode-prop warning Melissa Wen
  2026-08-13 14:30 ` [PATCH v3 1/3] drm/atomic-state-helper: set pixel_blend_mode to prop default on reset Melissa Wen
@ 2026-08-13 14:30 ` Melissa Wen
  2026-08-13 17:49   ` Alex Hung
  2026-08-13 14:30 ` [PATCH v3 3/3] drm/amd/display: advertise PIXEL_NONE as blend mode for DCE generations Melissa Wen
  2026-08-13 17:58 ` [PATCH v3 0/3] drm/atomic-state-helper: fixes for blend-mode-prop warning Wheeler, Daniel
  3 siblings, 1 reply; 8+ messages in thread
From: Melissa Wen @ 2026-08-13 14:30 UTC (permalink / raw)
  To: airlied, alexander.deucher, christian.koenig, daniels,
	harry.wentland, leandro.ribeiro, maarten.lankhorst, mripard,
	pekka.paalanen, simona, siqueira, sunpeng.li, tzimmermann
  Cc: Alex Hung, Daniel Wheeler, kernel-dev, Lyude Paul, amd-gfx,
	dri-devel

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 overlay plane 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")
Reviewed-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
Signed-off-by: Melissa Wen <mwen@igalia.com>

---
v3:
- keep primary planes w/o alpha property
- re-order if-conditions for readability
---
 .../amd/display/amdgpu_dm/amdgpu_dm_plane.c   | 21 ++++++++++++++++---
 1 file changed, 18 insertions(+), 3 deletions(-)

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..ab9bbe8ca333 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,16 +1923,31 @@ 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) {
+	/* TODO: Check which blend modes are supported in DCE-generation
+	 * planes, i.e. DC_PLANE_TYPE_DCE_RGB/UNDERLAY 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 &&
+	    plane_cap->type == DC_PLANE_TYPE_DCN_UNIVERSAL) {
 		unsigned int blend_caps = BIT(DRM_MODE_BLEND_PIXEL_NONE) |
 					  BIT(DRM_MODE_BLEND_PREMULTI) |
 					  BIT(DRM_MODE_BLEND_COVERAGE);
 
-		drm_plane_create_alpha_property(plane);
 		drm_plane_create_blend_mode_property(plane, blend_caps);
+
+		if (plane->type == DRM_PLANE_TYPE_OVERLAY)
+			drm_plane_create_alpha_property(plane);
 	}
 
+	/* 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.
+	 */
+	if (plane->type == DRM_PLANE_TYPE_CURSOR)
+		drm_plane_create_blend_mode_property(plane, BIT(DRM_MODE_BLEND_PREMULTI));
+
 	if (plane->type == DRM_PLANE_TYPE_PRIMARY) {
 		/*
 		 * Allow OVERLAY planes to be used as underlays by assigning an
-- 
2.53.0


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

* [PATCH v3 3/3] drm/amd/display: advertise PIXEL_NONE as blend mode for DCE generations
  2026-08-13 14:30 [PATCH v3 0/3] drm/atomic-state-helper: fixes for blend-mode-prop warning Melissa Wen
  2026-08-13 14:30 ` [PATCH v3 1/3] drm/atomic-state-helper: set pixel_blend_mode to prop default on reset Melissa Wen
  2026-08-13 14:30 ` [PATCH v3 2/3] drm/amd/display: fix missing blend-mode-prop warning for DCN Melissa Wen
@ 2026-08-13 14:30 ` Melissa Wen
  2026-08-13 14:44   ` sashiko-bot
  2026-08-13 17:58 ` [PATCH v3 0/3] drm/atomic-state-helper: fixes for blend-mode-prop warning Wheeler, Daniel
  3 siblings, 1 reply; 8+ messages in thread
From: Melissa Wen @ 2026-08-13 14:30 UTC (permalink / raw)
  To: airlied, alexander.deucher, christian.koenig, daniels,
	harry.wentland, leandro.ribeiro, maarten.lankhorst, mripard,
	pekka.paalanen, simona, siqueira, sunpeng.li, tzimmermann
  Cc: Alex Hung, Daniel Wheeler, kernel-dev, Lyude Paul, amd-gfx,
	dri-devel

DCE can support PREMULTI and COVERAGE blend mode depending on its
generation, however current driver implementation either doesn't expose
more than primary and cursor plane, or doesn't program registers for any
blend mode other than PIXEL_NONE. To fix the missing-blend-mode-prop
warning according to current DCE plane caps, create blend mode property
with PIXEL_NONE only for primary planes, instead of the DRM default
PREMULTI.

Fixes: 860e748bddcc ("drm: ensure blend mode supported if pixel format with alpha exposed")
Reviewed-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
Signed-off-by: Melissa Wen <mwen@igalia.com>

---
v3:
- fix indentation (Alex H)
---
 .../amd/display/amdgpu_dm/amdgpu_dm_plane.c    | 18 +++++++++++-------
 1 file changed, 11 insertions(+), 7 deletions(-)

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 ab9bbe8ca333..3b5b6943b67d 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,14 +1923,18 @@ int amdgpu_dm_plane_init(struct amdgpu_display_manager *dm,
 	if (res)
 		return res;
 
-	/* TODO: Check which blend modes are supported in DCE-generation
-	 * planes, i.e. DC_PLANE_TYPE_DCE_RGB/UNDERLAY and expose blend mode
-	 * property accordingly.
+	/* Blend mode support varies on DCE generations according to HW caps
+	 * and number of planes per CRTC. However, as current driver
+	 * implementation only creates one primary and one cursor plane per
+	 * CRTC for DCE (overlay is only created if
+	 * DC_PLANE_TYPE_DCN_UNIVERSAL), the primary plane blend mode ends up
+	 * being always PIXEL_NONE across DCE versions.
 	 */
-	if ((plane->type == DRM_PLANE_TYPE_OVERLAY ||
-	     plane->type == DRM_PLANE_TYPE_PRIMARY) &&
-	    plane_cap && plane_cap->per_pixel_alpha &&
-	    plane_cap->type == DC_PLANE_TYPE_DCN_UNIVERSAL) {
+	if (plane_cap && plane_cap->type != DC_PLANE_TYPE_DCN_UNIVERSAL) {
+		drm_plane_create_blend_mode_property(plane, BIT(DRM_MODE_BLEND_PIXEL_NONE));
+	} else 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) |
 					  BIT(DRM_MODE_BLEND_COVERAGE);
-- 
2.53.0


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

* Re: [PATCH v3 3/3] drm/amd/display: advertise PIXEL_NONE as blend mode for DCE generations
  2026-08-13 14:30 ` [PATCH v3 3/3] drm/amd/display: advertise PIXEL_NONE as blend mode for DCE generations Melissa Wen
@ 2026-08-13 14:44   ` sashiko-bot
  2026-08-13 15:04     ` Melissa Wen
  0 siblings, 1 reply; 8+ messages in thread
From: sashiko-bot @ 2026-08-13 14: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:
- [High] Calling drm_plane_create_blend_mode_property() without PREMULTI support triggers a kernel warning (WARN_ON) and fails to create the property.
--

--- Patch [3]: [PATCH v3 3/3] drm/amd/display: advertise PIXEL_NONE as blend mode for DCE generations ---
commit 44681caffc8bcfc7085bcfe1ec288a0eafc8c992
Author: Melissa Wen <mwen@igalia.com>

drm/amd/display: advertise PIXEL_NONE as blend mode for DCE generations

This commit changes the blend mode property creation for primary planes on
DCE generations. It modifies the driver to create the blend mode property
with PIXEL_NONE only, instead of the DRM default PREMULTI mode.

> 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 423e3cd7b9c98..e02cbafc8c5d0 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,14 +2208,18 @@ int amdgpu_dm_plane_init(struct amdgpu_display_manager *dm,
[ ... ]
> -	if ((plane->type == DRM_PLANE_TYPE_OVERLAY ||
> -	     plane->type == DRM_PLANE_TYPE_PRIMARY) &&
> -	    plane_cap && plane_cap->per_pixel_alpha &&
> -	    plane_cap->type == DC_PLANE_TYPE_DCN_UNIVERSAL) {
> +	if (plane_cap && plane_cap->type != DC_PLANE_TYPE_DCN_UNIVERSAL) {
> +		drm_plane_create_blend_mode_property(plane, BIT(DRM_MODE_BLEND_PIXEL_NONE));

[Severity: High]
Does this trigger a kernel warning and fail to create the property?

Looking at drm_plane_create_blend_mode_property() in drm_blend.c, the DRM
core explicitly enforces that DRM_MODE_BLEND_PREMULTI must be supported:

int drm_plane_create_blend_mode_property(struct drm_plane *plane,
					 unsigned int supported_modes)
{
	...
	if (WARN_ON((supported_modes & ~valid_mode_mask) ||
		    ((supported_modes & BIT(DRM_MODE_BLEND_PREMULTI)) == 0)))
		return -EINVAL;
	...
}

Since amdgpu_dm_plane_init() now passes only BIT(DRM_MODE_BLEND_PIXEL_NONE),
this will trigger the WARN_ON and return -EINVAL during device probe,
meaning the property is not created at all.

> +	} else 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) |
>  					  BIT(DRM_MODE_BLEND_COVERAGE);

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

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

* Re: [PATCH v3 3/3] drm/amd/display: advertise PIXEL_NONE as blend mode for DCE generations
  2026-08-13 14:44   ` sashiko-bot
@ 2026-08-13 15:04     ` Melissa Wen
  0 siblings, 0 replies; 8+ messages in thread
From: Melissa Wen @ 2026-08-13 15:04 UTC (permalink / raw)
  To: sashiko-reviews; +Cc: dri-devel



On 13/08/2026 16:44, sashiko-bot@kernel.org wrote:
> Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
> - [High] Calling drm_plane_create_blend_mode_property() without PREMULTI support triggers a kernel warning (WARN_ON) and fails to create the property.
> --
>
> --- Patch [3]: [PATCH v3 3/3] drm/amd/display: advertise PIXEL_NONE as blend mode for DCE generations ---
> commit 44681caffc8bcfc7085bcfe1ec288a0eafc8c992
> Author: Melissa Wen <mwen@igalia.com>
>
> drm/amd/display: advertise PIXEL_NONE as blend mode for DCE generations
>
> This commit changes the blend mode property creation for primary planes on
> DCE generations. It modifies the driver to create the blend mode property
> with PIXEL_NONE only, instead of the DRM default PREMULTI mode.
>
>> 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 423e3cd7b9c98..e02cbafc8c5d0 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,14 +2208,18 @@ int amdgpu_dm_plane_init(struct amdgpu_display_manager *dm,
> [ ... ]
>> -	if ((plane->type == DRM_PLANE_TYPE_OVERLAY ||
>> -	     plane->type == DRM_PLANE_TYPE_PRIMARY) &&
>> -	    plane_cap && plane_cap->per_pixel_alpha &&
>> -	    plane_cap->type == DC_PLANE_TYPE_DCN_UNIVERSAL) {
>> +	if (plane_cap && plane_cap->type != DC_PLANE_TYPE_DCN_UNIVERSAL) {
>> +		drm_plane_create_blend_mode_property(plane, BIT(DRM_MODE_BLEND_PIXEL_NONE));
> [Severity: High]
> Does this trigger a kernel warning and fail to create the property?
>
> Looking at drm_plane_create_blend_mode_property() in drm_blend.c, the DRM
> core explicitly enforces that DRM_MODE_BLEND_PREMULTI must be supported:
>
> int drm_plane_create_blend_mode_property(struct drm_plane *plane,
> 					 unsigned int supported_modes)
> {
> 	...
> 	if (WARN_ON((supported_modes & ~valid_mode_mask) ||
> 		    ((supported_modes & BIT(DRM_MODE_BLEND_PREMULTI)) == 0)))
> 		return -EINVAL;
> 	...
> }
>
> Since amdgpu_dm_plane_init() now passes only BIT(DRM_MODE_BLEND_PIXEL_NONE),
> this will trigger the WARN_ON and return -EINVAL during device probe,
> meaning the property is not created at all.

No, you are probably looking at an outdated codebase.

Other blend modes are supported since:

9813e158d13d5 ("drm/drm_blend: allow blend mode property without 
PREMULTI") in drm-misc-next.

Melissa

>
>> +	} else 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) |
>>   					  BIT(DRM_MODE_BLEND_COVERAGE);


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

* Re: [PATCH v3 2/3] drm/amd/display: fix missing blend-mode-prop warning for DCN
  2026-08-13 14:30 ` [PATCH v3 2/3] drm/amd/display: fix missing blend-mode-prop warning for DCN Melissa Wen
@ 2026-08-13 17:49   ` Alex Hung
  0 siblings, 0 replies; 8+ messages in thread
From: Alex Hung @ 2026-08-13 17:49 UTC (permalink / raw)
  To: Melissa Wen, airlied, alexander.deucher, christian.koenig,
	daniels, harry.wentland, leandro.ribeiro, maarten.lankhorst,
	mripard, pekka.paalanen, simona, siqueira, sunpeng.li,
	tzimmermann
  Cc: Daniel Wheeler, kernel-dev, Lyude Paul, amd-gfx, dri-devel

I can confirm IGT's "kms_plane_alpha_blend --run-subtest alpha-basic" no 
longer fails with v3.

On 8/13/26 08:30, Melissa Wen wrote:
> 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 overlay plane 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")
> Reviewed-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
> Signed-off-by: Melissa Wen <mwen@igalia.com>
> 
> ---
> v3:
> - keep primary planes w/o alpha property
> - re-order if-conditions for readability
> ---
>   .../amd/display/amdgpu_dm/amdgpu_dm_plane.c   | 21 ++++++++++++++++---
>   1 file changed, 18 insertions(+), 3 deletions(-)
> 
> 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..ab9bbe8ca333 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,16 +1923,31 @@ 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) {
> +	/* TODO: Check which blend modes are supported in DCE-generation
> +	 * planes, i.e. DC_PLANE_TYPE_DCE_RGB/UNDERLAY 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 &&
> +	    plane_cap->type == DC_PLANE_TYPE_DCN_UNIVERSAL) {
>   		unsigned int blend_caps = BIT(DRM_MODE_BLEND_PIXEL_NONE) |
>   					  BIT(DRM_MODE_BLEND_PREMULTI) |
>   					  BIT(DRM_MODE_BLEND_COVERAGE);
>   
> -		drm_plane_create_alpha_property(plane);
>   		drm_plane_create_blend_mode_property(plane, blend_caps);
> +
> +		if (plane->type == DRM_PLANE_TYPE_OVERLAY)
> +			drm_plane_create_alpha_property(plane);
>   	}
>   
> +	/* 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.
> +	 */
> +	if (plane->type == DRM_PLANE_TYPE_CURSOR)
> +		drm_plane_create_blend_mode_property(plane, BIT(DRM_MODE_BLEND_PREMULTI));
> +
>   	if (plane->type == DRM_PLANE_TYPE_PRIMARY) {
>   		/*
>   		 * Allow OVERLAY planes to be used as underlays by assigning an


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

* RE: [PATCH v3 0/3] drm/atomic-state-helper: fixes for blend-mode-prop warning
  2026-08-13 14:30 [PATCH v3 0/3] drm/atomic-state-helper: fixes for blend-mode-prop warning Melissa Wen
                   ` (2 preceding siblings ...)
  2026-08-13 14:30 ` [PATCH v3 3/3] drm/amd/display: advertise PIXEL_NONE as blend mode for DCE generations Melissa Wen
@ 2026-08-13 17:58 ` Wheeler, Daniel
  3 siblings, 0 replies; 8+ messages in thread
From: Wheeler, Daniel @ 2026-08-13 17:58 UTC (permalink / raw)
  To: Melissa Wen, airlied@gmail.com, Deucher, Alexander,
	Koenig, Christian, daniels@collabora.com, Wentland, Harry,
	leandro.ribeiro@collabora.com, maarten.lankhorst@linux.intel.com,
	mripard@kernel.org, pekka.paalanen@collabora.com, simona@ffwll.ch,
	siqueira@igalia.com, Li, Sun peng (Leo), tzimmermann@suse.de
  Cc: Hung, Alex, kernel-dev@igalia.com, Lyude Paul,
	amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org

Public

Thanks for the fixes Melissa, we'll re-add them to next week's promotion and re-test.

Thank you,

Dan Wheeler
Sr. Technologist | AMD
SW Display
------------------------------------------------------------------------------------------------------------------
1 Commerce Valley Dr E, Thornhill, ON L3T 7X6
amd.com


-----Original Message-----
From: Melissa Wen <mwen@igalia.com>
Sent: Thursday, August 13, 2026 10:30 AM
To: airlied@gmail.com; Deucher, Alexander <Alexander.Deucher@amd.com>; Koenig, Christian <Christian.Koenig@amd.com>; daniels@collabora.com; Wentland, Harry <Harry.Wentland@amd.com>; leandro.ribeiro@collabora.com; maarten.lankhorst@linux.intel.com; mripard@kernel.org; pekka.paalanen@collabora.com; simona@ffwll.ch; siqueira@igalia.com; Li, Sun peng (Leo) <Sunpeng.Li@amd.com>; tzimmermann@suse.de
Cc: Hung, Alex <Alex.Hung@amd.com>; Wheeler, Daniel <Daniel.Wheeler@amd.com>; kernel-dev@igalia.com; Lyude Paul <lyude@redhat.com>; amd-gfx@lists.freedesktop.org; dri-devel@lists.freedesktop.org
Subject: [PATCH v3 0/3] drm/atomic-state-helper: fixes for blend-mode-prop warning

PREMULTI was the default DRM blend mode until 9813e158d13d
("drm/drm_blend: allow blend mode property without PREMULTI") introduced the possibility of exposing the blend mode property without PREMULTI being supported. However, __drm_atomic_helper_plane_state_init() still resets pixel_blend_mode to PREMULTI (hardcoded), ignoring the supported mode in this property. In the same series, 860e748bddcc ("drm: ensure blend mode supported if pixel format with alpha exposed") starts warning drivers that supports alpha formats in a given planes but doesn't support blend mode property, which includes AMD primary and cursor planes.

For AMD DCN families, overlay and primary planes support the three blend modes, and therefore PREMULTI is still the default mode. So the warning can be fixed by just creating blend mode properties for primary planes too. PREMULTI is the default/unique mode for cursor planes in DCN and DCE driver. However, looks like PIXEL_NONE is the unique blend mode supported by DCE-generation driver. I don't have the hardware to check it out, but looking at the code I understand that, even if the hardware can do PREMULTI or COVERAGE, the way it programs registers doesn't make these other blend modes actually available.

Bearing this in mind, this series is organized as follow:

- Patch 1 fixes the pixel_blend_mode reset when the blend mode property
  is advertised without PREMULTI support. It's needed for AMD
  DCE-generation (patch 3) and I think with this we can also remove a
  workaround in nouveau nv50_wndw_default_state() caused by the
  hardcoded PREMULTI default value [1].

- Patch 2 fixes the missing-blend-mode-property warning for DCN primary
  plane and for DCN+DCE cursor plane. The alpha property keeps only on
  overlay planes because looks like this is not supported by AMD primary
  planes and it doesn't affect the blend mode warning we are targetting.
  Enabling alpha properties to primary was also causing -EINVAL on IGT
  alpha tests because it started testing primary planes and disabling it
  (which is not allowed by the AMD display driver).

- Patch 3 fixes the warning for DCE primary plane, but I detached this
  solution from the previous patch because I don't have hardware to
  validate if my assumption about PIXEL_NONE-only is correct.

[1] https://lore.kernel.org/dri-devel/20260720215058.398210-3-lyude@redhat.com/

[v1]: https://lore.kernel.org/dri-devel/20260722183240.626522-1-mwen@igalia.com/
Changes:
- new patch for pixel_blend_mode default value other than PREMULTI.
- remove DCE11 which supports per_pixel_alpha but doesn't support DCN_UNIVERSAL_PLANE.
- new patch for the primary plane blend mode on DCE-generations

[v2]: https://lore.kernel.org/dri-devel/20260804140758.107683-1-mwen@igalia.com/
Changes:
- keep alpha property only for overlay planes (looks like primary plane
  doesn't actually support it) - alpha prop in primary planes causes IGT
  test failures with RX 7900 XT on a 4k60 HP U27 as reported by Daniel
  Wheeler.
- improve readability of if conditions (Alex H)
- add Leandro's r-b tags.

Best Regards,

Melissa

Melissa Wen (3):
  drm/atomic-state-helper: set pixel_blend_mode to prop default on reset
  drm/amd/display: fix missing blend-mode-prop warning for DCN
  drm/amd/display: advertise PIXEL_NONE as blend mode for DCE generations

 .../amd/display/amdgpu_dm/amdgpu_dm_plane.c   | 25 ++++++++++++++++---
 drivers/gpu/drm/drm_atomic_state_helper.c     |  7 ++++++
 2 files changed, 29 insertions(+), 3 deletions(-)

--
2.53.0


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

end of thread, other threads:[~2026-08-13 17:58 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-13 14:30 [PATCH v3 0/3] drm/atomic-state-helper: fixes for blend-mode-prop warning Melissa Wen
2026-08-13 14:30 ` [PATCH v3 1/3] drm/atomic-state-helper: set pixel_blend_mode to prop default on reset Melissa Wen
2026-08-13 14:30 ` [PATCH v3 2/3] drm/amd/display: fix missing blend-mode-prop warning for DCN Melissa Wen
2026-08-13 17:49   ` Alex Hung
2026-08-13 14:30 ` [PATCH v3 3/3] drm/amd/display: advertise PIXEL_NONE as blend mode for DCE generations Melissa Wen
2026-08-13 14:44   ` sashiko-bot
2026-08-13 15:04     ` Melissa Wen
2026-08-13 17:58 ` [PATCH v3 0/3] drm/atomic-state-helper: fixes for blend-mode-prop warning Wheeler, Daniel

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.