#include <drm/drm_vblank.h>
 #include <drm/radeon_drm.h>
+#include <drm/drm_fourcc.h>
 
 #include "atom.h"
 #include "avivod.h"
                         bool async)
 {
        struct radeon_crtc *radeon_crtc = rdev->mode_info.crtcs[crtc_id];
+       struct drm_framebuffer *fb = radeon_crtc->base.primary->fb;
 
-       /* update the scanout addresses */
+       /* flip at hsync for async, default is vsync */
        WREG32(EVERGREEN_GRPH_FLIP_CONTROL + radeon_crtc->crtc_offset,
               async ? EVERGREEN_GRPH_SURFACE_UPDATE_H_RETRACE_EN : 0);
+       /* update pitch */
+       WREG32(EVERGREEN_GRPH_PITCH + radeon_crtc->crtc_offset,
+              fb->pitches[0] / fb->format->cpp[0]);
+       /* update the scanout addresses */
        WREG32(EVERGREEN_GRPH_PRIMARY_SURFACE_ADDRESS_HIGH + radeon_crtc->crtc_offset,
               upper_32_bits(crtc_base));
        WREG32(EVERGREEN_GRPH_PRIMARY_SURFACE_ADDRESS + radeon_crtc->crtc_offset,
 
 void r100_page_flip(struct radeon_device *rdev, int crtc_id, u64 crtc_base, bool async)
 {
        struct radeon_crtc *radeon_crtc = rdev->mode_info.crtcs[crtc_id];
+       uint32_t crtc_pitch, pitch_pixels;
+       struct drm_framebuffer *fb = radeon_crtc->base.primary->fb;
        u32 tmp = ((u32)crtc_base) | RADEON_CRTC_OFFSET__OFFSET_LOCK;
        int i;
 
        /* update the scanout addresses */
        WREG32(RADEON_CRTC_OFFSET + radeon_crtc->crtc_offset, tmp);
 
+       /* update pitch */
+       pitch_pixels = fb->pitches[0] / fb->format->cpp[0];
+       crtc_pitch = DIV_ROUND_UP(pitch_pixels * fb->format->cpp[0] * 8,
+                                 fb->format->cpp[0] * 8 * 8);
+       crtc_pitch |= crtc_pitch << 16;
+       WREG32(RADEON_CRTC_PITCH + radeon_crtc->crtc_offset, crtc_pitch);
+
        /* Wait for update_pending to go high. */
        for (i = 0; i < rdev->usec_timeout; i++) {
                if (RREG32(RADEON_CRTC_OFFSET + radeon_crtc->crtc_offset) & RADEON_CRTC_OFFSET__GUI_TRIG_OFFSET)
 
 
 #include <drm/drm_device.h>
 #include <drm/drm_vblank.h>
+#include <drm/drm_fourcc.h>
 
 #include "atom.h"
 #include "radeon.h"
 void rs600_page_flip(struct radeon_device *rdev, int crtc_id, u64 crtc_base, bool async)
 {
        struct radeon_crtc *radeon_crtc = rdev->mode_info.crtcs[crtc_id];
+       struct drm_framebuffer *fb = radeon_crtc->base.primary->fb;
        u32 tmp = RREG32(AVIVO_D1GRPH_UPDATE + radeon_crtc->crtc_offset);
        int i;
 
        tmp |= AVIVO_D1GRPH_UPDATE_LOCK;
        WREG32(AVIVO_D1GRPH_UPDATE + radeon_crtc->crtc_offset, tmp);
 
-       /* update the scanout addresses */
+       /* flip at hsync for async, default is vsync */
        WREG32(AVIVO_D1GRPH_FLIP_CONTROL + radeon_crtc->crtc_offset,
               async ? AVIVO_D1GRPH_SURFACE_UPDATE_H_RETRACE_EN : 0);
+       /* update pitch */
+       WREG32(AVIVO_D1GRPH_PITCH + radeon_crtc->crtc_offset,
+              fb->pitches[0] / fb->format->cpp[0]);
+       /* update the scanout addresses */
        WREG32(AVIVO_D1GRPH_SECONDARY_SURFACE_ADDRESS + radeon_crtc->crtc_offset,
               (u32)crtc_base);
        WREG32(AVIVO_D1GRPH_PRIMARY_SURFACE_ADDRESS + radeon_crtc->crtc_offset,
 
 
 #include <drm/drm_device.h>
 #include <drm/radeon_drm.h>
+#include <drm/drm_fourcc.h>
 
 #include "atom.h"
 #include "avivod.h"
 void rv770_page_flip(struct radeon_device *rdev, int crtc_id, u64 crtc_base, bool async)
 {
        struct radeon_crtc *radeon_crtc = rdev->mode_info.crtcs[crtc_id];
+       struct drm_framebuffer *fb = radeon_crtc->base.primary->fb;
        u32 tmp = RREG32(AVIVO_D1GRPH_UPDATE + radeon_crtc->crtc_offset);
        int i;
 
        tmp |= AVIVO_D1GRPH_UPDATE_LOCK;
        WREG32(AVIVO_D1GRPH_UPDATE + radeon_crtc->crtc_offset, tmp);
 
-       /* update the scanout addresses */
+       /* flip at hsync for async, default is vsync */
        WREG32(AVIVO_D1GRPH_FLIP_CONTROL + radeon_crtc->crtc_offset,
               async ? AVIVO_D1GRPH_SURFACE_UPDATE_H_RETRACE_EN : 0);
+       /* update pitch */
+       WREG32(AVIVO_D1GRPH_PITCH + radeon_crtc->crtc_offset,
+              fb->pitches[0] / fb->format->cpp[0]);
+       /* update the scanout addresses */
        if (radeon_crtc->crtc_id) {
                WREG32(D2GRPH_SECONDARY_SURFACE_ADDRESS_HIGH, upper_32_bits(crtc_base));
                WREG32(D2GRPH_PRIMARY_SURFACE_ADDRESS_HIGH, upper_32_bits(crtc_base));