[PATCH] drm/amd/display: Make plane z-pos explicit to userspace

2019-10-03 Thread Nicholas Kazlauskas
[Why]
Many userspace assumes that the DRM plane index indicates the plane
z-order, with a lower index being lower depth and a higher index being
higher depth. This is currently what we assume in DM.

DRM has a zpos plane property to make this explicit to userspace and
there are clients that make use of this information.

[How]
Attach the immutable zpos property to the plane.

While we can technically order the planes in any manner since we
virtualize them in DC we don't currently have the software support.

The z-pos could potentially become immutable later but for now
just let userspace do the ordering.

Cc: Leo Li 
Cc: Harry Wentland 
Cc: Rodrigo Siqueira 
Signed-off-by: Nicholas Kazlauskas 
---
 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c 
b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
index 239b1ae86007..e58b0b7e3c52 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
@@ -4897,6 +4897,9 @@ static int amdgpu_dm_plane_init(struct 
amdgpu_display_manager *dm,
if (res)
return res;
 
+   /* Make z-pos of each plane explicit - lower ID is lower depth */
+   drm_plane_create_zpos_immutable_property(plane, plane->index);
+
if (plane->type == DRM_PLANE_TYPE_OVERLAY &&
plane_cap && plane_cap->per_pixel_alpha) {
unsigned int blend_caps = BIT(DRM_MODE_BLEND_PIXEL_NONE) |
-- 
2.20.1

___
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

Re: [PATCH] drm/amd/display: Make plane z-pos explicit to userspace

2019-10-04 Thread Harry Wentland
On 2019-10-03 10:46 a.m., Nicholas Kazlauskas wrote:
> [Why]
> Many userspace assumes that the DRM plane index indicates the plane
> z-order, with a lower index being lower depth and a higher index being
> higher depth. This is currently what we assume in DM.
> 
> DRM has a zpos plane property to make this explicit to userspace and
> there are clients that make use of this information.
> 
> [How]
> Attach the immutable zpos property to the plane.
> 
> While we can technically order the planes in any manner since we
> virtualize them in DC we don't currently have the software support.
> 
> The z-pos could potentially become immutable later but for now
> just let userspace do the ordering.
> 
> Cc: Leo Li 
> Cc: Harry Wentland 
> Cc: Rodrigo Siqueira 
> Signed-off-by: Nicholas Kazlauskas 

Reviewed-by: Harry Wentland 

Harry

> ---
>  drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c 
> b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> index 239b1ae86007..e58b0b7e3c52 100644
> --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> @@ -4897,6 +4897,9 @@ static int amdgpu_dm_plane_init(struct 
> amdgpu_display_manager *dm,
>   if (res)
>   return res;
>  
> + /* Make z-pos of each plane explicit - lower ID is lower depth */
> + drm_plane_create_zpos_immutable_property(plane, plane->index);
> +
>   if (plane->type == DRM_PLANE_TYPE_OVERLAY &&
>   plane_cap && plane_cap->per_pixel_alpha) {
>   unsigned int blend_caps = BIT(DRM_MODE_BLEND_PIXEL_NONE) |
> 
___
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx