xserver: Branch 'master' - 8 commits

Keith Packard keithp at kemper.freedesktop.org
Wed Jun 2 22:05:42 PDT 2010


 Xext/shape.c                       |    4 -
 Xi/xiproperty.c                    |    4 +
 composite/compalloc.c              |    1 
 dbe/midbe.c                        |   20 +++++--
 dix/devices.c                      |   75 ++++++++++++++++++++++++++++-
 dix/getevents.c                    |   19 +++++++
 hw/dmx/dmxwindow.c                 |    4 -
 hw/dmx/dmxwindow.h                 |    2 
 hw/xfree86/common/xf86AutoConfig.c |    2 
 hw/xfree86/common/xf86Config.c     |    1 
 hw/xfree86/common/xf86pciBus.c     |    8 ++-
 hw/xfree86/common/xf86pciBus.h     |    2 
 hw/xnest/Window.c                  |    4 -
 hw/xnest/XNWindow.h                |    2 
 hw/xwin/win.h                      |    4 -
 hw/xwin/winmultiwindowshape.c      |    6 +-
 hw/xwin/winwindow.c                |    6 +-
 include/inputstr.h                 |    4 +
 include/scrnintstr.h               |    3 -
 include/xserver-properties.h       |    7 ++
 mi/mi.h                            |    3 -
 mi/mioverlay.c                     |   81 ++++++++++++++++---------------
 mi/miwindow.c                      |   94 +++++++++++++++++++------------------
 test/input.c                       |    9 +++
 xfixes/region.c                    |    2 
 25 files changed, 251 insertions(+), 116 deletions(-)

New commits:
commit 643cb6e87c10ab554c03ada81930001a8ebcc909
Author: Pierre-Loup A. Griffais <pgriffais at nvidia.com>
Date:   Thu May 27 09:11:50 2010 -0700

    Only deal with input code when changing the input shape.
    
    Propagate the shape kind all the way to SetShape to avoid performing non-input
    operations such as revalidating the tree and generating exposures when only
    changing a window's input shape.
    
    Signed-off-by: Pierre-Loup A. Griffais <pgriffais at nvidia.com>
    Acked-by: Aaron Plattner<aplattner at nvidia.com>
    Reviewed-by: Daniel Stone<daniel at fooishbar.org>
    Signed-off-by: Keith Packard <keithp at keithp.com>

diff --git a/Xext/shape.c b/Xext/shape.c
index 93e4703..86b0bc0 100644
--- a/Xext/shape.c
+++ b/Xext/shape.c
@@ -220,7 +220,7 @@ RegionOperate (
     }
     if (srcRgn)
 	REGION_DESTROY(pScreen, srcRgn);
-    (*pScreen->SetShape) (pWin);
+    (*pScreen->SetShape) (pWin, kind);
     SendShapeNotify (pWin, kind);
     return Success;
 }
@@ -642,7 +642,7 @@ ProcShapeOffset (ClientPtr client)
     if (srcRgn)
     {
         REGION_TRANSLATE(pScreen, srcRgn, stuff->xOff, stuff->yOff);
-        (*pScreen->SetShape) (pWin);
+        (*pScreen->SetShape) (pWin, stuff->destKind);
     }
     SendShapeNotify (pWin, (int)stuff->destKind);
     return Success;
diff --git a/hw/dmx/dmxwindow.c b/hw/dmx/dmxwindow.c
index 39af510..5b0baff 100644
--- a/hw/dmx/dmxwindow.c
+++ b/hw/dmx/dmxwindow.c
@@ -991,7 +991,7 @@ static void dmxDoSetShape(WindowPtr pWindow)
 }
 
 /** Set shape of \a pWindow on the back-end server. */
