diff mbox

[3.11.y.z,extended,stable] Patch "drm/rcar-du: Update plane pitch in .mode_set_base() operation" has been added to staging queue

Message ID 1391605893-28764-1-git-send-email-luis.henriques@canonical.com
State New
Headers show

Commit Message

Luis Henriques Feb. 5, 2014, 1:11 p.m. UTC
This is a note to let you know that I have just added a patch titled

    drm/rcar-du: Update plane pitch in .mode_set_base() operation

to the linux-3.11.y-queue branch of the 3.11.y.z extended stable tree 
which can be found at:

 http://kernel.ubuntu.com/git?p=ubuntu/linux.git;a=shortlog;h=refs/heads/linux-3.11.y-queue

If you, or anyone else, feels it should not be added to this tree, please 
reply to this email.

For more information about the 3.11.y.z tree, see
https://wiki.ubuntu.com/Kernel/Dev/ExtendedStable

Thanks.
-Luis

------

From f7cfd1f5668e49ef6b5dabfd9878d94b4795cb9c Mon Sep 17 00:00:00 2001
From: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Date: Wed, 13 Nov 2013 14:26:01 +0100
Subject: drm/rcar-du: Update plane pitch in .mode_set_base() operation

commit eb86301f293da3c362db729a9f40ddb25755902b upstream.

When setting a new frame buffer with the mode set base operation the
pitch value might change. Set the hardware plane pitch register at the
same time as the plane base address in the rcar_du_plane_update_base()
function to make sure the pitch value always matches the frame buffer.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
[ luis: backported to 3.11:
  - replaced 'rgrp' by 'rcdu' in rcar_du_plane_write() call ]
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/gpu/drm/rcar-du/rcar_du_crtc.c  |  1 -
 drivers/gpu/drm/rcar-du/rcar_du_plane.c | 21 +++++++++++----------
 2 files changed, 11 insertions(+), 11 deletions(-)

--
1.8.3.2
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 24183fb..23a946d 100644
--- a/drivers/gpu/drm/rcar-du/rcar_du_crtc.c
+++ b/drivers/gpu/drm/rcar-du/rcar_du_crtc.c
@@ -408,7 +408,6 @@  static int rcar_du_crtc_mode_set(struct drm_crtc *crtc,
 		goto error;

 	rcrtc->plane->format = format;
-	rcrtc->plane->pitch = crtc->fb->pitches[0];

 	rcrtc->plane->src_x = x;
 	rcrtc->plane->src_y = y;
diff --git a/drivers/gpu/drm/rcar-du/rcar_du_plane.c b/drivers/gpu/drm/rcar-du/rcar_du_plane.c
index a65f81d..e376b4c 100644
--- a/drivers/gpu/drm/rcar-du/rcar_du_plane.c
+++ b/drivers/gpu/drm/rcar-du/rcar_du_plane.c
@@ -102,6 +102,15 @@  void rcar_du_plane_update_base(struct rcar_du_plane *plane)
 {
 	struct rcar_du_device *rcdu = plane->dev;
 	unsigned int index = plane->hwindex;
+	u32 mwr;
+
+	/* Memory pitch (expressed in pixels) */
+	if (plane->format->planes == 2)
+		mwr = plane->pitch;
+	else
+		mwr = plane->pitch * 8 / plane->format->bpp;
+
+	rcar_du_plane_write(rcdu, index, PnMWR, mwr);

 	/* According to the datasheet the Y position is expressed in raster line
 	 * units. However, 32bpp formats seem to require a doubled Y position
@@ -128,6 +137,8 @@  void rcar_du_plane_compute_base(struct rcar_du_plane *plane,
 {
 	struct drm_gem_cma_object *gem;

+	plane->pitch = fb->pitches[0];
+
 	gem = drm_fb_cma_get_gem_obj(fb, 0);
 	plane->dma[0] = gem->paddr + fb->offsets[0];

@@ -204,7 +215,6 @@  static void __rcar_du_plane_setup(struct rcar_du_plane *plane,
 	struct rcar_du_device *rcdu = plane->dev;
 	u32 ddcr2 = PnDDCR2_CODE;
 	u32 ddcr4;
-	u32 mwr;

 	/* Data format
 	 *
@@ -235,14 +245,6 @@  static void __rcar_du_plane_setup(struct rcar_du_plane *plane,
 	rcar_du_plane_write(rcdu, index, PnDDCR2, ddcr2);
 	rcar_du_plane_write(rcdu, index, PnDDCR4, ddcr4);

-	/* Memory pitch (expressed in pixels) */
-	if (plane->format->planes == 2)
-		mwr = plane->pitch;
-	else
-		mwr = plane->pitch * 8 / plane->format->bpp;
-
-	rcar_du_plane_write(rcdu, index, PnMWR, mwr);
-
 	/* Destination position and size */
 	rcar_du_plane_write(rcdu, index, PnDSXR, plane->width);
 	rcar_du_plane_write(rcdu, index, PnDSYR, plane->height);
@@ -304,7 +306,6 @@  rcar_du_plane_update(struct drm_plane *plane, struct drm_crtc *crtc,

 	rplane->crtc = crtc;
 	rplane->format = format;
-	rplane->pitch = fb->pitches[0];

 	rplane->src_x = src_x >> 16;
 	rplane->src_y = src_y >> 16;