diff mbox

[PATCH/RFC,376/390] drm/rcar-du: Fix plane index wrap-around for multi-planar overlays

Message ID 1364525119-31791-377-git-send-email-horms+renesas@verge.net.au (mailing list archive)
State New, archived
Headers show

Commit Message

Simon Horman March 29, 2013, 2:45 a.m. UTC
From: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>

If the first hardware plane of a multi-planar overlay is plane 7 the
second hardware plane will be plane 0. Handle the wrap-around when
configuring plane priorities.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
(cherry picked from commit 3e2857ce3666ef97ea5abf0ce7268ee5d8b4311d)

Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
---
 drivers/gpu/drm/rcar-du/rcar_du_crtc.c |    7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
diff mbox

Patch

diff --git a/drivers/gpu/drm/rcar-du/rcar_du_crtc.c b/drivers/gpu/drm/rcar-du/rcar_du_crtc.c
index 22b87ec..ca80939 100644
--- a/drivers/gpu/drm/rcar-du/rcar_du_crtc.c
+++ b/drivers/gpu/drm/rcar-du/rcar_du_crtc.c
@@ -142,13 +142,16 @@  void rcar_du_crtc_update_planes(struct drm_crtc *crtc)
 
 	for (i = 0; i < num_planes; ++i) {
 		struct rcar_du_plane *plane = planes[i];
+		unsigned int index = plane->hwindex;
 
 		prio -= 4;
-		dspr |= (plane->hwindex + 1) << prio;
+		dspr |= (index + 1) << prio;
 
 		if (plane->format->planes == 2) {
+			index = (index + 1) % 8;
+
 			prio -= 4;
-			dspr |= (plane->hwindex + 2) << prio;
+			dspr |= (index + 1) << prio;
 		}
 	}