Skip to contentSkip to conversation

drm/atomic-state-helper: fixes for blend-mode-prop warning

PATCH Superseded Melissa Wen 4 participants 9 messages Aug 4 – Aug 12

Subsystems (4)

v2 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

v2 cover 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 warn 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.

- 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/[email protected]/

[v1]: https://lore.kernel.org/dri-devel/[email protected]/
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

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   | 22 +++++++++++++++++--
 drivers/gpu/drm/drm_atomic_state_helper.c     |  7 ++++++
 2 files changed, 27 insertions(+), 2 deletions(-)
Signature · 1 line
2.53.0
#1 lore raw

PATCH v2 1/3 drm/atomic-state-helper: set pixel_blend_mode to prop default on reset

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")
---
 drivers/gpu/drm/drm_atomic_state_helper.c | 7 +++++++
 1 file changed, 7 insertions(+)
drivers/gpu/drm/drm_atomic_state_helper.c +7 -0
index d90d1d7c9cf9..a2ef272e9f27 100644
@@ -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,
Signature · 1 line
2.53.0
#2 lore raw

PATCH v2 2/3 drm/amd/display: fix missing blend-mode-prop warning for DCN

In reply to Melissa Wen

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")
---
 .../amd/display/amdgpu_dm/amdgpu_dm_plane.c    | 18 ++++++++++++++++--
 1 file changed, 16 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_plane.c +16 -2
index 1b564cfe2120..a276f3730044 100644
@@ -1923,8 +1923,15 @@ 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->type == DC_PLANE_TYPE_DCN_UNIVERSAL &&
+	    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);
@@ -1933,6 +1940,13 @@ int amdgpu_dm_plane_init(struct amdgpu_display_manager *dm,
 		drm_plane_create_blend_mode_property(plane, blend_caps);
 	}
 
+	/* 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
Signature · 1 line
2.53.0
#3 lore raw

RE: [PATCH v2 2/3] drm/amd/display: fix missing blend-mode-prop warning for DCN

Public

Hey Melissa,

I've found out that this patch causes some IGT failures with the igt@kms_plane_alpha_blend tests. I noticed it with a RX 7900 XT on a 4k60 HP U27. The tests fail with an assertion failure. I posted a snippet below.

Starting subtest: alpha-basic
Starting dynamic subtest: pipe-A-DP-1

[181.052561] (kms_plane_alpha_blend:9570) igt_kms-CRITICAL: Test assertion failure function do_display_commit, file ../lib/igt_kms.c:4982:
[181.052564] (kms_plane_alpha_blend:9570) igt_kms-CRITICAL: Failed assertion: ret == 0
[181.052568] (kms_plane_alpha_blend:9570) igt_kms-CRITICAL: Last errno: 22, Invalid argument
[181.052571] (kms_plane_alpha_blend:9570) igt_kms-CRITICAL: error: -22 != 0

Dynamic subtest pipe-A-DP-1 failed.

Thank you,

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

-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Melissa Wen
Sent: Tuesday, August 4, 2026 10:01 AM
To: [email protected]; Deucher, Alexander <[email protected]>; Koenig, Christian <[email protected]>; [email protected]; Wentland, Harry <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Li, Sun peng (Leo) <[email protected]>; [email protected]
Cc: Hung, Alex <[email protected]>; [email protected]; Lyude Paul <[email protected]>; [email protected]; [email protected]
Subject: [PATCH v2 2/3] drm/amd/display: fix missing blend-mode-prop warning for DCN

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")
---
 .../amd/display/amdgpu_dm/amdgpu_dm_plane.c    | 18 ++++++++++++++++--
 1 file changed, 16 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_plane.c +17 -2
index 1b564cfe2120..a276f3730044 100644
@@ -1923,8 +1923,15 @@ 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->type == DC_PLANE_TYPE_DCN_UNIVERSAL &&
+           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);
@@ -1933,6 +1940,13 @@ int amdgpu_dm_plane_init(struct amdgpu_display_manager *dm,
                drm_plane_create_blend_mode_property(plane, blend_caps);
        }
 
+       /* 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

#4 lore raw

Re: [PATCH v2 2/3] drm/amd/display: fix missing blend-mode-prop warning for DCN

Quoted 7 lines · Daniel

Public

Hey Melissa,

I've found out that this patch causes some IGT failures with the igt@kms_plane_alpha_blend tests. I noticed it with a RX 7900 XT on a 4k60 HP U27. The tests fail with an assertion failure. I posted a snippet below.

Quoted 7 lines

Starting subtest: alpha-basic
Starting dynamic subtest: pipe-A-DP-1

[181.052561] (kms_plane_alpha_blend:9570) igt_kms-CRITICAL: Test assertion failure function do_display_commit, file ../lib/igt_kms.c:4982:
[181.052564] (kms_plane_alpha_blend:9570) igt_kms-CRITICAL: Failed assertion: ret == 0
[181.052568] (kms_plane_alpha_blend:9570) igt_kms-CRITICAL: Last errno: 22, Invalid argument
[181.052571] (kms_plane_alpha_blend:9570) igt_kms-CRITICAL: error: -22 != 0

Dynamic subtest pipe-A-DP-1 failed.

Hi Daniel,

Thanks for testing and pointing it out.

I think the failure is caused by including alpha property to primary planes, so the test runs for primary planes and fails when trying to disable them (CRTC w/o primary).
I'm not sure if this is essentially an issue in the IGT test or if AMD primary planes don't support alpha, but I'll send another version to not add alpha property to primary by now as it isn't related to the blend mode warning. After I'll look at the driver to understand what is the right approach.

Best Regards,

Melissa

Quoted 67 lines

Thank you,

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

-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Melissa Wen
Sent: Tuesday, August 4, 2026 10:01 AM
To: [email protected]; Deucher, Alexander <[email protected]>; Koenig, Christian <[email protected]>; [email protected]; Wentland, Harry <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Li, Sun peng (Leo) <[email protected]>; [email protected]
Cc: Hung, Alex <[email protected]>; [email protected]; Lyude Paul <[email protected]>; [email protected]; [email protected]
Subject: [PATCH v2 2/3] drm/amd/display: fix missing blend-mode-prop warning for DCN

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")
---
  .../amd/display/amdgpu_dm/amdgpu_dm_plane.c    | 18 ++++++++++++++++--
  1 file changed, 16 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_plane.c +17 -3
index 1b564cfe2120..a276f3730044 100644
@@ -1923,8 +1923,15 @@ 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->type == DC_PLANE_TYPE_DCN_UNIVERSAL &&
+           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);
@@ -1933,6 +1940,13 @@ int amdgpu_dm_plane_init(struct amdgpu_display_manager *dm,
                 drm_plane_create_blend_mode_property(plane, blend_caps);
         }
 
+       /* 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

#5 lore raw

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

In reply to Melissa Wen

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")
---
 .../drm/amd/display/amdgpu_dm/amdgpu_dm_plane.c    | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_plane.c +9 -5
index a276f3730044..60ccf1f9fcd9 100644
@@ -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 ||
+	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->type == DC_PLANE_TYPE_DCN_UNIVERSAL &&
 	    plane_cap->per_pixel_alpha) {
 		unsigned int blend_caps = BIT(DRM_MODE_BLEND_PIXEL_NONE) |
 					  BIT(DRM_MODE_BLEND_PREMULTI) |
Signature · 1 line
2.53.0
#6 lore raw

Re: [PATCH v2 3/3] drm/amd/display: advertise PIXEL_NONE as blend mode for DCE generations

Quoted 30 lines · Melissa Wen

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")
---
  .../drm/amd/display/amdgpu_dm/amdgpu_dm_plane.c    | 14 +++++++++-----
  1 file changed, 9 insertions(+), 5 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_plane.c +5 -3
index a276f3730044..60ccf1f9fcd9 100644
@@ -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

drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_plane.c int amdgpu_dm_plane_init(struct amdgpu_display_manager *dm, · line 1938

Quoted 10 lines
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_plane.c +4 -2
+	 * being always PIXEL_NONE across DCE versions.
  	 */
