Rebased ref, commits from common ancestor:
commit 60c161545af80eb78eb790a05bde79409dfdf16e
Author: Keith Packard <kei...@keithp.com>
Date:   Wed Feb 25 12:05:44 2009 -0800

    X server version 1.6.0
    
    Signed-off-by: Keith Packard <kei...@keithp.com>

diff --git a/configure.ac b/configure.ac
index b4d18dd..f2718b8 100644
--- a/configure.ac
+++ b/configure.ac
@@ -26,12 +26,12 @@ dnl
 dnl Process this file with autoconf to create configure.
 
 AC_PREREQ(2.57)
-AC_INIT([xorg-server], 1.5.99.903, 
[https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], xorg-server)
+AC_INIT([xorg-server], 1.6.0, 
[https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], xorg-server)
 AC_CONFIG_SRCDIR([Makefile.am])
 AM_INIT_AUTOMAKE([dist-bzip2 foreign])
 AM_MAINTAINER_MODE
 
-RELEASE_DATE="2009-2-17"
+RELEASE_DATE="2009-2-25"
 
 dnl this gets generated by autoheader, and thus contains all the defines.  we
 dnl don't ever actually use it, internally.

commit e9a9f807971b8fb62b957c9d54b4aea7fb0f96ca
Author: Maarten Maathuis <madman2...@gmail.com>
Date:   Fri Jan 30 19:32:33 2009 +0100

    exa: kill of exaImageGlyphBlt
    
    - It serves no obvious purpose, yet it directly accesses many fb
    symbols.
    (cherry picked from commit 5cc67ae94c066dcac78072ad8a819c3b602d8bab)

diff --git a/exa/exa_accel.c b/exa/exa_accel.c
index f72a08a..453431e 100644
--- a/exa/exa_accel.c
+++ b/exa/exa_accel.c
@@ -856,139 +856,6 @@ out:
     REGION_DESTROY(pScreen, pReg);
 }
 
