summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2010-06-15 20:26:19 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2010-06-15 20:30:41 +0100
commita25573d5c47ebea34c076075e1993233d7db2b4f (patch)
treea5bbf5f6a0452fdd4dbc8979b75a07baa9006144
parent23ddcf45344936da2931a3bf25bd187a9ea28344 (diff)
drmmode: Use the tiled stride for the rotated pixmap.
After d41684d5459 we now allocate all framebuffers as tiled bo, and so we must be careful to use the appropriate stride as returned from the allocation, instead of assuming that it is just an aligned width. Fixes: Bug 28461 - screen rotation results in corrupted output. https://bugs.freedesktop.org/show_bug.cgi?id=28461 Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Reported-by: Till Matthiesen <entropy@everymail.net>
-rw-r--r--src/drmmode_display.c17
-rw-r--r--src/i830.h9
-rw-r--r--src/i830_memory.c8
3 files changed, 18 insertions, 16 deletions
diff --git a/src/drmmode_display.c b/src/drmmode_display.c
index 6f7e5f11..ba24206e 100644
--- a/src/drmmode_display.c
+++ b/src/drmmode_display.c
@@ -60,6 +60,7 @@ typedef struct {
drmModeCrtcPtr mode_crtc;
dri_bo *cursor;
dri_bo *rotate_bo;
+ uint32_t rotate_pitch;
uint32_t rotate_fb_id;
} drmmode_crtc_private_rec, *drmmode_crtc_private_ptr;
@@ -472,8 +473,8 @@ drmmode_crtc_shadow_allocate(xf86CrtcPtr crtc, int width, int height)
ScrnInfoPtr scrn = crtc->scrn;
drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private;
drmmode_ptr drmmode = drmmode_crtc->drmmode;
- int ret;
unsigned long rotate_pitch;
+ int ret;
drmmode_crtc->rotate_bo = i830_allocate_framebuffer(scrn,
width, height,
@@ -496,6 +497,7 @@ drmmode_crtc_shadow_allocate(xf86CrtcPtr crtc, int width, int height)
return NULL;
}
+ drmmode_crtc->rotate_pitch = rotate_pitch;
return drmmode_crtc->rotate_bo;
}
@@ -505,8 +507,6 @@ drmmode_crtc_shadow_create(xf86CrtcPtr crtc, void *data, int width, int height)
ScrnInfoPtr scrn = crtc->scrn;
intel_screen_private *intel = intel_get_screen_private(scrn);
drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private;
- drmmode_ptr drmmode = drmmode_crtc->drmmode;
- unsigned long rotate_pitch;
PixmapPtr rotate_pixmap;
if (!data) {
@@ -517,13 +517,17 @@ drmmode_crtc_shadow_create(xf86CrtcPtr crtc, void *data, int width, int height)
return NULL;
}
}
+ if (drmmode_crtc->rotate_bo == NULL) {
+ xf86DrvMsg(scrn->scrnIndex, X_ERROR,
+ "Couldn't allocate shadow pixmap for rotated CRTC\n");
+ return NULL;
+ }
- rotate_pitch = i830_pad_drawable_width(width) * drmmode->cpp;
rotate_pixmap = GetScratchPixmapHeader(scrn->pScreen,
width, height,
scrn->depth,
scrn->bitsPerPixel,
- rotate_pitch,
+ drmmode_crtc->rotate_pitch,
NULL);
if (rotate_pixmap == NULL) {
@@ -532,8 +536,7 @@ drmmode_crtc_shadow_create(xf86CrtcPtr crtc, void *data, int width, int height)
return NULL;
}
- if (drmmode_crtc->rotate_bo)
- i830_set_pixmap_bo(rotate_pixmap, drmmode_crtc->rotate_bo);
+ i830_set_pixmap_bo(rotate_pixmap, drmmode_crtc->rotate_bo);
intel->shadow_present = TRUE;
diff --git a/src/i830.h b/src/i830.h
index c98a842f..02220ea9 100644
--- a/src/i830.h
+++ b/src/i830.h
@@ -648,13 +648,4 @@ static inline Bool pixmap_is_scanout(PixmapPtr pixmap)
return pixmap == screen->GetScreenPixmap(screen);
}
-/*
- * Pad to accelerator requirement
- */
-static inline int i830_pad_drawable_width(int width)
-{
- return (width + 63) & ~63;
-}
-
-
#endif /* _I830_H_ */
diff --git a/src/i830_memory.c b/src/i830_memory.c
index 083ddf58..50e31636 100644
--- a/src/i830_memory.c
+++ b/src/i830_memory.c
@@ -163,6 +163,14 @@ i830_check_display_stride(ScrnInfoPtr scrn, int stride, Bool tiling)
return FALSE;
}
+/*
+ * Pad to accelerator requirement
+ */
+static inline int i830_pad_drawable_width(int width)
+{
+ return (width + 63) & ~63;
+}
+
/**
* Allocates a framebuffer for a screen.
*