Make sure that the primary plane will get normalized_zpos=0 if it's zpos is
set to 0, avoiding other planes to be placed in the background.

If user space wants to move the primary plane forward, it can set the zpos
of the plane.

Signed-off-by: Peter Ujfalusi <peter.ujfal...@ti.com>
---
 drivers/gpu/drm/drm_blend.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/drm_blend.c b/drivers/gpu/drm/drm_blend.c
index 4c62dff14893..bdc4f714afb8 100644
--- a/drivers/gpu/drm/drm_blend.c
+++ b/drivers/gpu/drm/drm_blend.c
@@ -301,7 +301,11 @@ static int drm_atomic_state_zpos_cmp(const void *a, const 
void *b)
        const struct drm_plane_state *sa = *(struct drm_plane_state **)a;
        const struct drm_plane_state *sb = *(struct drm_plane_state **)b;
 
-       if (sa->zpos != sb->zpos)
+       if (sa->plane == sa->crtc->primary && sa->zpos == 0)
+               return -1;
+       else if (sb->plane == sb->crtc->primary && sb->zpos == 0)
+               return 1;
+       else if (sa->zpos != sb->zpos)
                return sa->zpos - sb->zpos;
        else
                return sa->plane->base.id - sb->plane->base.id;
-- 
Peter

Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

Reply via email to