-static void
-exaImageGlyphBlt (DrawablePtr  pDrawable,
-                 GCPtr         pGC,
-                 int           x,
-                 int           y,
-                 unsigned int  nglyph,
-                 CharInfoPtr   *ppciInit,
-                 pointer       pglyphBase)
-{
-    FbGCPrivPtr            pPriv = fbGetGCPrivate(pGC);
-    CharInfoPtr            *ppci;
-    CharInfoPtr            pci;
-    unsigned char   *pglyph;           /* pointer bits in glyph */
-    int                    gWidth, gHeight;    /* width and height of glyph */
-    FbStride       gStride;            /* stride of glyph */
-    Bool           opaque;
-    int                    gx, gy;
-    void           (*glyph) (FbBits *,
-                             FbStride,
-                             int,
-                             FbStip *,
-                             FbBits,
-                             int,
-                             int);
-    FbBits         *dst;
-    FbStride       dstStride;
-    int                    dstBpp;
-    int                    dstXoff, dstYoff;
-    FbBits         depthMask;
-    PixmapPtr      pPixmap = exaGetDrawablePixmap(pDrawable);
-    ExaPixmapPriv(pPixmap);
-    RegionPtr      pending_damage = NULL;
-    BoxRec         extents;
-    int                    xoff, yoff;
-
-    if (pExaPixmap->pDamage)
-       pending_damage = DamagePendingRegion(pExaPixmap->pDamage);
-
-    if (pending_damage) {
-       extents = *REGION_EXTENTS(pScreen, pending_damage);
-
-       if (extents.x1 >= extents.x2 || extents.y1 >= extents.y2)
-           return;
-
-       depthMask = FbFullMask(pDrawable->depth);
-    }
-
-    if (!pending_damage || (pGC->planemask & depthMask) != depthMask)
-    {
-       ExaCheckImageGlyphBlt(pDrawable, pGC, x, y, nglyph, ppciInit, 
pglyphBase);
-       return;
-    }
-
-    glyph = NULL;
-    switch (pDrawable->bitsPerPixel) {
-    case 8:    glyph = fbGlyph8; break;
-    case 16:    glyph = fbGlyph16; break;
-    case 24:    glyph = fbGlyph24; break;
-    case 32:    glyph = fbGlyph32; break;
-    }
-
-    x += pDrawable->x;
-    y += pDrawable->y;
-
-    exaGetDrawableDeltas(pDrawable, pPixmap, &xoff, &yoff);
-    extents.x1 -= xoff;
-    extents.x2 -= xoff;
-    extents.y1 -= yoff;
-    extents.y2 -= yoff;
-
-    exaPrepareAccessReg (pDrawable, EXA_PREPARE_DEST, pending_damage);
-
-    if (TERMINALFONT (pGC->font) && !glyph)
-    {
-       opaque = TRUE;
-    }
-    else
-    {
-       FbBits fg = fbReplicatePixel (pGC->bgPixel, pDrawable->bitsPerPixel);
-
-       fbSolidBoxClipped (pDrawable,
-                          fbGetCompositeClip(pGC),
-                          extents.x1,
-                          extents.y1,
-                          extents.x2,
-                          extents.y2,
-                          fbAnd (GXcopy, fg, pGC->planemask),
-                          fbXor (GXcopy, fg, pGC->planemask));
-
-       opaque = FALSE;
-    }
-
-    EXA_FALLBACK(("to %p (%c)\n", pDrawable, exaDrawableLocation(pDrawable)));
-
-    exaPrepareAccessGC (pGC);
-
-    fbGetDrawable (pDrawable, dst, dstStride, dstBpp, dstXoff, dstYoff);
-
-    for (ppci = ppciInit; nglyph; nglyph--, x += pci->metrics.characterWidth)
-    {
-       pci = *ppci++;
-       gWidth = GLYPHWIDTHPIXELS(pci);
-       gHeight = GLYPHHEIGHTPIXELS(pci);
-       gx = x + pci->metrics.leftSideBearing;
-       gy = y - pci->metrics.ascent;
-
-       if (!gWidth || !gHeight || (gx + gWidth) <= extents.x1 ||
-           (gy + gHeight) <= extents.y1 || gx >= extents.x2 ||
-           gy >= extents.y2)
-           continue;
-
-       pglyph = FONTGLYPHBITS(pglyphBase, pci);
-
-       if (glyph && gWidth <= sizeof (FbStip) * 8 &&
-           fbGlyphIn (fbGetCompositeClip(pGC), gx, gy, gWidth, gHeight))
-       {
-           (*glyph) (dst + (gy + dstYoff) * dstStride, dstStride, dstBpp,
-                     (FbStip *) pglyph, pPriv->fg, gx + dstXoff, gHeight);
-       }
-       else
-       {
-           RegionPtr pClip = fbGetCompositeClip(pGC);
-
-           gStride = GLYPHWIDTHBYTESPADDED(pci) / sizeof (FbStip);
-           fbPutXYImage (pDrawable, pClip, pPriv->fg, pPriv->bg, pPriv->pm,
-                         GXcopy, opaque, gx, gy, gWidth, gHeight,
-                         (FbStip *) pglyph, gStride, 0);
-       }
-    }
-    exaFinishAccessGC (pGC);
-    exaFinishAccess (pDrawable, EXA_PREPARE_DEST);
-}
-
 const GCOps exaOps = {
     exaFillSpans,
     ExaCheckSetSpans,
@@ -1007,7 +874,7 @@ const GCOps exaOps = {
     miPolyText16,
     miImageText8,
     miImageText16,
-    exaImageGlyphBlt,
+    ExaCheckImageGlyphBlt,
     ExaCheckPolyGlyphBlt,
     ExaCheckPushPixels,
 };

commit 10e0603fb989d1e6b2675ef5ca8223777b4921e6
Author: Jeremy Huddleston <jer...@yuffie.local>
Date:   Tue Feb 24 23:12:57 2009 -0800

    XQuartz: Re-enable support for capslock
    (cherry picked from commit 4901b8147e593d26d7a31a9b73a201254b948916)

diff --git a/hw/xquartz/darwinEvents.c b/hw/xquartz/darwinEvents.c
index 89d2233..374c4e0 100644
--- a/hw/xquartz/darwinEvents.c
+++ b/hw/xquartz/darwinEvents.c
@@ -155,6 +155,7 @@ int darwin_modifier_mask_list[] = {
 #else
     NX_CONTROLMASK, NX_SHIFTMASK, NX_COMMANDMASK, NX_ALTERNATEMASK,
 #endif
+    NX_ALPHASHIFTMASK,
     0
 };
 
@@ -174,7 +175,7 @@ static void DarwinUpdateModifiers(
     }
     
     for(f=darwin_modifier_mask_list; *f; f++)
-        if(*f & flags) {
+        if(*f & flags && *f != NX_ALPHASHIFTMASK) {
             key = DarwinModifierNXMaskToNXKey(*f);
             if(key == -1)
                 ErrorF("DarwinUpdateModifiers: Unsupported NXMask: 0x%x\n", 
*f);

commit e96921ca954ff0d3de8a69cea085aac2d43b0a2e
Author: Michel Dänzer <daen...@vmware.com>
Date:   Mon Feb 23 16:49:51 2009 +0100

    DRI1: Make DRICreateDrawable return TRUE for pixmaps.
    
    GLX_EXT_texture_from_pixmap was broken since commit
    a26c77ff432d2e85a2665fc36fca25143460c476 ('glx: fix retval checks when 
failures
    occur for drawable creation.')
    
    Signed-off-by: Michel Dänzer <daen...@vmware.com>
    (cherry picked from commit ef320bdd5ec3419abba77041d3a4d96a3ff87563)

diff --git a/hw/xfree86/dri/dri.c b/hw/xfree86/dri/dri.c
index 1a3e091..bddb651 100644
--- a/hw/xfree86/dri/dri.c
+++ b/hw/xfree86/dri/dri.c
@@ -1291,7 +1291,7 @@ DRICreateDrawable(ScreenPtr pScreen, ClientPtr client, 
DrawablePtr pDrawable,
            *hHWDrawable = pDRIDrawablePriv->hwDrawable;
        }
     }
-    else { /* pixmap (or for GLX 1.3, a PBuffer) */
+    else if (pDrawable->type != DRAWABLE_PIXMAP) { /* PBuffer */
        /* NOT_DONE */
        return FALSE;
     }

commit 584f46b81c6ed126014e963cb4ea40f83014f1c7
Author: Alan Coopersmith <alan.coopersm...@sun.com>
Date:   Thu Feb 19 13:57:28 2009 -0800

    Add Extensions section to xorg.conf man page
    
    Extensions section was added in X11R6.8.0 and documented in the release 
notes:
       http://www.x.org/archive/X11R6.8.0/doc/RELNOTES2.html#3
    but never made it into the man page.
    
    Also fix a bonus typo.
    
    Signed-off-by: Alan Coopersmith <alan.coopersm...@sun.com>
    (cherry picked from commit ab61033700b5383a7a15370dd054eaa80e72e811)

diff --git a/hw/xfree86/doc/man/xorg.conf.man.pre 
b/hw/xfree86/doc/man/xorg.conf.man.pre
index d9a4b35..b6288b6 100644
--- a/hw/xfree86/doc/man/xorg.conf.man.pre
+++ b/hw/xfree86/doc/man/xorg.conf.man.pre
@@ -115,6 +115,7 @@ The section names are:
 .BR "Files          " "File pathnames"
 .BR "ServerFlags    " "Server flags"
 .BR "Module         " "Dynamic module loading"
+.BR "Extensions     " "Extension enabling"
 .BR "InputDevice    " "Input device description"
 .BR "Device         " "Graphics device description"
 .BR "VideoAdaptor   " "Xv video adaptor description"
@@ -313,7 +314,7 @@ where
 .I <identifier>
 is an alphanumeric identifier,
 .I [attribute]
-is an attribute wich will be passed to the underlying FPE and
+is an attribute which will be passed to the underlying FPE and
 .I <priority>
 is a number used to order the fontfile FPEs. Examples:
 .PP
@@ -774,6 +775,32 @@ It is recommended
 that at very least the \(lqextmod\(rq extension module be loaded.
 If it isn't, some commonly used server extensions (like the SHAPE
 extension) will not be available.
+.SH "EXTENSIONS SECTION"
+The
+.B Extensions
+section is used to specify which X11 protocol extensions should be enabled
+or disabled.
+The
+.B Extensions
+section is optional, as are all of the entries that may be specified in
+it.
+.PP
+Entries in this section are listed as Option statements with the name of
+the extension as the first argument, and a boolean value as the second.
+The extension name is case\-sensitive, and matches the form shown in the output
+of \*qXorg -extension ?\*q.
+.PP
+.RS 7
+Example: the MIT-SHM extension can be disabled with the following entry:
+.PP
+.RS 4
+.nf
+.B "Section \*qExtensions\*q"
+.B "    Option \*qMIT-SHM\*q \*qDisable\*q"
+.B "EndSection"
+.fi
+.RE
+.RE
 .SH "INPUTDEVICE SECTION"
 The config file may have multiple
 .B InputDevice

commit ae7991b16d7fefb4335b05f951a3228cef102683
Author: Keith Packard <kei...@keithp.com>
Date:   Wed Feb 25 10:14:36 2009 -0800

    Pre-clip panning coordinates to keep crtc within panning region
    
    There is a separate panning region check, but that doesn't work under
    transformation, so just pre-clip the mouse coordinates when computing the
    panning offsets. This leaves the case where panning constants are changing
    unresolved.
    
    Signed-off-by: Keith Packard <kei...@keithp.com>
    (cherry pick from commit c090f5514d28e1602a6ebbe7c909e98a0e3374d7)

diff --git a/hw/xfree86/modes/xf86RandR12.c b/hw/xfree86/modes/xf86RandR12.c
index 2d8c2a9..6f93a0d 100644
--- a/hw/xfree86/modes/xf86RandR12.c
+++ b/hw/xfree86/modes/xf86RandR12.c
@@ -172,12 +172,166 @@ xf86RandR13VerifyPanningArea (xf86CrtcPtr crtc, int 
screenWidth, int screenHeigh
     return ret;
 }
 
+/*
+ * The heart of the panning operation:
+ *
+ * Given a frame buffer position (fb_x, fb_y),
+ * and a crtc position (crtc_x, crtc_y),
+ * and a transform matrix which maps frame buffer to crtc,
+ * compute a panning position (pan_x, pan_y) that
+ * makes the resulting transform line those two up
+ */
+
+static void
+xf86ComputeCrtcPan (Bool transform_in_use,
+                   struct pixman_f_transform *m,
+                   double screen_x, double screen_y,
+                   double crtc_x, double crtc_y,
+                   int old_pan_x, int old_pan_y,
+                   int *new_pan_x, int *new_pan_y)
+{
+    if (transform_in_use) {
+       /*
+        * Given the current transform, M, the current position
+        * on the Screen, S, and the desired position on the CRTC,
+        * C, compute a translation, T, such that:
+        *
+        * M T S = C
+        *
+        * where T is of the form
+        *
+        * | 1 0 dx |
+        * | 0 1 dy |
+        * | 0 0 1  |
+        *
+        * M T S =
+        *   | M00 Sx + M01 Sy + M00 dx + M01 dy + M02 |   | Cx F |
+        *   | M10 Sx + M11 Sy + M10 dx + M11 dy + M12 | = | Cy F |
+        *   | M20 Sx + M21 Sy + M20 dx + M21 dy + M22 |   |  F   |
+        *
+        * R = M S
+        *
+        *   Cx F = M00 dx + M01 dy + R0
+        *   Cy F = M10 dx + M11 dy + R1
+        *      F = M20 dx + M21 dy + R2
+        *
+        * Zero out dx, then dy
+        *
+        * F (Cx M10 - Cy M00) =
+        *          (M10 M01 - M00 M11) dy + M10 R0 - M00 R1
+        * F (M10 - Cy M20) =
+        *          (M10 M21 - M20 M11) dy + M10 R2 - M20 R1
+        *
+        * F (Cx M11 - Cy M01) =
+        *          (M11 M00 - M01 M10) dx + M11 R0 - M01 R1
+        * F (M11 - Cy M21) =
+        *          (M11 M20 - M21 M10) dx + M11 R2 - M21 R1
+        *
+        * Make some temporaries
+        *
+        * T = | Cx M10 - Cy M00 |
+        *     | Cx M11 - Cy M01 |
+        *
+        * U = | M10 M01 - M00 M11 |
+        *     | M11 M00 - M01 M10 |
+        *
+        * Q = | M10 R0 - M00 R1 |
+        *     | M11 R0 - M01 R1 |
+        *
+        * P = | M10 - Cy M20 |
+        *     | M11 - Cy M21 |
+        *
+        * W = | M10 M21 - M20 M11 |
+        *     | M11 M20 - M21 M10 |
+        *
+        * V = | M10 R2 - M20 R1 |
+        *         | M11 R2 - M21 R1 |
+        *
+        * Rewrite:
+        *
+        * F T0 = U0 dy + Q0
+        * F P0 = W0 dy + V0
+        * F T1 = U1 dx + Q1
+        * F P1 = W1 dx + V1
+        *
+        * Solve for F (two ways)
+        *
+        * F (W0 T0 - U0 P0)  = W0 Q0 - U0 V0
+        *
+        *     W0 Q0 - U0 V0
+        * F = -------------
+        *     W0 T0 - U0 P0
+        *
+        * F (W1 T1 - U1 P1) = W1 Q1 - U1 V1
+        *
+        *     W1 Q1 - U1 V1
+        * F = -------------
+        *     W1 T1 - U1 P1
+        *
+        * We'll use which ever solution works (denominator != 0)
+        *
+        * Finally, solve for dx and dy:
+        *
+        * dx = (F T1 - Q1) / U1
+        * dx = (F P1 - V1) / W1
+        *
+        * dy = (F T0 - Q0) / U0
+        * dy = (F P0 - V0) / W0
+        */
+       double                      r[3];
+       double                      q[2], u[2], t[2], v[2], w[2], p[2];
+       double                      f;
+       struct pict_f_vector        d;
+       int                         i;
+
+       /* Get the un-normalized crtc coordinates again */
+       for (i = 0; i < 3; i++)
+           r[i] = m->m[i][0] * screen_x + m->m[i][1] * screen_y + m->m[i][2];
+
+       /* Combine values into temporaries */
+       for (i = 0; i < 2; i++) {
+           q[i] = m->m[1][i] * r[0] - m->m[0][i] * r[1];
+           u[i] = m->m[1][i] * m->m[0][1-i] - m->m[0][i] * m->m[1][1-i];
+           t[i] = m->m[1][i] * crtc_x - m->m[0][i] * crtc_y;
+
+           v[i] = m->m[1][i] * r[2] - m->m[2][i] * r[1];
+           w[i] = m->m[1][i] * m->m[2][1-i] - m->m[2][i] * m->m[1][1-i];
+           p[i] = m->m[1][i] - m->m[2][i] * crtc_y;
+       }
+
+       /* Find a way to compute f */
+       f = 0;
+       for (i = 0; i < 2; i++) {
+           double a = w[i] * q[i] - u[i] * v[i];
+           double b = w[i] * t[i] - u[i] * p[i];
+           if (b != 0) {
+               f = a/b;
+               break;
+           }
+       }
+
+       /* Solve for the resulting transform vector */
+       for (i = 0; i < 2; i++) {
+           if (u[i])
+               d.v[1-i] = (t[i] * f - q[i]) / u[i];
+           else if (w[1])
+               d.v[1-i] = (p[i] * f - v[i]) / w[i];
+           else
+               d.v[1-i] = 0;
+       }
+       *new_pan_x = old_pan_x - floor (d.v[0] + 0.5);
+       *new_pan_y = old_pan_y - floor (d.v[1] + 0.5);
+    } else {
+       *new_pan_x = screen_x - crtc_x;
+       *new_pan_y = screen_y - crtc_y;
+    }
+}
+
 static void
 xf86RandR13Pan (xf86CrtcPtr crtc, int x, int y)
 {
     int newX, newY;
     int width, height;
-    struct pict_f_vector    c;
     Bool panned = FALSE;
 
     if (crtc->version < 2)
@@ -193,20 +347,43 @@ xf86RandR13Pan (xf86CrtcPtr crtc, int x, int y)
     width  = crtc->mode.HDisplay;
     height = crtc->mode.VDisplay;
 
-    c.v[0] = x;
-    c.v[1] = y;
-    c.v[2] = 1.0;
-    if (crtc->transform_in_use) {
-       pixman_f_transform_point(&crtc->f_framebuffer_to_crtc, &c);
-    } else {
-       c.v[0] -= crtc->x;
-       c.v[1] -= crtc->y;
-    }
-
     if ((crtc->panningTrackingArea.x2 <= crtc->panningTrackingArea.x1 ||
         (x >= crtc->panningTrackingArea.x1 && x < 
crtc->panningTrackingArea.x2)) &&
        (crtc->panningTrackingArea.y2 <= crtc->panningTrackingArea.y1 ||
-        (y >= crtc->panningTrackingArea.y1 && y < 
crtc->panningTrackingArea.y2))) {
+        (y >= crtc->panningTrackingArea.y1 && y < 
crtc->panningTrackingArea.y2)))
+    {
+       struct pict_f_vector    c;
+
+       /*
+        * Pre-clip the mouse position to the panning area so that we don't
+        * push the crtc outside. This doesn't deal with changes to the
+        * panning values, only mouse position changes.
+        */
+       if (crtc->panningTotalArea.x2 > crtc->panningTotalArea.x1)
+       {
+           if (x < crtc->panningTotalArea.x1)
+               x = crtc->panningTotalArea.x1;
+           if (x >= crtc->panningTotalArea.x2)
+               x = crtc->panningTotalArea.x2 - 1;
+       }
+       if (crtc->panningTotalArea.y2 > crtc->panningTotalArea.y1)
+       {
+           if (y < crtc->panningTotalArea.y1)
+               y = crtc->panningTotalArea.y1;
+           if (y >= crtc->panningTotalArea.y2)
+               y = crtc->panningTotalArea.y2 - 1;
+       }
+
+       c.v[0] = x;
+       c.v[1] = y;
+       c.v[2] = 1.0;
+       if (crtc->transform_in_use) {
+           pixman_f_transform_point(&crtc->f_framebuffer_to_crtc, &c);
+       } else {
+           c.v[0] -= crtc->x;
+           c.v[1] -= crtc->y;
+       }
+
        if (crtc->panningTotalArea.x2 > crtc->panningTotalArea.x1) {
            if (c.v[0] < crtc->panningBorder[0]) {
                c.v[0] = crtc->panningBorder[0];
@@ -227,165 +404,35 @@ xf86RandR13Pan (xf86CrtcPtr crtc, int x, int y)
                panned = TRUE;
            }
        }
+       if (panned)
+           xf86ComputeCrtcPan (crtc->transform_in_use,
+                               &crtc->f_framebuffer_to_crtc,
+                               x, y, c.v[0], c.v[1],
+                               newX, newY, &newX, &newY);
     }
-    if (panned) {
-       if (crtc->transform_in_use) {
-           /*
-            * Under a transformation, we want to find a new crtc offset
-            * which places the cursor in the desired position. That is,
-            *
-            * Given the current transform, M, the current cursor position
-            * on the Screen, S, and the desired cursor position on the CRTC,
-            * C, compute a translation, T, such that:
-            *
-            * M T S = C
-            *
-            * where T is of the form
-            *
-            * | 1 0 dx |
-            * | 0 1 dy |
-            * | 0 0 1  |
-            *
-            * M T S =
-            *   | M00 Sx + M01 Sy + M00 dx + M01 dy + M02 |   | Cx F |
-            *   | M10 Sx + M11 Sy + M10 dx + M11 dy + M12 | = | Cy F |
-            *   | M20 Sx + M21 Sy + M20 dx + M21 dy + M22 |   |  F   |
-            *
-            * R = M S
-            *
-            *   Cx F = M00 dx + M01 dy + R0
-            *   Cy F = M10 dx + M11 dy + R1
-            *      F = M20 dx + M21 dy + R2
-            *
-            * Zero out dx, then dy
-            *
-            * F (Cx M10 - Cy M00) =
-            *      (M10 M01 - M00 M11) dy + M10 R0 - M00 R1
-            * F (M10 - Cy M20) =
-            *      (M10 M21 - M20 M11) dy + M10 R2 - M20 R1
-            *
-            * F (Cx M11 - Cy M01) =
-            *      (M11 M00 - M01 M10) dx + M11 R0 - M01 R1
-            * F (M11 - Cy M21) =
-            *      (M11 M20 - M21 M10) dx + M11 R2 - M21 R1
-            *
-            * Make some temporaries
-            *
-            * T = | Cx M10 - Cy M00 |
-            *     | Cx M11 - Cy M01 |
-            *
-            * U = | M10 M01 - M00 M11 |
-            *     | M11 M00 - M01 M10 |
-            *
-            * Q = | M10 R0 - M00 R1 |
-            *     | M11 R0 - M01 R1 |
-            *
-            * P = | M10 - Cy M20 |
-            *     | M11 - Cy M21 |
-            *
-            * W = | M10 M21 - M20 M11 |
-            *     | M11 M20 - M21 M10 |
-            *
-            * V = | M10 R2 - M20 R1 |
-            *     | M11 R2 - M21 R1 |
-            *
-            * Rewrite:
-            *
-            * F T0 = U0 dy + Q0
-            * F P0 = W0 dy + V0
-            * F T1 = U1 dx + Q1
-            * F P1 = W1 dx + V1
-            *
-            * Solve for F (two ways)
-            *
-            * F (W0 T0 - U0 P0)  = W0 Q0 - U0 V0
-            *
-            *     W0 Q0 - U0 V0
-            * F = -------------
-            *     W0 T0 - U0 P0
-            *
-            * F (W1 T1 - U1 P1) = W1 Q1 - U1 V1
-            *
-            *     W1 Q1 - U1 V1
-            * F = -------------
-            *     W1 T1 - U1 P1
-            *
-            * We'll use which ever solution works (denominator != 0)
-            *
-            * Finally, solve for dx and dy:
-            *
-            * dx = (F T1 - Q1) / U1
-            * dx = (F P1 - V1) / W1
-            *
-            * dy = (F T0 - Q0) / U0
-            * dy = (F P0 - V0) / W0
-            */
-           double      r[3];
-           double      q[2], u[2], t[2], v[2], w[2], p[2];
-           double      f;
-           struct pict_f_vector    d;
-           int i;
-           struct pixman_f_transform   *m = &crtc->f_framebuffer_to_crtc;
-
-           /* Get the un-normalized crtc coordinates again */
-           for (i = 0; i < 3; i++)
-               r[i] = m->m[i][0] * x + m->m[i][1] * y + m->m[i][2];
-
-           /* Combine values into temporaries */
-           for (i = 0; i < 2; i++) {
-               q[i] = m->m[1][i] * r[0] - m->m[0][i] * r[1];
-               u[i] = m->m[1][i] * m->m[0][1-i] - m->m[0][i] * m->m[1][1-i];
-               t[i] = m->m[1][i] * c.v[0] - m->m[0][i] * c.v[1];
-
-               v[i] = m->m[1][i] * r[2] - m->m[2][i] * r[1];
-               w[i] = m->m[1][i] * m->m[2][1-i] - m->m[2][i] * m->m[1][1-i];
-               p[i] = m->m[1][i] - m->m[2][i] * c.v[1];
-           }
-
-           /* Find a way to compute f */
-           f = 0;
-           for (i = 0; i < 2; i++) {
-               double a = w[i] * q[i] - u[i] * v[i];
-               double b = w[i] * t[i] - u[i] * p[i];
-               if (b != 0) {
-                   f = a/b;
-                   break;
-               }
-           }
 
-           /* Solve for the resulting transform vector */
-           for (i = 0; i < 2; i++) {
-               if (u[i])
-                   d.v[1-i] = (t[i] * f - q[i]) / u[i];
-               else if (w[1])
-                   d.v[1-i] = (p[i] * f - v[i]) / w[i];
-               else
-                   d.v[1-i] = 0;
-           }
-           d.v[2] = 1;
-           newX -= floor (d.v[0] + 0.5);
-           newY -= floor (d.v[1] + 0.5);
-       } else {
-           newX = x - c.v[0];
-           newY = y - c.v[1];
+    /*
+     * Ensure that the crtc is within the panning region.
+     *
+     * XXX This computation only works when we do not have a transform
+     * in use.
+     */
+    if (!crtc->transform_in_use)
+    {
+       /* Validate against [xy]1 after [xy]2, to be sure that results are > 0 
for [xy]1 > 0 */
+       if (crtc->panningTotalArea.x2 > crtc->panningTotalArea.x1) {
+           if (newX > crtc->panningTotalArea.x2 - width)
+               newX =  crtc->panningTotalArea.x2 - width;
+           if (newX <  crtc->panningTotalArea.x1)
+               newX =  crtc->panningTotalArea.x1;
+       }
+       if (crtc->panningTotalArea.y2 > crtc->panningTotalArea.y1) {
+           if (newY > crtc->panningTotalArea.y2 - height)
+               newY =  crtc->panningTotalArea.y2 - height;
+           if (newY <  crtc->panningTotalArea.y1)
+               newY =  crtc->panningTotalArea.y1;
        }
     }
-
-#if 0
-    /* Validate against [xy]1 after [xy]2, to be sure that results are > 0 for 
[xy]1 > 0 */
-    if (crtc->panningTotalArea.x2 > crtc->panningTotalArea.x1) {
-       if (newX > crtc->panningTotalArea.x2 - width)
-           newX =  crtc->panningTotalArea.x2 - width;
-       if (newX <  crtc->panningTotalArea.x1)
-           newX =  crtc->panningTotalArea.x1;
-    }
-    if (crtc->panningTotalArea.y2 > crtc->panningTotalArea.y1) {
-       if (newY > crtc->panningTotalArea.y2 - height)
-           newY =  crtc->panningTotalArea.y2 - height;
-       if (newY <  crtc->panningTotalArea.y1)
-           newY =  crtc->panningTotalArea.y1;
-    }
-#endif
     if (newX != crtc->x || newY != crtc->y)
        xf86CrtcSetOrigin (crtc, newX, newY);
 }

commit e59aa804df8a39541aa3224a5e688b819196070c
Author: Keith Packard <kei...@keithp.com>
Date:   Wed Feb 25 10:12:23 2009 -0800

    RandR rotations and reflections offset by one pixel
    
    The matrix computation for rotation and reflection resulted in dropping a
    row or column of pixels as the offsets used in the matrix computations used
    width and height rather than width-1 and height-1.
    
    Signed-off-by: Keith Packard <kei...@keithp.com>
    (cherry picked from commit 77c7a64e8885696665556c9fbcb3cffb552e367a)

diff --git a/randr/rrtransform.c b/randr/rrtransform.c
index 49be2e0..8bdff5a 100644
--- a/randr/rrtransform.c
+++ b/randr/rrtransform.c
@@ -185,21 +185,21 @@ RRTransformCompute (int                       x,
            break;
        case RR_Rotate_90:
            f_rot_cos = 0;          f_rot_sin = 1;
-           f_rot_dx  = height;     f_rot_dy  = 0;
+           f_rot_dx  = height-1;   f_rot_dy  = 0;
            rot_cos = F ( 0);       rot_sin = F ( 1);
-           rot_dx =  F ( height);  rot_dy  = F (0);
+           rot_dx =  F (height-1); rot_dy  = F (0);
            break;
        case RR_Rotate_180:
            f_rot_cos = -1;         f_rot_sin = 0;
-           f_rot_dx  = width;      f_rot_dy  = height;
+           f_rot_dx  = width - 1;  f_rot_dy  = height - 1;
            rot_cos = F (-1);       rot_sin = F ( 0);
-           rot_dx  = F (width);   rot_dy  = F ( height);
+           rot_dx  = F (width-1);  rot_dy  = F ( height-1);
            break;
        case RR_Rotate_270:
            f_rot_cos = 0;          f_rot_sin = -1;
-           f_rot_dx  = 0;          f_rot_dy  = width;
+           f_rot_dx  = 0;          f_rot_dy  = width-1;
            rot_cos = F ( 0);       rot_sin = F (-1);
-           rot_dx  = F ( 0);       rot_dy  = F ( width);
+           rot_dx  = F ( 0);       rot_dy  = F ( width-1);
            break;
        }
        
@@ -222,11 +222,11 @@ RRTransformCompute (int                       x,
            f_scale_x = -1;
            scale_x = F(-1);
            if (rotation & (RR_Rotate_0|RR_Rotate_180)) {
-               f_scale_dx = width;
-               scale_dx = F(width);
+               f_scale_dx = width-1;
+               scale_dx = F(width-1);
            } else {
-               f_scale_dx = height;
-               scale_dx = F(height);
+               f_scale_dx = height-1;
+               scale_dx = F(height-1);
            }
        }
        if (rotation & RR_Reflect_Y)
@@ -234,11 +234,11 @@ RRTransformCompute (int                       x,
            f_scale_y = -1;
            scale_y = F(-1);
            if (rotation & (RR_Rotate_0|RR_Rotate_180)) {
-               f_scale_dy = height;
-               scale_dy = F(height);
+               f_scale_dy = height-1;
+               scale_dy = F(height-1);
            } else {
-               f_scale_dy = width;
-               scale_dy = F(width);
+               f_scale_dy = width-1;
+               scale_dy = F(width-1);
            }
        }
        

commit 9a59e7f304ab19c91738311bb9f1ec7709fc8847
Author: Keith Packard <kei...@keithp.com>
Date:   Sun Feb 8 15:08:15 2009 +0100

    xf86CrtcShadowClear is unused.
    
    Remove this now that clearing is done by repainting with appropriate extend
    modes.
    Signed-off-by: Keith Packard <kei...@keithp.com>
    (cherry picked from commit 60a4f1368785d26a49a3ef6df829723ca154c154)
    
    Signed-off-by: Keith Packard <kei...@keithp.com>

diff --git a/hw/xfree86/modes/xf86Rotate.c b/hw/xfree86/modes/xf86Rotate.c
index 9f57394..6be77d5 100644
--- a/hw/xfree86/modes/xf86Rotate.c
+++ b/hw/xfree86/modes/xf86Rotate.c
@@ -146,37 +146,6 @@ xf86RotateCrtcRedisplay (xf86CrtcPtr crtc, RegionPtr 
region)
 }
 
 static void
-xf86CrtcShadowClear (xf86CrtcPtr crtc)
-{
-    PixmapPtr          dst_pixmap = crtc->rotatedPixmap;
-    ScrnInfoPtr                scrn = crtc->scrn;
-    ScreenPtr          screen = scrn->pScreen;
-    PicturePtr         dst;
-    PictFormatPtr      format = compWindowFormat (WindowTable[screen->myNum]);
-    static xRenderColor black = { 0, 0, 0, 0 };
-    xRectangle         rect;
-    int                        error;
-
-    if (!dst_pixmap)
-       return;
-    dst = CreatePicture (None,
-                        &dst_pixmap->drawable,
-                        format,
-                        0L,
-                        NULL,
-                        serverClient,
-                        &error);
-    if (!dst)
-       return;
-    rect.x = 0;
-    rect.y = 0;
-    rect.width = dst_pixmap->drawable.width;
-    rect.height = dst_pixmap->drawable.height;
-    CompositeRects (PictOpSrc, dst, &black, 1, &rect);
-    FreePicture (dst, None);
-}
-
-static void
 xf86CrtcDamageShadow (xf86CrtcPtr crtc)
 {
     ScrnInfoPtr        pScrn = crtc->scrn;

commit 369d7b22a9009e7054bd121484fa128c7a6d21f6
Author: Keith Packard <kei...@keithp.com>
Date:   Thu Feb 5 11:36:54 2009 -0800

    Make panning+transform be correctly driven by mouse
    
    Figuring out how to adjust the crtc origin to keep the mouse pointer within
    the crtc is a bit of a trick
    
    Signed-off-by: Keith Packard <kei...@keithp.com>
    (cherry picked from commit 63810aca31b962c93be4796883bde6ccb653e3a9)
    
    Signed-off-by: Keith Packard <kei...@keithp.com>

diff --git a/hw/xfree86/modes/xf86RandR12.c b/hw/xfree86/modes/xf86RandR12.c
index d8693dd..2d8c2a9 100644
--- a/hw/xfree86/modes/xf86RandR12.c
+++ b/hw/xfree86/modes/xf86RandR12.c
@@ -177,6 +177,8 @@ xf86RandR13Pan (xf86CrtcPtr crtc, int x, int y)
 {
     int newX, newY;
     int width, height;
+    struct pict_f_vector    c;
+    Bool panned = FALSE;
 
     if (crtc->version < 2)
        return;
@@ -191,23 +193,185 @@ xf86RandR13Pan (xf86CrtcPtr crtc, int x, int y)
     width  = crtc->mode.HDisplay;
     height = crtc->mode.VDisplay;
 
+    c.v[0] = x;
+    c.v[1] = y;
+    c.v[2] = 1.0;
+    if (crtc->transform_in_use) {
+       pixman_f_transform_point(&crtc->f_framebuffer_to_crtc, &c);
+    } else {
+       c.v[0] -= crtc->x;
+       c.v[1] -= crtc->y;
+    }
+
     if ((crtc->panningTrackingArea.x2 <= crtc->panningTrackingArea.x1 ||
         (x >= crtc->panningTrackingArea.x1 && x < 
crtc->panningTrackingArea.x2)) &&
        (crtc->panningTrackingArea.y2 <= crtc->panningTrackingArea.y1 ||
         (y >= crtc->panningTrackingArea.y1 && y < 
crtc->panningTrackingArea.y2))) {
        if (crtc->panningTotalArea.x2 > crtc->panningTotalArea.x1) {
-           if (x < crtc->x + crtc->panningBorder[0])
-               newX = x - crtc->panningBorder[0];
-           if (x >= crtc->x + width - crtc->panningBorder[2])
-               newX = x - width + crtc->panningBorder[2] + 1;
+           if (c.v[0] < crtc->panningBorder[0]) {
+               c.v[0] = crtc->panningBorder[0];
+               panned = TRUE;
+           }
+           if (c.v[0] >= width - crtc->panningBorder[2]) {
+               c.v[0] = width - crtc->panningBorder[2] - 1;
+               panned = TRUE;
+           }
        }
        if (crtc->panningTotalArea.y2 > crtc->panningTotalArea.y1) {
-           if (y < crtc->y + crtc->panningBorder[1])
-               newY = y - crtc->panningBorder[1];
-           if (y >= crtc->y + height - crtc->panningBorder[3])
-               newY = y - height + crtc->panningBorder[3] + 1;
+           if (c.v[1] < crtc->panningBorder[1]) {
+               c.v[1] = crtc->panningBorder[1];
+               panned = TRUE;
+           }
+           if (c.v[1] >= height - crtc->panningBorder[3]) {
+               c.v[1] = height - crtc->panningBorder[3] - 1;
+               panned = TRUE;
+           }
        }
     }
+    if (panned) {
+       if (crtc->transform_in_use) {
+           /*
+            * Under a transformation, we want to find a new crtc offset
+            * which places the cursor in the desired position. That is,
+            *
+            * Given the current transform, M, the current cursor position
+            * on the Screen, S, and the desired cursor position on the CRTC,
+            * C, compute a translation, T, such that:
+            *
+            * M T S = C
+            *
+            * where T is of the form
+            *
+            * | 1 0 dx |
+            * | 0 1 dy |
+            * | 0 0 1  |
+            *
+            * M T S =
+            *   | M00 Sx + M01 Sy + M00 dx + M01 dy + M02 |   | Cx F |
+            *   | M10 Sx + M11 Sy + M10 dx + M11 dy + M12 | = | Cy F |
+            *   | M20 Sx + M21 Sy + M20 dx + M21 dy + M22 |   |  F   |
+            *
+            * R = M S
+            *
+            *   Cx F = M00 dx + M01 dy + R0
+            *   Cy F = M10 dx + M11 dy + R1
+            *      F = M20 dx + M21 dy + R2
+            *
+            * Zero out dx, then dy
+            *
+            * F (Cx M10 - Cy M00) =
+            *      (M10 M01 - M00 M11) dy + M10 R0 - M00 R1
+            * F (M10 - Cy M20) =
+            *      (M10 M21 - M20 M11) dy + M10 R2 - M20 R1
+            *
+            * F (Cx M11 - Cy M01) =
+            *      (M11 M00 - M01 M10) dx + M11 R0 - M01 R1
+            * F (M11 - Cy M21) =
+            *      (M11 M20 - M21 M10) dx + M11 R2 - M21 R1


-- 
To UNSUBSCRIBE, email to debian-x-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to