-void dmxSetShape(WindowPtr pWindow)
+void dmxSetShape(WindowPtr pWindow, int kind)
 {
     ScreenPtr       pScreen = pWindow->drawable.pScreen;
     DMXScreenInfo  *dmxScreen = &dmxScreens[pScreen->myNum];
@@ -1000,7 +1000,7 @@ void dmxSetShape(WindowPtr pWindow)
     DMX_UNWRAP(SetShape, dmxScreen, pScreen);
 #if 1
     if (pScreen->SetShape)
-	pScreen->SetShape(pWindow);
+	pScreen->SetShape(pWindow, kind);
 #endif
 
     if (pWinPriv->window) {
diff --git a/hw/dmx/dmxwindow.h b/hw/dmx/dmxwindow.h
index 740a21f..8bd1f74 100644
--- a/hw/dmx/dmxwindow.h
+++ b/hw/dmx/dmxwindow.h
@@ -94,7 +94,7 @@ extern void dmxResizeRootWindow(WindowPtr pRoot,
 extern Bool dmxBEDestroyWindow(WindowPtr pWindow);
 
 /* Support for shape extension */
-extern void dmxSetShape(WindowPtr pWindow);
+extern void dmxSetShape(WindowPtr pWindow, int kind);
 
 /** Private index.  \see dmxwindow.c \see dmxscrinit.c */
 extern DevPrivateKey dmxWinPrivateKey;
diff --git a/hw/xnest/Window.c b/hw/xnest/Window.c
index 48c870f..11d5369 100644
--- a/hw/xnest/Window.c
+++ b/hw/xnest/Window.c
@@ -423,10 +423,10 @@ xnestWindowExposures(WindowPtr pWin, RegionPtr pRgn, RegionPtr other_exposed)
 }
 
 void
-xnestSetShape(WindowPtr pWin)
+xnestSetShape(WindowPtr pWin, int kind)
 {
   xnestShapeWindow(pWin);
-  miSetShape(pWin);
+  miSetShape(pWin, kind);
 }
 
 static Bool
diff --git a/hw/xnest/XNWindow.h b/hw/xnest/XNWindow.h
index b59d86a..92a1902 100644
--- a/hw/xnest/XNWindow.h
+++ b/hw/xnest/XNWindow.h
@@ -66,7 +66,7 @@ void xnestCopyWindow(WindowPtr pWin, xPoint oldOrigin, RegionPtr oldRegion);
 void xnestClipNotify(WindowPtr pWin, int dx, int dy);
 void xnestWindowExposures(WindowPtr pWin, RegionPtr pRgn,
 			  RegionPtr other_exposed);
-void xnestSetShape(WindowPtr pWin);
+void xnestSetShape(WindowPtr pWin, int kind);
 void xnestShapeWindow(WindowPtr pWin);
 
 #endif /* XNESTWINDOW_H */
diff --git a/hw/xwin/win.h b/hw/xwin/win.h
index 26bb856..49b73d7 100644
--- a/hw/xwin/win.h
+++ b/hw/xwin/win.h
@@ -1204,7 +1204,7 @@ Bool
 winMapWindowRootless (WindowPtr pWindow);
 
 void
-winSetShapeRootless (WindowPtr pWindow);
+winSetShapeRootless (WindowPtr pWindow, int kind);
 
 
 /*
@@ -1226,7 +1226,7 @@ void
 winReshapeMultiWindow (WindowPtr pWin);
 
 void
-winSetShapeMultiWindow (WindowPtr pWindow);
+winSetShapeMultiWindow (WindowPtr pWindow, int kind);
 
 void
 winUpdateRgnMultiWindow (WindowPtr pWindow);
diff --git a/hw/xwin/winmultiwindowshape.c b/hw/xwin/winmultiwindowshape.c
index 3532357..597eab6 100644
--- a/hw/xwin/winmultiwindowshape.c
+++ b/hw/xwin/winmultiwindowshape.c
@@ -41,17 +41,17 @@
  */
 
 void
-winSetShapeMultiWindow (WindowPtr pWin)
+winSetShapeMultiWindow (WindowPtr pWin, int kind)
 {
   ScreenPtr		pScreen = pWin->drawable.pScreen;
   winScreenPriv(pScreen);
 
 #if CYGMULTIWINDOW_DEBUG
-  ErrorF ("winSetShapeMultiWindow - pWin: %08x\n", pWin);
+  ErrorF ("winSetShapeMultiWindow - pWin: %08x kind: %i\n", pWin, kind);
 #endif
   
   WIN_UNWRAP(SetShape); 
-  (*pScreen->SetShape)(pWin);
+  (*pScreen->SetShape)(pWin, kind);
   WIN_WRAP(SetShape, winSetShapeMultiWindow);
   
   /* Update the Windows window's shape */
diff --git a/hw/xwin/winwindow.c b/hw/xwin/winwindow.c
index 30b6729..d0c360f 100644
--- a/hw/xwin/winwindow.c
+++ b/hw/xwin/winwindow.c
@@ -451,17 +451,17 @@ winMapWindowRootless (WindowPtr pWin)
 
 
 void
-winSetShapeRootless (WindowPtr pWin)
+winSetShapeRootless (WindowPtr pWin, int kind)
 {
   ScreenPtr		pScreen = pWin->drawable.pScreen;
   winScreenPriv(pScreen);
 
 #if CYGDEBUG
-  winTrace ("winSetShapeRootless (%p)\n", pWin);
+  winTrace ("winSetShapeRootless (%p, %i)\n", pWin, kind);
 #endif
 
   WIN_UNWRAP(SetShape); 
-  (*pScreen->SetShape)(pWin);
+  (*pScreen->SetShape)(pWin, kind);
   WIN_WRAP(SetShape, winSetShapeRootless);
   
   winReshapeRootless (pWin);
diff --git a/include/scrnintstr.h b/include/scrnintstr.h
index 6f1936c..21b4a16 100644
--- a/include/scrnintstr.h
+++ b/include/scrnintstr.h
@@ -423,7 +423,8 @@ typedef    void (* ReparentWindowProcPtr)(
     WindowPtr /*pPriorParent*/);
 
 typedef    void (* SetShapeProcPtr)(
-	WindowPtr /*pWin*/);
+        WindowPtr /*pWin*/,
+        int /* kind */);
 
 typedef    void (* ChangeBorderWidthProcPtr)(
 	WindowPtr /*pWin*/,
diff --git a/mi/mi.h b/mi/mi.h
index 812edce..321523b 100644
--- a/mi/mi.h
+++ b/mi/mi.h
@@ -567,7 +567,8 @@ extern _X_EXPORT WindowPtr miGetLayerWindow(
 );
 
 extern _X_EXPORT void miSetShape(
-    WindowPtr /*pWin*/
+    WindowPtr /*pWin*/,
+    int /*kind*/
 );
 
 extern _X_EXPORT void miChangeBorderWidth(
diff --git a/mi/mioverlay.c b/mi/mioverlay.c
index 2de7682..df43196 100644
--- a/mi/mioverlay.c
+++ b/mi/mioverlay.c
@@ -5,6 +5,7 @@
 
 #include <X11/X.h>
 #include "scrnintstr.h"
+#include <X11/extensions/shapeproto.h>
 #include "validate.h"
 #include "windowstr.h"
 #include "mi.h"
@@ -82,7 +83,7 @@ static void miOverlayResizeWindow(WindowPtr, int, int, unsigned int,
 					unsigned int, WindowPtr);
 static void miOverlayClearToBackground(WindowPtr, int, int, int, int, Bool);
 
-static void miOverlaySetShape(WindowPtr);
+static void miOverlaySetShape(WindowPtr, int);
 static void miOverlayChangeBorderWidth(WindowPtr, unsigned int);
 
 #define MIOVERLAY_GET_SCREEN_PRIVATE(pScreen) ((miOverlayScreenPtr) \
@@ -1497,53 +1498,55 @@ miOverlayResizeWindow(
 
 
 static void
-miOverlaySetShape(WindowPtr pWin)
+miOverlaySetShape(WindowPtr pWin, int kind)
 {
-    Bool	WasViewable = (Bool)(pWin->viewable);
-    ScreenPtr 	pScreen = pWin->drawable.pScreen;
-
-    if (WasViewable) {
-	(*pScreen->MarkOverlappedWindows)(pWin, pWin, NULL);
-
-	if (HasBorder (pWin)) {
-	    RegionPtr borderVisible;
-
-	    borderVisible = REGION_CREATE(pScreen, NullBox, 1);
-	    REGION_SUBTRACT(pScreen, borderVisible,
-				      &pWin->borderClip, &pWin->winSize);
-	    pWin->valdata->before.borderVisible = borderVisible;
-	    pWin->valdata->before.resized = TRUE;
-	    if(IN_UNDERLAY(pWin)) {
-		miOverlayTreePtr pTree = MIOVERLAY_GET_WINDOW_TREE(pWin);
-		RegionPtr borderVisible2;
-
-		borderVisible2 = REGION_CREATE(pScreen, NULL, 1);
-		REGION_SUBTRACT(pScreen, borderVisible2,
-				      &pTree->borderClip, &pWin->winSize);
-		pTree->valdata->borderVisible = borderVisible2;
-	    }
-	}
-    }
+    Bool        WasViewable = (Bool)(pWin->viewable);
+    ScreenPtr   pScreen = pWin->drawable.pScreen;
+
+    if (kind != ShapeInput) {
+        if (WasViewable) {
+            (*pScreen->MarkOverlappedWindows)(pWin, pWin, NULL);
+
+            if (HasBorder (pWin)) {
+                RegionPtr borderVisible;
+
+                borderVisible = REGION_CREATE(pScreen, NullBox, 1);
+                REGION_SUBTRACT(pScreen, borderVisible,
+                                        &pWin->borderClip, &pWin->winSize);
+                pWin->valdata->before.borderVisible = borderVisible;
+                pWin->valdata->before.resized = TRUE;
+                if(IN_UNDERLAY(pWin)) {
+                    miOverlayTreePtr pTree = MIOVERLAY_GET_WINDOW_TREE(pWin);
+                    RegionPtr borderVisible2;
+
+                    borderVisible2 = REGION_CREATE(pScreen, NULL, 1);
+                    REGION_SUBTRACT(pScreen, borderVisible2,
+                                        &pTree->borderClip, &pWin->winSize);
+                    pTree->valdata->borderVisible = borderVisible2;
+                }
+            }
+        }
 
-    SetWinSize (pWin);
-    SetBorderSize (pWin);
+        SetWinSize (pWin);
+        SetBorderSize (pWin);
 
-    ResizeChildrenWinSize(pWin, 0, 0, 0, 0);
+        ResizeChildrenWinSize(pWin, 0, 0, 0, 0);
 
-    if (WasViewable) {
-	(*pScreen->MarkOverlappedWindows)(pWin, pWin, NULL);
+        if (WasViewable) {
+            (*pScreen->MarkOverlappedWindows)(pWin, pWin, NULL);
 
 
-	(*pScreen->ValidateTree)(pWin->parent, NullWindow, VTOther);
-    }
+            (*pScreen->ValidateTree)(pWin->parent, NullWindow, VTOther);
+        }
 
-    if (WasViewable) {
-	(*pScreen->HandleExposures)(pWin->parent);
-	if (pScreen->PostValidateTree)
-	    (*pScreen->PostValidateTree)(pWin->parent, NullWindow, VTOther);
+        if (WasViewable) {
+            (*pScreen->HandleExposures)(pWin->parent);
+            if (pScreen->PostValidateTree)
+                (*pScreen->PostValidateTree)(pWin->parent, NullWindow, VTOther);
+        }
     }
     if (pWin->realized)
-	WindowsRestructured ();
+        WindowsRestructured ();
     CheckCursorConfinement(pWin);
 }
 
diff --git a/mi/miwindow.c b/mi/miwindow.c
index 2550ca2..ce35974 100644
--- a/mi/miwindow.c
+++ b/mi/miwindow.c
@@ -50,6 +50,7 @@ SOFTWARE.
 #endif
 
 #include <X11/X.h>
+#include <X11/extensions/shape.h>
 #include "regionstr.h"
 #include "region.h"
 #include "mi.h"
@@ -696,56 +697,59 @@ miGetLayerWindow(WindowPtr pWin)
  */
 
 void
-miSetShape(WindowPtr pWin)
+miSetShape(WindowPtr pWin, int kind)
 {
-    Bool	WasViewable = (Bool)(pWin->viewable);
-    ScreenPtr 	pScreen = pWin->drawable.pScreen;
-    Bool	anyMarked = FALSE;
+    Bool        WasViewable = (Bool)(pWin->viewable);
+    ScreenPtr   pScreen = pWin->drawable.pScreen;
+    Bool        anyMarked = FALSE;
     WindowPtr   pLayerWin;
 
-    if (WasViewable)
-    {
-	anyMarked = (*pScreen->MarkOverlappedWindows)(pWin, pWin,
-						      &pLayerWin);
-	if (pWin->valdata)
-	{
-	    if (HasBorder (pWin))
-	    {
-		RegionPtr	borderVisible;
-
-		borderVisible = REGION_CREATE(pScreen, NullBox, 1);
-		REGION_SUBTRACT(pScreen, borderVisible,
-				      &pWin->borderClip, &pWin->winSize);
-		pWin->valdata->before.borderVisible = borderVisible;
-	    }
-	    pWin->valdata->before.resized = TRUE;
-	}
-    }
-
-    SetWinSize (pWin);
-    SetBorderSize (pWin);
-
-    ResizeChildrenWinSize(pWin, 0, 0, 0, 0);
-
-    if (WasViewable)
-    {
-	anyMarked |= (*pScreen->MarkOverlappedWindows)(pWin, pWin,
-						NULL);
-
-
-	if (anyMarked)
-	    (*pScreen->ValidateTree)(pLayerWin->parent, NullWindow, VTOther);
-    }
-
-    if (WasViewable)
-    {
-	if (anyMarked)
-	    (*pScreen->HandleExposures)(pLayerWin->parent);
-	if (anyMarked && pScreen->PostValidateTree)
-	    (*pScreen->PostValidateTree)(pLayerWin->parent, NullWindow, VTOther);
+    if (kind != ShapeInput) {
+        if (WasViewable)
+        {
+            anyMarked = (*pScreen->MarkOverlappedWindows)(pWin, pWin,
+                                                          &pLayerWin);
+            if (pWin->valdata)
+            {
+                if (HasBorder (pWin))
+                {
+                    RegionPtr borderVisible;
+
+                    borderVisible = REGION_CREATE(pScreen, NullBox, 1);
+                    REGION_SUBTRACT(pScreen, borderVisible,
+                                    &pWin->borderClip, &pWin->winSize);
+                    pWin->valdata->before.borderVisible = borderVisible;
+                }
+                pWin->valdata->before.resized = TRUE;
+            }
+        }
+
+        SetWinSize (pWin);
+        SetBorderSize (pWin);
+
+        ResizeChildrenWinSize(pWin, 0, 0, 0, 0);
+
+        if (WasViewable)
+        {
+            anyMarked |= (*pScreen->MarkOverlappedWindows)(pWin, pWin,
+                                                           NULL);
+
+            if (anyMarked)
+                (*pScreen->ValidateTree)(pLayerWin->parent, NullWindow,
+                                         VTOther);
+        }
+
+        if (WasViewable)
+        {
+            if (anyMarked)
+                (*pScreen->HandleExposures)(pLayerWin->parent);
+            if (anyMarked && pScreen->PostValidateTree)
+                (*pScreen->PostValidateTree)(pLayerWin->parent, NullWindow,
+                                             VTOther);
+        }
     }
     if (pWin->realized)
-	WindowsRestructured ();
+        WindowsRestructured ();
     CheckCursorConfinement(pWin);
 }
 
diff --git a/xfixes/region.c b/xfixes/region.c
index 7a71c78..b034ad0 100644
--- a/xfixes/region.c
+++ b/xfixes/region.c
@@ -733,7 +733,7 @@ ProcXFixesSetWindowShapeRegion (ClientPtr client)
     if (*pDestRegion)
 	REGION_DESTROY(pScreen, *pDestRegion);
     *pDestRegion = pRegion;
-    (*pScreen->SetShape) (pWin);
+    (*pScreen->SetShape) (pWin, stuff->destKind);
     SendShapeNotify (pWin, stuff->destKind);
     return Success;
 }
commit d90f2cd98a97e6534792d3867b3fba70d850b706
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Thu May 27 13:26:23 2010 +0100

    xfree86: Unbreak autoconfig following 0abf065e38c4
    
    The move of the PCI device id probing into a separate file neglected to
    return the number of found devices, and so the PCI devices were being
    overwritten by the default entries for vesa and fbdev.
    
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
    Cc: Tiago Vignatti <tiago.vignatti at nokia.com>
    Cc: Alex Deucher <alexdeucher at gmail.com>
    Reviewed-by: Julien Cristau <jcristau at debian.org>
    Reviewed-by: Tiago Vignatti <tiago.vignatti at nokia.com>
    Signed-off-by: Keith Packard <keithp at keithp.com>

diff --git a/hw/xfree86/common/xf86AutoConfig.c b/hw/xfree86/common/xf86AutoConfig.c
index 8947a4f..5b236af 100644
--- a/hw/xfree86/common/xf86AutoConfig.c
+++ b/hw/xfree86/common/xf86AutoConfig.c
@@ -257,7 +257,7 @@ listPossibleVideoDrivers(char *matches[], int nmatches)
     }
 #endif
 
-    xf86PciMatchDriver(matches, nmatches);
+    i = xf86PciMatchDriver(matches, nmatches);
 
     /* Fallback to platform default hardware */
     if (i < (nmatches - 1)) {
diff --git a/hw/xfree86/common/xf86pciBus.c b/hw/xfree86/common/xf86pciBus.c
index 085be01..184f221 100644
--- a/hw/xfree86/common/xf86pciBus.c
+++ b/hw/xfree86/common/xf86pciBus.c
@@ -1294,7 +1294,11 @@ matchDriverFromFiles (char** matches, uint16_t match_vendor, uint16_t match_chip
 }
 #endif /* __linux__ */
 
-void
+/**
+ *  @return The numbers of found devices that match with the current system
+ *  drivers.
+ */
+int
 xf86PciMatchDriver(char* matches[], int nmatches) {
     int i;
     struct pci_device * info = NULL;
@@ -1326,4 +1330,6 @@ xf86PciMatchDriver(char* matches[], int nmatches) {
     if ((info != NULL) && (i < nmatches)) {
 	i += videoPtrToDriverList(info, &(matches[i]), nmatches - i);
     }
+
+    return i;
 }
diff --git a/hw/xfree86/common/xf86pciBus.h b/hw/xfree86/common/xf86pciBus.h
index f84a496..3f02b93 100644
--- a/hw/xfree86/common/xf86pciBus.h
+++ b/hw/xfree86/common/xf86pciBus.h
@@ -37,6 +37,6 @@ void xf86PciProbe(void);
 Bool xf86PciAddMatchingDev(DriverPtr drvp);
 Bool xf86PciProbeDev(DriverPtr drvp);
 void xf86PciIsolateDevice(char *argument);
-void xf86PciMatchDriver(char* matches[], int nmatches);
+int xf86PciMatchDriver(char* matches[], int nmatches);
 
 #endif /* _XF86_PCI_BUS_H */
commit 1304b8b27cb12c803c4f51f04cb6f9d508b82c69
Author: Aaron Plattner <aplattner at nvidia.com>
Date:   Fri May 28 09:35:54 2010 -0700

    Fix pixmap validation in miDbePositionWindow.
    
    miDbePositionWindow allocates two pixmaps: a front buffer, and a back buffer.
    If the buffers are supposed to be initialized, it validates a GC against the
    front buffer, then uses it to fill and/or copy both the front buffer *and* the
    back buffer, without revalidating.  If the acceleration architecture needs
    different GC funcs for the two pixmaps -- for example if allocation of the front
    buffer exhausted video memory -- then this can cause crashes because the GC is
    not validated for the back buffer pixmap.
    
    Fix this by performing the rendering for the front buffer first, then
    revalidating against the back buffer before performing the back buffer
    rendering.
    
    Signed-off-by: Aaron Plattner <aplattner at nvidia.com>
    Reviewed-by: Jamey Sharp <jamey at minilop.net>
    Signed-off-by: Keith Packard <keithp at keithp.com>

diff --git a/dbe/midbe.c b/dbe/midbe.c
index e47a253..49689c5 100644
--- a/dbe/midbe.c
+++ b/dbe/midbe.c
@@ -695,25 +695,33 @@ miDbePositionWindow(WindowPtr pWin, int x, int y)
 
 
         pDbeWindowPrivPriv = MI_DBE_WINDOW_PRIV_PRIV(pDbeWindowPriv);
-        ValidateGC((DrawablePtr)pFrontBuffer, pGC);
 
 	/* I suppose this could avoid quite a bit of work if
 	 * it computed the minimal area required.
 	 */
+	ValidateGC(&pFrontBuffer->drawable, pGC);
 	if (clear)
         {
 	    (*pGC->ops->PolyFillRect)((DrawablePtr)pFrontBuffer, pGC, 1,
 				      &clearRect);
-	    (*pGC->ops->PolyFillRect)((DrawablePtr)pBackBuffer , pGC, 1,
-				      &clearRect);
-        }
-
-        /* Copy the contents of the old DBE pixmaps to the new pixmaps. */
+	}
+	/* Copy the contents of the old front pixmap to the new one. */
 	if (pWin->bitGravity != ForgetGravity)
 	{
 	    (*pGC->ops->CopyArea)((DrawablePtr)pDbeWindowPrivPriv->pFrontBuffer,
                                   (DrawablePtr)pFrontBuffer, pGC, sourcex,
                                   sourcey, savewidth, saveheight, destx, desty);
+        }
+
+	ValidateGC(&pBackBuffer->drawable, pGC);
+	if (clear)
+	{
+	    (*pGC->ops->PolyFillRect)((DrawablePtr)pBackBuffer , pGC, 1,
+				      &clearRect);
+	}
+	/* Copy the contents of the old back pixmap to the new one. */
+	if (pWin->bitGravity != ForgetGravity)
+	{
 	    (*pGC->ops->CopyArea)((DrawablePtr)pDbeWindowPrivPriv->pBackBuffer,
                                   (DrawablePtr)pBackBuffer, pGC, sourcex,
                                   sourcey, savewidth, saveheight, destx, desty);
commit 91a6359caf24d94343ff76f43ea7b7fc3223203d
Author: Dave Airlie <airlied at redhat.com>
Date:   Thu Jun 3 12:16:40 2010 +1000

    composite: initialise pOldPixmap to NullPixmap at alloc time.
    
    We just never initialised the malloced value.
    
    Signed-off-by: Dave Airlie <airlied at redhat.com>
    Reviewed-by: Keith Packard <keithp at keithp.com>
    Signed-off-by: Keith Packard <keithp at keithp.com>

diff --git a/composite/compalloc.c b/composite/compalloc.c
index 3694ab8..7930ebe 100644
--- a/composite/compalloc.c
+++ b/composite/compalloc.c
@@ -143,6 +143,7 @@ compRedirectWindow (ClientPtr pClient, WindowPtr pWin, int update)
 	cw->oldy = COMP_ORIGIN_INVALID;
 	cw->damageRegistered = FALSE;
 	cw->damaged = FALSE;
+	cw->pOldPixmap = NullPixmap;
 	dixSetPrivate(&pWin->devPrivates, CompWindowPrivateKey, cw);
     }
     ccw->next = cw->clients;
commit 968a79dcf5e17ac3963953ef56b8f94dbd75323b
Author: Nicolas George <nicolas.george at normalesup.org>
Date:   Wed Jun 2 13:40:51 2010 +0200

    Change keyboard controls on slave keyboards (#27926)
    
    Makes the use of IsMaster in ProcChangeKeyboardControl consistent with other
    similar loops.
    
    Signed-off-by: Nicolas George <nicolas.george at normalesup.org>
    Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>

diff --git a/dix/devices.c b/dix/devices.c
index b0b4653..250a498 100644
--- a/dix/devices.c
+++ b/dix/devices.c
@@ -2021,7 +2021,7 @@ ProcChangeKeyboardControl (ClientPtr client)
     keyboard = PickKeyboard(client);
 
     for (pDev = inputInfo.devices; pDev; pDev = pDev->next) {
-        if ((pDev == keyboard || (!IsMaster(keyboard) && pDev->u.master == keyboard)) &&
+        if ((pDev == keyboard || (!IsMaster(pDev) && pDev->u.master == keyboard)) &&
             pDev->kbdfeed && pDev->kbdfeed->CtrlProc) {
             ret = XaceHook(XACE_DEVICE_ACCESS, client, pDev, DixManageAccess);
 	    if (ret != Success)
@@ -2030,7 +2030,7 @@ ProcChangeKeyboardControl (ClientPtr client)
     }
 
     for (pDev = inputInfo.devices; pDev; pDev = pDev->next) {
-        if ((pDev == keyboard || (!IsMaster(keyboard) && pDev->u.master == keyboard)) &&
+        if ((pDev == keyboard || (!IsMaster(pDev) && pDev->u.master == keyboard)) &&
             pDev->kbdfeed && pDev->kbdfeed->CtrlProc) {
             ret = DoChangeKeyboardControl(client, pDev, vlist, vmask);
             if (ret != Success)
commit 108b766c31b57fb1955d34d85673a235c7f743aa
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date:   Thu May 20 11:04:53 2010 +1000

    xfree86: initialize InputAttributes to NULL in the autoconfig code.
    
    Reported-by: Jamey Sharp <jamey at minilop.net>
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
    Reviewed-by: Jamey Sharp <jamey at minilop.net>

diff --git a/hw/xfree86/common/xf86Config.c b/hw/xfree86/common/xf86Config.c
index a481368..7acb6af 100644
--- a/hw/xfree86/common/xf86Config.c
+++ b/hw/xfree86/common/xf86Config.c
@@ -2330,6 +2330,7 @@ configInput(IDevPtr inputp, XF86ConfInputPtr conf_input, MessageType from)
     inputp->driver = conf_input->inp_driver;
     inputp->commonOptions = conf_input->inp_option_lst;
     inputp->extraOptions = NULL;
+    inputp->attrs = NULL;
 
     return TRUE;
 }
commit 151659f9636088fd70bc5586de97bf43ee706180
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date:   Mon May 24 16:24:03 2010 +1000

    test: fix up InputAttributes helper function test.
    
    Just some extra clarification as pointed out by Dan Nicholson,
    and that memcpy should have been a memcmp.
    
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
    Signed-off-by: Dan Nicholson <dbn.lists at gmail.com>

diff --git a/test/input.c b/test/input.c
index 8a54af9..12771c5 100644
--- a/test/input.c
+++ b/test/input.c
@@ -803,12 +803,18 @@ static void cmp_attr_fields(InputAttributes *attr1,
 
     tags1 = attr1->tags;
     tags2 = attr2->tags;
+
+    /* if we don't have any tags, skip the tag checking bits */
     if (!tags1)
     {
         g_assert(!tags2);
         return;
     }
 
+    /* Don't lug around empty arrays */
+    g_assert(*tags1);
+    g_assert(*tags2);
+
     /* check for identical content, but duplicated */
     while (*tags1)
     {
@@ -818,6 +824,7 @@ static void cmp_attr_fields(InputAttributes *attr1,
         tags2++;
     }
 
+    /* ensure tags1 and tags2 have the same no of elements */
     g_assert(!*tags2);
 
     /* check for not sharing memory */
@@ -842,7 +849,7 @@ static void dix_input_attributes(void)
     g_assert(!new);
 
     new = DuplicateInputAttributes(&orig);
-    g_assert(memcpy(&orig, new, sizeof(InputAttributes)));
+    g_assert(memcmp(&orig, new, sizeof(InputAttributes)) == 0);
 
     orig.product = "product name";
     new = DuplicateInputAttributes(&orig);
commit 6cccf0131c8464d8838cae2200730873d7dd9e45
Author: Peter Korsgaard <peter.korsgaard at barco.com>
Date:   Tue May 25 11:03:28 2010 +0200

    dix: add 3x3 transformation matrix xinput property for multi-head handling
    
    For absolute input devices (E.G. touchscreens) in multi-head setups,
    we need a way to bind the device to an randr output. This adds the
    infrastructure to the server to allow us to do so.
    
    positionSprite() scales input coordinates to the dimensions of the shared
    (total) screen frame buffer, so to restrict motion to an output we need to
    scale/rotate/translate device coordinates to a subset of the frame buffer
    before passing them on to positionSprite.
    
    This is done here using a 3x3 transformation matrix, which is applied to
    the device coordinates using homogeneous coordinates, E.G.:
    
    [ c0 c1 c2 ]   [ x ]
    [ c3 c4 c5 ] * [ y ]
    [ c6 c7 c8 ]   [ 1 ]
    
    Notice: As input devices have varying input ranges, the coordinates are
    first scaled to the [0..1] range for generality, and afterwards scaled
    back up.
    
    E.G. for a dual head setup (using same resolution) next to each other, you
    would want to scale the X coordinates of the touchscreen connected to the
    both heads by 50%, and translate (offset) the coordinates of the rightmost
    head by 50%, or in matrix form:
    
       left:            right:
    [ 0.5 0 0 ]     [ 0.5 0 0.5 ]
    [ 0   1 0 ]     [ 0   1 0   ]
    [ 0   0 1 ]     [ 0   0 0   ]
    
    Which can be done using xinput:
    
    xinput set-prop <left> --type=float "Coordinate Transformation Matrix" \
           0.5 0 0 0 1 0 0 0 1
    
    xinput set-prop <right> --type=float "Coordinate Transformation Matrix" \
           0.5 0 0.5 0 1 0 0 0 1
    
    Likewise more complication setups involving more heads, rotation or
    different resolution can be handled.
    
    Signed-off-by: Peter Korsgaard <peter.korsgaard at barco.com>
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>

diff --git a/Xi/xiproperty.c b/Xi/xiproperty.c
index 8bb1962..b4d939f 100644
--- a/Xi/xiproperty.c
+++ b/Xi/xiproperty.c
@@ -177,7 +177,9 @@ static struct dev_properties
     {0, BTN_LABEL_PROP_BTN_TOOL_TRIPLETAP},
 
     {0, BTN_LABEL_PROP_BTN_GEAR_DOWN},
-    {0, BTN_LABEL_PROP_BTN_GEAR_UP}
+    {0, BTN_LABEL_PROP_BTN_GEAR_UP},
+
+    {0, XI_PROP_TRANSFORM}
 };
 
 static long XIPropHandlerID = 1;
diff --git a/dix/devices.c b/dix/devices.c
index cf23bc6..b0b4653 100644
--- a/dix/devices.c
+++ b/dix/devices.c
@@ -77,6 +77,8 @@ SOFTWARE.
 #include <X11/extensions/XI.h>
 #include <X11/extensions/XI2.h>
 #include <X11/extensions/XIproto.h>
+#include <math.h>
+#include <pixman.h>
 #include "exglobals.h"
 #include "exevents.h"
 #include "xiquerydevice.h" /* for SizeDeviceClasses */
@@ -91,6 +93,48 @@ SOFTWARE.
 
 static void RecalculateMasterButtons(DeviceIntPtr slave);
 
+static void
+DeviceSetTransform(DeviceIntPtr dev, float *transform)
+{
+    struct pixman_f_transform scale;
+    double sx, sy;
+    int x, y;
+
+    /**
+     * calculate combined transformation matrix:
+     *
+     * M = InvScale * Transform * Scale
+     *
+     * So we can later transform points using M * p
+     *
+     * Where:
+     *  Scale scales coordinates into 0..1 range
+     *  Transform is the user supplied (affine) transform
+     *  InvScale scales coordinates back up into their native range
+     */
+    sx = dev->valuator->axes[0].max_value - dev->valuator->axes[0].min_value;
+    sy = dev->valuator->axes[1].max_value - dev->valuator->axes[1].min_value;
+
+    /* invscale */
+    pixman_f_transform_init_scale(&scale, sx, sy);
+    scale.m[0][2] = dev->valuator->axes[0].min_value;
+    scale.m[1][2] = dev->valuator->axes[1].min_value;
+
+    /* transform */
+    for (y=0; y<3; y++)
+        for (x=0; x<3; x++)
+            dev->transform.m[y][x] = *transform++;
+
+    pixman_f_transform_multiply(&dev->transform, &scale, &dev->transform);
+
+    /* scale */
+    pixman_f_transform_init_scale(&scale, 1.0 / sx, 1.0 / sy);
+    scale.m[0][2] = -dev->valuator->axes[0].min_value / sx;
+    scale.m[1][2] = -dev->valuator->axes[1].min_value / sy;
+
+    pixman_f_transform_multiply(&dev->transform, &dev->transform, &scale);
+}
+
 /**
  * DIX property handler.
  */
@@ -115,6 +159,21 @@ DeviceSetProperty(DeviceIntPtr dev, Atom property, XIPropertyValuePtr prop,
             else if (!(*((CARD8*)prop->data)) && dev->enabled)
                 DisableDevice(dev, TRUE);
         }
+    } else if (property == XIGetKnownProperty(XI_PROP_TRANSFORM))
+    {
+        float *f = (float*)prop->data;
+        int i;
+
+        if (prop->format != 32 || prop->size != 9 ||
+            prop->type != XIGetKnownProperty(XATOM_FLOAT))
+            return BadValue;
+
+        for (i=0; i<9; i++)
+            if (!isfinite(f[i]))
+                return BadValue;
+
+        if (!checkonly)
+            DeviceSetTransform(dev, f);
     }
 
     return Success;
@@ -183,6 +242,7 @@ AddInputDevice(ClientPtr client, DeviceProc deviceProc, Bool autoStart)
     int devid;
     char devind[MAXDEVICES];
     BOOL enabled;
+    float transform[9];
 
     /* Find next available id, 0 and 1 are reserved */
     memset(devind, 0, sizeof(char)*MAXDEVICES);
@@ -234,6 +294,17 @@ AddInputDevice(ClientPtr client, DeviceProc deviceProc, Bool autoStart)
                            XA_INTEGER, 8, PropModeReplace, 1, &enabled,
                            FALSE);
     XISetDevicePropertyDeletable(dev, XIGetKnownProperty(XI_PROP_ENABLED), FALSE);
+
+    /* unity matrix */
+    memset(transform, 0, sizeof(transform));
+    transform[0] = transform[4] = transform[8] = 1.0f;
+
+    XIChangeDeviceProperty(dev, XIGetKnownProperty(XI_PROP_TRANSFORM),
+                           XIGetKnownProperty(XATOM_FLOAT), 32,
+                           PropModeReplace, 9, transform, FALSE);
+    XISetDevicePropertyDeletable(dev, XIGetKnownProperty(XI_PROP_TRANSFORM),
+                                 FALSE);
+
     XIRegisterPropertyHandler(dev, DeviceSetProperty, NULL, NULL);
 
     return dev;
diff --git a/dix/getevents.c b/dix/getevents.c
index 62aaff9..eeef414 100644
--- a/dix/getevents.c
+++ b/dix/getevents.c
@@ -33,6 +33,7 @@
 #include <X11/X.h>
 #include <X11/keysym.h>
 #include <X11/Xproto.h>
+#include <math.h>
 
 #include "misc.h"
 #include "resource.h"
@@ -56,6 +57,7 @@
 
 #include <X11/extensions/XI.h>
 #include <X11/extensions/XIproto.h>
+#include <pixman.h>
 #include "exglobals.h"
 #include "exevents.h"
 #include "exglobals.h"
@@ -997,6 +999,22 @@ FreeEventList(EventListPtr list, int num_events)
     free(list);
 }
 
+static void
+transformAbsolute(DeviceIntPtr dev, int v[MAX_VALUATORS])
+{
+    struct pixman_f_vector p;
+
+    /* p' = M * p in homogeneous coordinates */
+    p.v[0] = v[0];
+    p.v[1] = v[1];
+    p.v[2] = 1.0;
+
+    pixman_f_transform_point(&dev->transform, &p);
+
+    v[0] = lround(p.v[0]);
+    v[1] = lround(p.v[1]);
+}
+
 /**
  * Generate a series of xEvents (filled into the EventList) representing
  * pointer motion, or button presses.  Xi and XKB-aware.
@@ -1068,6 +1086,7 @@ GetPointerEvents(EventList *events, DeviceIntPtr pDev, int type, int buttons,
                         scr->height);
         }
 
+        transformAbsolute(pDev, valuators);
         moveAbsolute(pDev, &x, &y, first_valuator, num_valuators, valuators);
     } else {
         if (flags & POINTER_ACCELERATE) {
diff --git a/include/inputstr.h b/include/inputstr.h
index c5b9ff7..a83e863 100644
--- a/include/inputstr.h
+++ b/include/inputstr.h
@@ -49,6 +49,7 @@ SOFTWARE.
 #ifndef INPUTSTRUCT_H
 #define INPUTSTRUCT_H
 
+#include <pixman.h>
 #include "input.h"
 #include "window.h"
 #include "dixstruct.h"
@@ -550,6 +551,9 @@ typedef struct _DeviceIntRec {
         XIPropertyPtr   properties;
         XIPropertyHandlerPtr handlers; /* NULL-terminated */
     } properties;
+
+    /* coordinate transformation matrix for absolute input devices */
+    struct pixman_f_transform transform;
 } DeviceIntRec;
 
 typedef struct {
diff --git a/include/xserver-properties.h b/include/xserver-properties.h
index 30e8efb..c6259ae 100644
--- a/include/xserver-properties.h
+++ b/include/xserver-properties.h
@@ -35,6 +35,13 @@
 /* BOOL. If present, device is a virtual XTEST device */
 #define XI_PROP_XTEST_DEVICE  "XTEST Device"
 
+/* Coordinate transformation matrix for absolute input devices
+ * FLOAT, 9 values in row-major order, coordinates in 0..1 range:
+ * [c0 c1 c2]   [x]
+ * [c3 c4 c5] * [y]
+ * [c6 c7 c8]   [1] */
+#define XI_PROP_TRANSFORM "Coordinate Transformation Matrix"
+
 /* Pointer acceleration properties */
 /* INTEGER of any format */
 #define ACCEL_PROP_PROFILE_NUMBER "Device Accel Profile"


More information about the xorg-commit mailing list