All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/3] drm/amd/display: Expose more formats for overlay planes on DCN
@ 2023-07-09  2:06 Joshua Ashton
  2023-07-09  2:06 ` [PATCH 2/3] drm/amd/display: Enable 3 plane for DCN 3.01 Joshua Ashton
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Joshua Ashton @ 2023-07-09  2:06 UTC (permalink / raw)
  To: amd-gfx; +Cc: Melissa Wen, Simon Ser, Harry Wentland, Joshua Ashton

DCN planes are universal and therefore overlay planes can use the same
formats as primary planes, unlike DCE.

Gamescope/Steam Deck would like to take advantage of this functionality
for partial composition which in some cases in our pipeline, can contain
negative values in some instances.

Signed-off-by: Joshua Ashton <joshua@froggi.es>

Cc: Harry Wentland <harry.wentland@amd.com>
Cc: Melissa Wen <mwen@igalia.com>
Cc: Simon Ser <contact@emersion.fr>
---
 .../amd/display/amdgpu_dm/amdgpu_dm_plane.c   | 41 +++++++++++--------
 1 file changed, 25 insertions(+), 16 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 de1c7026ffcd..8eeca160d434 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
@@ -113,6 +113,11 @@ void amdgpu_dm_plane_fill_blending_from_plane_state(const struct drm_plane_state
 			DRM_FORMAT_ARGB8888,
 			DRM_FORMAT_RGBA8888,
 			DRM_FORMAT_ABGR8888,
+			DRM_FORMAT_ARGB2101010,
+			DRM_FORMAT_ABGR2101010,
+			DRM_FORMAT_ARGB16161616,
+			DRM_FORMAT_ABGR16161616,
+			DRM_FORMAT_ARGB16161616F,
 		};
 		uint32_t format = plane_state->fb->format->format;
 		unsigned int i;
@@ -698,8 +703,8 @@ static int get_plane_formats(const struct drm_plane *plane,
 	 * caps list.
 	 */
 
-	switch (plane->type) {
-	case DRM_PLANE_TYPE_PRIMARY:
+	if (plane->type == DRM_PLANE_TYPE_PRIMARY ||
+		(plane_cap && plane_cap->type == DC_PLANE_TYPE_DCN_UNIVERSAL && plane->type != DRM_PLANE_TYPE_CURSOR)) {
 		for (i = 0; i < ARRAY_SIZE(rgb_formats); ++i) {
 			if (num_formats >= max_formats)
 				break;
@@ -717,25 +722,29 @@ static int get_plane_formats(const struct drm_plane *plane,
 			formats[num_formats++] = DRM_FORMAT_XBGR16161616F;
 			formats[num_formats++] = DRM_FORMAT_ABGR16161616F;
 		}
-		break;
+	} else {
+		switch (plane->type) {
+		case DRM_PLANE_TYPE_OVERLAY:
+			for (i = 0; i < ARRAY_SIZE(overlay_formats); ++i) {
+				if (num_formats >= max_formats)
+					break;
 
-	case DRM_PLANE_TYPE_OVERLAY:
-		for (i = 0; i < ARRAY_SIZE(overlay_formats); ++i) {
-			if (num_formats >= max_formats)
-				break;
+				formats[num_formats++] = overlay_formats[i];
+			}
+			break;
 
-			formats[num_formats++] = overlay_formats[i];
-		}
-		break;
+		case DRM_PLANE_TYPE_CURSOR:
+			for (i = 0; i < ARRAY_SIZE(cursor_formats); ++i) {
+				if (num_formats >= max_formats)
+					break;
 
-	case DRM_PLANE_TYPE_CURSOR:
-		for (i = 0; i < ARRAY_SIZE(cursor_formats); ++i) {
-			if (num_formats >= max_formats)
-				break;
+				formats[num_formats++] = cursor_formats[i];
+			}
+			break;
 
-			formats[num_formats++] = cursor_formats[i];
+		default:
+			break;
 		}
-		break;
 	}
 
 	return num_formats;
-- 
2.41.0


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

* [PATCH 2/3] drm/amd/display: Enable 3 plane for DCN 3.01
  2023-07-09  2:06 [PATCH 1/3] drm/amd/display: Expose more formats for overlay planes on DCN Joshua Ashton
@ 2023-07-09  2:06 ` Joshua Ashton
  2023-07-09  2:06 ` [PATCH 3/3] drm/amd/display: Implement zpos property Joshua Ashton
  2023-07-13 18:03 ` [PATCH 1/3] drm/amd/display: Expose more formats for overlay planes on DCN Hamza Mahfooz
  2 siblings, 0 replies; 6+ messages in thread
