There seems to be a damage issue with roatated screens and at least
rectangle composition still, but this makes rotation possible at all.
(this is a bug only we have because we still have the UMS code).

it's a git diff, but should apply clean from
/usr/xenocara/driver/xf86-video-intel

Cheers,

-0-

commit b1dfe9af0ea35f1a1e7cd21aaccc034f280b474f
Author: Owain G. Ainsworth <[email protected]>
Date:   Thu Dec 8 19:08:44 2011 +0000

    fix rotation.
    
    We can now allocate rotated framebuffers with tiling.
    
    1) i830_display_tiled needs to check tiling on rotated buffers too.
    2) PipeSetBase needs to not only set offset to 0 for rotated shadow 
buffers, but
    x/y in DSPTILEOFF too.

diff --git src/i830_display.c src/i830_display.c
index f833577..84bfb52 100644
--- src/i830_display.c
+++ src/i830_display.c
@@ -941,30 +941,35 @@ i830PipeSetBase(xf86CrtcPtr crtc, int x, int y)
     I830CrtcPrivatePtr intel_crtc = crtc->driver_private;
     int plane = intel_crtc->plane;
     unsigned long Start, Offset, Stride;
+    drm_intel_bo *bo;
     int dspbase = (plane == 0 ? DSPABASE : DSPBBASE);
     int dspsurf = (plane == 0 ? DSPASURF : DSPBSURF);
     int dsptileoff = (plane == 0 ? DSPATILEOFF : DSPBTILEOFF);
     int dspstride = (plane == 0) ? DSPASTRIDE : DSPBSTRIDE;
 
-    Offset = y * intel->front_pitch + x * intel->cpp;
+    crtc->x = x;
+    crtc->y = y;
+
     Stride = intel->front_pitch;
-    if (intel->front_buffer == NULL) {
-       /* During startup we may be called as part of monitor detection while
-        * there is no memory allocation done, so just supply a dummy base
-        * address.
-        */
-       Start = 0;
-    } else if (crtc->rotatedData != NULL) {
-       /* offset is done by shadow painting code, not here */
-       Start = (char *)crtc->rotatedData - (char *)intel->FbBase;
-       Offset = 0;
+    bo = intel->front_buffer;
+    Offset = y * Stride + x * intel->cpp;
+    if (intel_crtc->rotate_bo != NULL) {
        Stride = intel_crtc->rotate_pitch;
-    } else {
-       Start = intel->front_buffer->offset;
+       bo = intel_crtc->rotate_bo;
+       Offset = 0;
+       x = y = 0;
     }
 
-    crtc->x = x;
-    crtc->y = y;
+    /*
+     * During startup we may be called as part of monitor detection while
+     * there is no memory allocation done, so just supply a dummy base
+     * address.
+     */
+    if (bo == NULL) {
+       Start = 0;
+    } else {
+       Start = bo->offset;
+    }
 
     OUTREG(dspstride, Stride);
     if (IS_I965G(intel)) {
@@ -1057,16 +1062,17 @@ static Bool
 i830_display_tiled(xf86CrtcPtr crtc)
 {
     ScrnInfoPtr scrn = crtc->scrn;
+    I830CrtcPrivatePtr intel_crtc = crtc->driver_private;
     intel_screen_private *intel = intel_get_screen_private(scrn);
+    drm_intel_bo *bo = intel->front_buffer;
 
-    /* Rotated data is currently linear, allocated either via XAA or EXA */
-    if (crtc->rotatedData)
-       return FALSE;
+    if (intel_crtc->rotate_bo != NULL)
+       bo = intel_crtc->rotate_bo;
 
-    if (intel->front_buffer) {
+    if (bo != NULL) {
         uint32_t tiling_mode, swizzle;
-       if (drm_intel_bo_get_tiling(intel->front_buffer,
-           &tiling_mode, &swizzle) == 0 && tiling_mode != I915_TILING_NONE)
+       if (drm_intel_bo_get_tiling(bo, &tiling_mode, &swizzle) == 0 &&
+           tiling_mode != I915_TILING_NONE)
                return TRUE;
     }
 
@@ -2589,7 +2595,7 @@ i830_crtc_shadow_allocate (xf86CrtcPtr crtc, int width, 
int height)
     }
 
     intel_crtc->rotate_pitch = rotate_pitch;
-    return intel->FbBase + intel_crtc->rotate_bo->offset;
+    return intel_crtc->rotate_bo;
 }
     
 /**
@@ -2603,12 +2609,19 @@ i830_crtc_shadow_create(xf86CrtcPtr crtc, void *data, 
int width, int height)
     I830CrtcPrivatePtr intel_crtc = crtc->driver_private;
     PixmapPtr rotate_pixmap;
 
-    if (!data)
+    if (!data) {
        data = i830_crtc_shadow_allocate (crtc, width, height);
+       if (!data) {
+           xf86DrvMsg(scrn->scrnIndex, X_ERROR,
+               "Couldn't allocate shadow pixmap for rotated CRTC\n");
+               return NULL;
+       }
+    }
 
     if (intel_crtc->rotate_bo == NULL) {
        xf86DrvMsg(scrn->scrnIndex, X_ERROR,
                   "Couldn't allocate shadow pixmap for rotated CRTC\n");
+       return NULL;
     }
     
     rotate_pixmap = GetScratchPixmapHeader(scrn->pScreen,
@@ -2616,11 +2629,12 @@ i830_crtc_shadow_create(xf86CrtcPtr crtc, void *data, 
int width, int height)
                                           scrn->depth,
                                           scrn->bitsPerPixel,
                                           intel_crtc->rotate_pitch,
-                                          data);
+                                          NULL);
 
     if (rotate_pixmap == NULL) {
        xf86DrvMsg(scrn->scrnIndex, X_ERROR,
                   "Couldn't allocate shadow pixmap for rotated CRTC\n");
+        return NULL;
     }
     intel_set_pixmap_bo(rotate_pixmap, intel_crtc->rotate_bo);
 

-- 
Government [is] an illusion the governed should not encourage.
                -- John Updike, "Couples"

Reply via email to