[PATCH 3.13 099/120] drm/rcar-du: Update plane pitch in .mode_set_base() operation

From: Greg Kroah-Hartman
Date: Tue Feb 11 2014 - 15:43:04 EST


3.13-stable review patch. If anyone has any objections, please let me know.

------------------

From: Laurent Pinchart <laurent.pinchart+renesas@xxxxxxxxxxxxxxxx>

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@xxxxxxxxxxxxxxxx>
Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>

---
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(-)

--- a/drivers/gpu/drm/rcar-du/rcar_du_crtc.c
+++ b/drivers/gpu/drm/rcar-du/rcar_du_crtc.c
@@ -371,7 +371,6 @@ static int rcar_du_crtc_mode_set(struct
goto error;

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

rcrtc->plane->src_x = x;
rcrtc->plane->src_y = y;
--- a/drivers/gpu/drm/rcar-du/rcar_du_plane.c
+++ b/drivers/gpu/drm/rcar-du/rcar_du_plane.c
@@ -104,6 +104,15 @@ void rcar_du_plane_update_base(struct rc
{
struct rcar_du_group *rgrp = plane->group;
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(rgrp, index, PnMWR, mwr);

/* The Y position is expressed in raster line units and must be doubled
* for 32bpp formats, according to the R8A7790 datasheet. No mention of
@@ -133,6 +142,8 @@ void rcar_du_plane_compute_base(struct r
{
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];

@@ -209,7 +220,6 @@ static void __rcar_du_plane_setup(struct
struct rcar_du_group *rgrp = plane->group;
u32 ddcr2 = PnDDCR2_CODE;
u32 ddcr4;
- u32 mwr;

/* Data format
*
@@ -240,14 +250,6 @@ static void __rcar_du_plane_setup(struct
rcar_du_plane_write(rgrp, index, PnDDCR2, ddcr2);
rcar_du_plane_write(rgrp, 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(rgrp, index, PnMWR, mwr);
-
/* Destination position and size */
rcar_du_plane_write(rgrp, index, PnDSXR, plane->width);
rcar_du_plane_write(rgrp, index, PnDSYR, plane->height);
@@ -309,7 +311,6 @@ rcar_du_plane_update(struct drm_plane *p

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

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


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/