-	if ((plane->type == DRM_PLANE_TYPE_OVERLAY ||
+	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->type == DC_PLANE_TYPE_DCN_UNIVERSAL &&
  	    plane_cap->per_pixel_alpha) {

A nitpick - the conditions are no longer aligned and becomes harder to read. Could you please fix it when sending V3?

Thanks

Quoted 2 lines
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_plane.c +0 -0
  		unsigned int blend_caps = BIT(DRM_MODE_BLEND_PIXEL_NONE) |
  					  BIT(DRM_MODE_BLEND_PREMULTI) |
Reviewed-by on the v2 series
#7 lore raw
In reply to Melissa Wen

Hello,

Thank you! I don't have AMD hardware to validate the DCE-generation details either, and I'm not familiar with the AMD specific bits. But this series LGTM from the blend-mode requirements perspective. So, with this caveat:

Quoted 58 lines · Melissa Wen

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 warn 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.

- 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/[email protected]/

[v1]: https://lore.kernel.org/dri-devel/[email protected]/
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

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   | 22 +++++++++++++++++--
 drivers/gpu/drm/drm_atomic_state_helper.c     |  7 ++++++
 2 files changed, 27 insertions(+), 2 deletions(-)
Signature · 1 line
Leandro Ribeiro
#8 lore raw
In reply to Melissa Wen
Quoted 11 lines · Melissa Wen

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.

Quoted 9 lines

For AMD DCN families, overlay and primary planes support the three blend modes, and therefore PREMULTI is still the default mode. So the warn 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.

Hello,

As this series mostly fixes AMD display driver, can I get an ack from AMD folks?

Thanks in advance,

Melissa

Quoted 38 lines

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.

- 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/[email protected]/

[v1]: https://lore.kernel.org/dri-devel/[email protected]/
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

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   | 22 +++++++++++++++++--
  drivers/gpu/drm/drm_atomic_state_helper.c     |  7 ++++++
  2 files changed, 27 insertions(+), 2 deletions(-)