[PATCH 1/2] drm/blend: Account also the primary plane of the crtc for normalized_zpos

Peter Ujfalusi peter.ujfalusi at ti.com
Thu Dec 21 12:11:00 UTC 2017


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.ujfalusi at 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



More information about the dri-devel mailing list