drm/mediatek: plane: Use FB's format's cpp to compute x offset
authorDaniel Kurtz <djkurtz@chromium.org>
Thu, 4 Aug 2016 02:59:56 +0000 (10:59 +0800)
committerSean Paul <seanpaul@chromium.org>
Mon, 8 Aug 2016 18:20:02 +0000 (14:20 -0400)
Use the framebuffer's format to compute its cpp, and use it when
calculating the address shift value.

Signed-off-by: Bibby Hsieh <bibby.hsieh@mediatek.com>
Signed-off-by: Sean Paul <seanpaul@chromium.org>
Link: http://patchwork.freedesktop.org/patch/msgid/1470279597-60453-7-git-send-email-bibby.hsieh@mediatek.com
drivers/gpu/drm/mediatek/mtk_drm_plane.c

index b3ddb20b2e587a51a808bb4634573a7e6ee4cfd9..c461a232cbf5b0f5ebf589481f4391e7f27f24e0 100644 (file)
@@ -135,7 +135,7 @@ static void mtk_plane_atomic_update(struct drm_plane *plane,
        pitch = fb->pitches[0];
        format = fb->pixel_format;
 
-       addr += (plane->state->src.x1 >> 16) * 4;
+       addr += (plane->state->src.x1 >> 16) * drm_format_plane_cpp(format, 0);
        addr += (plane->state->src.y1 >> 16) * pitch;
 
        state->pending.enable = true;