From: Joshua Ashton @ 2023-07-09  2:06 UTC (permalink / raw)
  To: amd-gfx; +Cc: Melissa Wen, Simon Ser, Harry Wentland, Joshua Ashton

Steam Deck/Gamescope wants to take advantage of more planes which is
possible on VanGogh but was not previously exposed.

Signed-off-by: Joshua Ashton <joshua@froggi.es>

Cc: Harry Wentland <harry.wentland@amd.com>
Cc: Melissa Wen <mwen@igalia.com>
Cc: Simon Ser <contact@emersion.fr>
---
 drivers/gpu/drm/amd/display/dc/dcn301/dcn301_resource.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/amd/display/dc/dcn301/dcn301_resource.c b/drivers/gpu/drm/amd/display/dc/dcn301/dcn301_resource.c
index 3485fbb1093e..94eefebd4607 100644
--- a/drivers/gpu/drm/amd/display/dc/dcn301/dcn301_resource.c
+++ b/drivers/gpu/drm/amd/display/dc/dcn301/dcn301_resource.c
@@ -1425,9 +1425,9 @@ static bool dcn301_resource_construct(
 	dc->caps.max_cursor_size = 256;
 	dc->caps.min_horizontal_blanking_period = 80;
 	dc->caps.dmdata_alloc_size = 2048;
-	dc->caps.max_slave_planes = 1;
-	dc->caps.max_slave_yuv_planes = 1;
-	dc->caps.max_slave_rgb_planes = 1;
+	dc->caps.max_slave_planes = 2;
+	dc->caps.max_slave_yuv_planes = 2;
+	dc->caps.max_slave_rgb_planes = 2;
 	dc->caps.is_apu = true;
 	dc->caps.post_blend_color_processing = true;
 	dc->caps.force_dp_tps4_for_cp2520 = true;
-- 
2.41.0


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

* [PATCH 3/3] drm/amd/display: Implement zpos property
  2023-07-09  2:06 [PATCH 1/3] drm/amd/display: Expose more formats for overlay planes on DCN Joshua Ashton
  2023-07-09  2:06 ` [PATCH 2/3] drm/amd/display: Enable 3 plane for DCN 3.01 Joshua Ashton
@ 2023-07-09  2:06 ` Joshua Ashton
  2023-07-13 17:55   ` Harry Wentland
  2023-07-13 18:03 ` [PATCH 1/3] drm/amd/display: Expose more formats for overlay planes on DCN Hamza Mahfooz
  2 siblings, 1 reply; 6+ messages in thread
From: Joshua Ashton @ 2023-07-09  2:06 UTC (permalink / raw)
  To: amd-gfx; +Cc: Melissa Wen, Simon Ser, Harry Wentland, Joshua Ashton

Despite certain GPUs supporting multiple overlay planes already in
AMDGPU, the driver did not expose the zpos property which is required
for userspace to take advantage of multiple overlay planes in any
meaningful way.

The driver was already hooked up to normalized_zpos, but was just
missing the exposure of it.

Signed-off-by: Joshua Ashton <joshua@froggi.es>

Cc: Harry Wentland <harry.wentland@amd.com>
Cc: Melissa Wen <mwen@igalia.com>
Cc: Simon Ser <contact@emersion.fr>
---
 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_plane.c | 9 +++++++++
 1 file changed, 9 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 8eeca160d434..2198df96ed6f 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
@@ -1468,6 +1468,15 @@ int amdgpu_dm_plane_init(struct amdgpu_display_manager *dm,
 		drm_plane_create_blend_mode_property(plane, blend_caps);
 	}
 
+	if (plane->type == DRM_PLANE_TYPE_PRIMARY) {
+		drm_plane_create_zpos_immutable_property(plane, 0);
+	} else if (plane->type == DRM_PLANE_TYPE_OVERLAY) {
+		unsigned int zpos = 1 + drm_plane_index(plane);
+		drm_plane_create_zpos_property(plane, zpos, 1, 254);
+	} else if (plane->type == DRM_PLANE_TYPE_CURSOR) {
+		drm_plane_create_zpos_immutable_property(plane, 255);
+	}
+
 	if (plane->type == DRM_PLANE_TYPE_PRIMARY &&
 	    plane_cap &&
 	    (plane_cap->pixel_format_support.nv12 ||
-- 
2.41.0


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

* Re: [PATCH 3/3] drm/amd/display: Implement zpos property
  2023-07-09  2:06 ` [PATCH 3/3] drm/amd/display: Implement zpos property Joshua Ashton
@ 2023-07-13 17:55   ` Harry Wentland
  2023-07-24 13:44     ` Rodrigo Siqueira
  0 siblings, 1 reply; 6+ messages in thread
From: Harry Wentland @ 2023-07-13 17:55 UTC (permalink / raw)
  To: Joshua Ashton, amd-gfx; +Cc: Melissa Wen, Simon Ser



On 2023-07-08 22:06, Joshua Ashton wrote:
> Despite certain GPUs supporting multiple overlay planes already in
> AMDGPU, the driver did not expose the zpos property which is required
> for userspace to take advantage of multiple overlay planes in any
> meaningful way.
> 
> The driver was already hooked up to normalized_zpos, but was just
> missing the exposure of it.
> 
> Signed-off-by: Joshua Ashton <joshua@froggi.es>

Series is
Reviewed-by: Harry Wentland <harry.wentland@amd.com>

Harry

> 
> Cc: Harry Wentland <harry.wentland@amd.com>
> Cc: Melissa Wen <mwen@igalia.com>
> Cc: Simon Ser <contact@emersion.fr>
> ---
>  drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_plane.c | 9 +++++++++
>  1 file changed, 9 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 8eeca160d434..2198df96ed6f 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
> @@ -1468,6 +1468,15 @@ int amdgpu_dm_plane_init(struct amdgpu_display_manager *dm,
>  		drm_plane_create_blend_mode_property(plane, blend_caps);
>  	}
>  
> +	if (plane->type == DRM_PLANE_TYPE_PRIMARY) {
> +		drm_plane_create_zpos_immutable_property(plane, 0);
> +	} else if (plane->type == DRM_PLANE_TYPE_OVERLAY) {
> +		unsigned int zpos = 1 + drm_plane_index(plane);
> +		drm_plane_create_zpos_property(plane, zpos, 1, 254);
> +	} else if (plane->type == DRM_PLANE_TYPE_CURSOR) {
> +		drm_plane_create_zpos_immutable_property(plane, 255);
> +	}
> +
>  	if (plane->type == DRM_PLANE_TYPE_PRIMARY &&
>  	    plane_cap &&
>  	    (plane_cap->pixel_format_support.nv12 ||


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

* Re: [PATCH 1/3] drm/amd/display: Expose more formats for overlay planes on DCN
  2023-07-09  2:06 [PATCH 1/3] drm/amd/display: Expose more formats for overlay planes on DCN Joshua Ashton
  2023-07-09  2:06 ` [PATCH 2/3] drm/amd/display: Enable 3 plane for DCN 3.01 Joshua Ashton
  2023-07-09  2:06 ` [PATCH 3/3] drm/amd/display: Implement zpos property Joshua Ashton
@ 2023-07-13 18:03 ` Hamza Mahfooz
  2 siblings, 0 replies; 6+ messages in thread
From: Hamza Mahfooz @ 2023-07-13 18:03 UTC (permalink / raw)
  To: Joshua Ashton, amd-gfx; +Cc: Melissa Wen, Simon Ser, Harry Wentland

On 7/8/23 22:06, Joshua Ashton wrote:
> DCN planes are universal and therefore overlay planes can use the same
> formats as primary planes, unlike DCE.
> 
> Gamescope/Steam Deck would like to take advantage of this functionality
> for partial composition which in some cases in our pipeline, can contain
> negative values in some instances.
> 
> Signed-off-by: Joshua Ashton <joshua@froggi.es>
> 
> Cc: Harry Wentland <harry.wentland@amd.com>
> Cc: Melissa Wen <mwen@igalia.com>
> Cc: Simon Ser <contact@emersion.fr>

I have applied the series, thanks!

> ---
>   .../amd/display/amdgpu_dm/amdgpu_dm_plane.c   | 41 +++++++++++--------
>   1 file changed, 25 insertions(+), 16 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 de1c7026ffcd..8eeca160d434 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
> @@ -113,6 +113,11 @@ void amdgpu_dm_plane_fill_blending_from_plane_state(const struct drm_plane_state
>   			DRM_FORMAT_ARGB8888,
>   			DRM_FORMAT_RGBA8888,
>   			DRM_FORMAT_ABGR8888,
> +			DRM_FORMAT_ARGB2101010,
> +			DRM_FORMAT_ABGR2101010,
> +			DRM_FORMAT_ARGB16161616,
> +			DRM_FORMAT_ABGR16161616,
> +			DRM_FORMAT_ARGB16161616F,
>   		};
>   		uint32_t format = plane_state->fb->format->format;
>   		unsigned int i;
> @@ -698,8 +703,8 @@ static int get_plane_formats(const struct drm_plane *plane,
>   	 * caps list.
>   	 */
>   
> -	switch (plane->type) {
> -	case DRM_PLANE_TYPE_PRIMARY:
> +	if (plane->type == DRM_PLANE_TYPE_PRIMARY ||
> +		(plane_cap && plane_cap->type == DC_PLANE_TYPE_DCN_UNIVERSAL && plane->type != DRM_PLANE_TYPE_CURSOR)) {
>   		for (i = 0; i < ARRAY_SIZE(rgb_formats); ++i) {
>   			if (num_formats >= max_formats)
>   				break;
> @@ -717,25 +722,29 @@ static int get_plane_formats(const struct drm_plane *plane,
>   			formats[num_formats++] = DRM_FORMAT_XBGR16161616F;
>   			formats[num_formats++] = DRM_FORMAT_ABGR16161616F;
>   		}
> -		break;
> +	} else {
> +		switch (plane->type) {
> +		case DRM_PLANE_TYPE_OVERLAY:
> +			for (i = 0; i < ARRAY_SIZE(overlay_formats); ++i) {
> +				if (num_formats >= max_formats)
> +					break;
>   
> -	case DRM_PLANE_TYPE_OVERLAY:
> -		for (i = 0; i < ARRAY_SIZE(overlay_formats); ++i) {
> -			if (num_formats >= max_formats)
> -				break;
> +				formats[num_formats++] = overlay_formats[i];
> +			}
> +			break;
>   
> -			formats[num_formats++] = overlay_formats[i];
> -		}
> -		break;
> +		case DRM_PLANE_TYPE_CURSOR:
> +			for (i = 0; i < ARRAY_SIZE(cursor_formats); ++i) {
> +				if (num_formats >= max_formats)
> +					break;
>   
> -	case DRM_PLANE_TYPE_CURSOR:
> -		for (i = 0; i < ARRAY_SIZE(cursor_formats); ++i) {
> -			if (num_formats >= max_formats)
> -				break;
> +				formats[num_formats++] = cursor_formats[i];
> +			}
> +			break;
>   
> -			formats[num_formats++] = cursor_formats[i];
> +		default:
> +			break;
>   		}
> -		break;
>   	}
>   
>   	return num_formats;
-- 
Hamza


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

* Re: [PATCH 3/3] drm/amd/display: Implement zpos property
  2023-07-13 17:55   ` Harry Wentland
@ 2023-07-24 13:44     ` Rodrigo Siqueira
  0 siblings, 0 replies; 6+ messages in thread
From: Rodrigo Siqueira @ 2023-07-24 13:44 UTC (permalink / raw)
  To: Joshua Ashton, Nicholas Choi, Akuneme, Ekene
  Cc: Melissa Wen, Simon Ser, Harry Wentland, amd-gfx

Hi Joshua,

It looks like this patch caused a regression in the following IGT test:

kms_atomic@plane-immutable-zpos

This issue is causing failures in our CI; we probably need to revert it. 
Could you check it?

Thanks
Siqueira

On 7/13/23 13:55, Harry Wentland wrote:
> 
> 
> On 2023-07-08 22:06, Joshua Ashton wrote:
>> Despite certain GPUs supporting multiple overlay planes already in
>> AMDGPU, the driver did not expose the zpos property which is required
>> for userspace to take advantage of multiple overlay planes in any
>> meaningful way.
>>
>> The driver was already hooked up to normalized_zpos, but was just
>> missing the exposure of it.
>>
>> Signed-off-by: Joshua Ashton <joshua@froggi.es>
> 
> Series is
> Reviewed-by: Harry Wentland <harry.wentland@amd.com>
> 
> Harry
> 
>>
>> Cc: Harry Wentland <harry.wentland@amd.com>
>> Cc: Melissa Wen <mwen@igalia.com>
>> Cc: Simon Ser <contact@emersion.fr>
>> ---
>>   drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_plane.c | 9 +++++++++
>>   1 file changed, 9 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 8eeca160d434..2198df96ed6f 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
>> @@ -1468,6 +1468,15 @@ int amdgpu_dm_plane_init(struct amdgpu_display_manager *dm,
>>   		drm_plane_create_blend_mode_property(plane, blend_caps);
>>   	}
>>   
>> +	if (plane->type == DRM_PLANE_TYPE_PRIMARY) {
>> +		drm_plane_create_zpos_immutable_property(plane, 0);
>> +	} else if (plane->type == DRM_PLANE_TYPE_OVERLAY) {
>> +		unsigned int zpos = 1 + drm_plane_index(plane);
>> +		drm_plane_create_zpos_property(plane, zpos, 1, 254);
>> +	} else if (plane->type == DRM_PLANE_TYPE_CURSOR) {
>> +		drm_plane_create_zpos_immutable_property(plane, 255);
>> +	}
>> +
>>   	if (plane->type == DRM_PLANE_TYPE_PRIMARY &&
>>   	    plane_cap &&
>>   	    (plane_cap->pixel_format_support.nv12 ||
> 

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

end of thread, other threads:[~2023-07-24 13:41 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-07-09  2:06 [PATCH 1/3] drm/amd/display: Expose more formats for overlay planes on DCN Joshua Ashton
2023-07-09  2:06 ` [PATCH 2/3] drm/amd/display: Enable 3 plane for DCN 3.01 Joshua Ashton
2023-07-09  2:06 ` [PATCH 3/3] drm/amd/display: Implement zpos property Joshua Ashton
2023-07-13 17:55   ` Harry Wentland
2023-07-24 13:44     ` Rodrigo Siqueira
2023-07-13 18:03 ` [PATCH 1/3] drm/amd/display: Expose more formats for overlay planes on DCN Hamza Mahfooz

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.