xf86-video-intel: src/drmmode_display.c src/i830.h src/i830_memory.c

Chris Wilson ickle at kemper.freedesktop.org
Tue Jun 15 12:31:17 PDT 2010


 src/drmmode_display.c |   17 ++++++++++-------
 src/i830.h            |    9 ---------
 src/i830_memory.c     |    8 ++++++++
 3 files changed, 18 insertions(+), 16 deletions(-)

New commits:
commit a25573d5c47ebea34c076075e1993233d7db2b4f
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Tue Jun 15 20:26:19 2010 +0100

    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 at chris-wilson.co.uk>
    Reported-by: Till Matthiesen <entropy at everymail.net>

diff --git a/src/drmmode_display.c b/src/drmmode_display.c
index 6f7e5f1..ba24206 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 c98a842..02220ea 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 083ddf5..50e3163 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.
  *


More information about the xorg-commit mailing list