[Xquartz-changes] xserver: Branch 'master' - 71 commits

Jeremy Huddleston jeremyhu at freedesktop.org
Mon Aug 11 12:50:21 PDT 2014


Rebased ref, commits from common ancestor:
commit dfbc6a1a78ff3192baae6f7f2af98b6e51422f75
Author: Jeremy Huddleston Sequoia <jeremyhu at apple.com>
Date:   Wed Jul 23 11:53:33 2014 -0700

    ListenOnOpenFD: Remove Resets since this is intended to be for hotplugging connections
    
    pharris says that the resets should not be done in the hotplugging case.
    
    This may fix a crash reported against XQuartz:
    http://xquartz.macosforge.org/trac/ticket/869
    
    Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu at apple.com>
    Reviewed-by: Peter Harris <pharris at opentext.com>

diff --git a/os/connection.c b/os/connection.c
index 40d9ff3..f915e12 100644
--- a/os/connection.c
+++ b/os/connection.c
@@ -1307,13 +1307,6 @@ ListenOnOpenFD(int fd, int noxauth)
 
     /* Increment the count */
     ListenTransCount++;
-
-    /* This *might* not be needed... /shrug */
-    ResetAuthorization();
-    ResetHosts(display);
-#ifdef XDMCP
-    XdmcpReset();
-#endif
 }
 
 /* based on TRANS(SocketUNIXAccept) (XtransConnInfo ciptr, int *status) */
commit 3714f5401690b288045090c4bcd9cb01c6e4860e
Author: Eric Anholt <eric at anholt.net>
Date:   Sun Apr 6 07:57:44 2014 +0100

    kdrive: Remove a dead struct.
    
    It's never been used in the history of the tree.
    
    Signed-off-by: Eric Anholt <eric at anholt.net>
    Reviewed-by: Keith Packard <keithp at keithp.com>

diff --git a/hw/kdrive/src/kxv.h b/hw/kdrive/src/kxv.h
index 4eb4054..b997299 100644
--- a/hw/kdrive/src/kxv.h
+++ b/hw/kdrive/src/kxv.h
@@ -54,15 +54,6 @@ of the copyright holder.
 #define VIDEO_OVERLAID_STILLS			0x00000008
 #define VIDEO_CLIP_TO_VIEWPORT			0x00000010
 
-typedef struct {
-    KdScreenInfo *screen;
-    int id;
-    unsigned short width, height;
-    int *pitches;               /* bytes */
-    int *offsets;               /* in bytes from start of framebuffer */
-    DevUnion devPrivate;
-} KdSurfaceRec, *KdSurfacePtr;
-
 typedef int (*PutVideoFuncPtr) (KdScreenInfo * screen, DrawablePtr pDraw,
                                 short vid_x, short vid_y, short drw_x,
                                 short drw_y, short vid_w, short vid_h,
commit ef258fa4fd0c215b1327fb3d94b37e75af9fae6b
Author: Eric Anholt <eric at anholt.net>
Date:   Wed Jul 30 21:11:51 2014 -0700

    xv: Drop the ClientPtr from the interface to the DDX.
    
    Nobody was using it.
    
    v2: Merge the hunk that was accidentally in the previous commit into
        this one.
    
    Signed-off-by: Eric Anholt <eric at anholt.net>
    Reviewed-by: Keith Packard <keithp at keithp.com>

diff --git a/Xext/xvdisp.c b/Xext/xvdisp.c
index 58c7203..0bdfed3 100644
--- a/Xext/xvdisp.c
+++ b/Xext/xvdisp.c
@@ -746,7 +746,7 @@ ProcXvQueryBestSize(ClientPtr client)
 
     VALIDATE_XV_PORT(stuff->port, pPort, DixReadAccess);
 
-    (*pPort->pAdaptor->ddQueryBestSize) (client, pPort, stuff->motion,
+    (*pPort->pAdaptor->ddQueryBestSize) (pPort, stuff->motion,
                                          stuff->vid_w, stuff->vid_h,
                                          stuff->drw_w, stuff->drw_h,
                                          &actual_width, &actual_height);
@@ -851,8 +851,7 @@ ProcXvPutImage(ClientPtr client)
 
     width = stuff->width;
     height = stuff->height;
-    size = (*pPort->pAdaptor->ddQueryImageAttributes) (client,
-                                                       pPort, pImage, &width,
+    size = (*pPort->pAdaptor->ddQueryImageAttributes) (pPort, pImage, &width,
                                                        &height, NULL, NULL);
     size += sizeof(xvPutImageReq);
     size = bytes_to_int32(size);
@@ -917,8 +916,7 @@ ProcXvShmPutImage(ClientPtr client)
 
     width = stuff->width;
     height = stuff->height;
-    size_needed = (*pPort->pAdaptor->ddQueryImageAttributes) (client,
-                                                              pPort, pImage,
+    size_needed = (*pPort->pAdaptor->ddQueryImageAttributes) (pPort, pImage,
                                                               &width, &height,
                                                               NULL, NULL);
     if ((size_needed + stuff->offset) > shmdesc->size)
@@ -1002,7 +1000,7 @@ ProcXvQueryImageAttributes(ClientPtr client)
     width = stuff->width;
     height = stuff->height;
 
-    size = (*pPort->pAdaptor->ddQueryImageAttributes) (client, pPort, pImage,
+    size = (*pPort->pAdaptor->ddQueryImageAttributes) (pPort, pImage,
                                                        &width, &height, offsets,
                                                        pitches);
 
diff --git a/Xext/xvdix.h b/Xext/xvdix.h
index 9bbfcde..e67a3c7 100644
--- a/Xext/xvdix.h
+++ b/Xext/xvdix.h
@@ -157,29 +157,29 @@ typedef struct {
     int nPorts;
     struct _XvPortRec *pPorts;
     ScreenPtr pScreen;
-    int (*ddPutVideo) (ClientPtr, DrawablePtr, struct _XvPortRec *, GCPtr,
+    int (*ddPutVideo) (DrawablePtr, struct _XvPortRec *, GCPtr,
                        INT16, INT16, CARD16, CARD16,
                        INT16, INT16, CARD16, CARD16);
-    int (*ddPutStill) (ClientPtr, DrawablePtr, struct _XvPortRec *, GCPtr,
+    int (*ddPutStill) (DrawablePtr, struct _XvPortRec *, GCPtr,
                        INT16, INT16, CARD16, CARD16,
                        INT16, INT16, CARD16, CARD16);
-    int (*ddGetVideo) (ClientPtr, DrawablePtr, struct _XvPortRec *, GCPtr,
+    int (*ddGetVideo) (DrawablePtr, struct _XvPortRec *, GCPtr,
                        INT16, INT16, CARD16, CARD16,
                        INT16, INT16, CARD16, CARD16);
-    int (*ddGetStill) (ClientPtr, DrawablePtr, struct _XvPortRec *, GCPtr,
+    int (*ddGetStill) (DrawablePtr, struct _XvPortRec *, GCPtr,
                        INT16, INT16, CARD16, CARD16,
                        INT16, INT16, CARD16, CARD16);
-    int (*ddStopVideo) (ClientPtr, struct _XvPortRec *, DrawablePtr);
-    int (*ddSetPortAttribute) (ClientPtr, struct _XvPortRec *, Atom, INT32);
-    int (*ddGetPortAttribute) (ClientPtr, struct _XvPortRec *, Atom, INT32 *);
-    int (*ddQueryBestSize) (ClientPtr, struct _XvPortRec *, CARD8,
+    int (*ddStopVideo) (struct _XvPortRec *, DrawablePtr);
+    int (*ddSetPortAttribute) (struct _XvPortRec *, Atom, INT32);
+    int (*ddGetPortAttribute) (struct _XvPortRec *, Atom, INT32 *);
+    int (*ddQueryBestSize) (struct _XvPortRec *, CARD8,
                             CARD16, CARD16, CARD16, CARD16,
                             unsigned int *, unsigned int *);
-    int (*ddPutImage) (ClientPtr, DrawablePtr, struct _XvPortRec *, GCPtr,
+    int (*ddPutImage) (DrawablePtr, struct _XvPortRec *, GCPtr,
                        INT16, INT16, CARD16, CARD16,
                        INT16, INT16, CARD16, CARD16,
                        XvImagePtr, unsigned char *, Bool, CARD16, CARD16);
-    int (*ddQueryImageAttributes) (ClientPtr, struct _XvPortRec *, XvImagePtr,
+    int (*ddQueryImageAttributes) (struct _XvPortRec *, XvImagePtr,
                                    CARD16 *, CARD16 *, int *, int *);
     DevUnion devPriv;
 } XvAdaptorRec, *XvAdaptorPtr;
diff --git a/Xext/xvmain.c b/Xext/xvmain.c
index b8294fe..bc176c8 100644
--- a/Xext/xvmain.c
+++ b/Xext/xvmain.c
@@ -356,7 +356,7 @@ XvDestroyPixmap(PixmapPtr pPix)
             if (pp->pDraw == (DrawablePtr) pPix) {
                 XvdiSendVideoNotify(pp, pp->pDraw, XvPreempted);
 
-                (void) (*pp->pAdaptor->ddStopVideo) (NULL, pp, pp->pDraw);
+                (void) (*pp->pAdaptor->ddStopVideo) (pp, pp->pDraw);
 
                 pp->pDraw = NULL;
                 pp->client = NULL;
@@ -404,7 +404,7 @@ XvDestroyWindow(WindowPtr pWin)
             if (pp->pDraw == (DrawablePtr) pWin) {
                 XvdiSendVideoNotify(pp, pp->pDraw, XvPreempted);
 
-                (void) (*pp->pAdaptor->ddStopVideo) (NULL, pp, pp->pDraw);
+                (void) (*pp->pAdaptor->ddStopVideo) (pp, pp->pDraw);
 
                 pp->pDraw = NULL;
                 pp->client = NULL;
@@ -566,7 +566,7 @@ XvdiPutVideo(ClientPtr client,
         XvdiSendVideoNotify(pPort, pPort->pDraw, XvPreempted);
     }
 
-    (void) (*pPort->pAdaptor->ddPutVideo) (client, pDraw, pPort, pGC,
+    (void) (*pPort->pAdaptor->ddPutVideo) (pDraw, pPort, pGC,
                                            vid_x, vid_y, vid_w, vid_h,
                                            drw_x, drw_y, drw_w, drw_h);
 
@@ -608,7 +608,7 @@ XvdiPutStill(ClientPtr client,
 
     pPort->time = currentTime;
 
-    status = (*pPort->pAdaptor->ddPutStill) (client, pDraw, pPort, pGC,
+    status = (*pPort->pAdaptor->ddPutStill) (pDraw, pPort, pGC,
                                              vid_x, vid_y, vid_w, vid_h,
                                              drw_x, drw_y, drw_w, drw_h);
 
@@ -644,7 +644,7 @@ XvdiPutImage(ClientPtr client,
 
     pPort->time = currentTime;
 
-    return (*pPort->pAdaptor->ddPutImage) (client, pDraw, pPort, pGC,
+    return (*pPort->pAdaptor->ddPutImage) (pDraw, pPort, pGC,
                                            src_x, src_y, src_w, src_h,
                                            drw_x, drw_y, drw_w, drw_h,
                                            image, data, sync, width, height);
@@ -683,7 +683,7 @@ XvdiGetVideo(ClientPtr client,
         XvdiSendVideoNotify(pPort, pPort->pDraw, XvPreempted);
     }
 
-    (void) (*pPort->pAdaptor->ddGetVideo) (client, pDraw, pPort, pGC,
+    (void) (*pPort->pAdaptor->ddGetVideo) (pDraw, pPort, pGC,
                                            vid_x, vid_y, vid_w, vid_h,
                                            drw_x, drw_y, drw_w, drw_h);
 
@@ -723,7 +723,7 @@ XvdiGetStill(ClientPtr client,
         return Success;
     }
 
-    status = (*pPort->pAdaptor->ddGetStill) (client, pDraw, pPort, pGC,
+    status = (*pPort->pAdaptor->ddGetStill) (pDraw, pPort, pGC,
                                              vid_x, vid_y, vid_w, vid_h,
                                              drw_x, drw_y, drw_w, drw_h);
 
@@ -955,7 +955,7 @@ XvdiStopVideo(ClientPtr client, XvPortPtr pPort, DrawablePtr pDraw)
 
     XvdiSendVideoNotify(pPort, pDraw, XvStopped);
 
-    status = (*pPort->pAdaptor->ddStopVideo) (client, pPort, pDraw);
+    status = (*pPort->pAdaptor->ddStopVideo) (pPort, pDraw);
 
     pPort->pDraw = NULL;
     pPort->client = (ClientPtr) client;
@@ -998,7 +998,7 @@ XvdiSetPortAttribute(ClientPtr client,
     int status;
 
     status =
-        (*pPort->pAdaptor->ddSetPortAttribute) (client, pPort, attribute,
+        (*pPort->pAdaptor->ddSetPortAttribute) (pPort, attribute,
                                                 value);
     if (status == Success)
         XvdiSendPortNotify(pPort, attribute, value);
@@ -1012,7 +1012,7 @@ XvdiGetPortAttribute(ClientPtr client,
 {
 
     return
-        (*pPort->pAdaptor->ddGetPortAttribute) (client, pPort, attribute,
+        (*pPort->pAdaptor->ddGetPortAttribute) (pPort, attribute,
                                                 p_value);
 
 }
diff --git a/hw/kdrive/src/kxv.c b/hw/kdrive/src/kxv.c
index f9c18d6..f979e1f 100644
--- a/hw/kdrive/src/kxv.c
+++ b/hw/kdrive/src/kxv.c
@@ -58,29 +58,29 @@ of the copyright holder.
 
 /* XvAdaptorRec fields */
 
-static int KdXVPutVideo(ClientPtr, DrawablePtr, XvPortPtr, GCPtr,
+static int KdXVPutVideo(DrawablePtr, XvPortPtr, GCPtr,
                         INT16, INT16, CARD16, CARD16,
                         INT16, INT16, CARD16, CARD16);
-static int KdXVPutStill(ClientPtr, DrawablePtr, XvPortPtr, GCPtr,
+static int KdXVPutStill(DrawablePtr, XvPortPtr, GCPtr,
                         INT16, INT16, CARD16, CARD16,
                         INT16, INT16, CARD16, CARD16);
-static int KdXVGetVideo(ClientPtr, DrawablePtr, XvPortPtr, GCPtr,
+static int KdXVGetVideo(DrawablePtr, XvPortPtr, GCPtr,
                         INT16, INT16, CARD16, CARD16,
                         INT16, INT16, CARD16, CARD16);
-static int KdXVGetStill(ClientPtr, DrawablePtr, XvPortPtr, GCPtr,
+static int KdXVGetStill(DrawablePtr, XvPortPtr, GCPtr,
                         INT16, INT16, CARD16, CARD16,
                         INT16, INT16, CARD16, CARD16);
-static int KdXVStopVideo(ClientPtr, XvPortPtr, DrawablePtr);
-static int KdXVSetPortAttribute(ClientPtr, XvPortPtr, Atom, INT32);
-static int KdXVGetPortAttribute(ClientPtr, XvPortPtr, Atom, INT32 *);
-static int KdXVQueryBestSize(ClientPtr, XvPortPtr, CARD8,
+static int KdXVStopVideo(XvPortPtr, DrawablePtr);
+static int KdXVSetPortAttribute(XvPortPtr, Atom, INT32);
+static int KdXVGetPortAttribute(XvPortPtr, Atom, INT32 *);
+static int KdXVQueryBestSize(XvPortPtr, CARD8,
                              CARD16, CARD16, CARD16, CARD16,
                              unsigned int *, unsigned int *);
-static int KdXVPutImage(ClientPtr, DrawablePtr, XvPortPtr, GCPtr,
+static int KdXVPutImage(DrawablePtr, XvPortPtr, GCPtr,
                         INT16, INT16, CARD16, CARD16,
                         INT16, INT16, CARD16, CARD16,
                         XvImagePtr, unsigned char *, Bool, CARD16, CARD16);
-static int KdXVQueryImageAttributes(ClientPtr, XvPortPtr, XvImagePtr,
+static int KdXVQueryImageAttributes(XvPortPtr, XvImagePtr,
                                     CARD16 *, CARD16 *, int *, int *);
 
 /* ScreenRec fields */
@@ -1028,8 +1028,7 @@ KdXVDisable(ScreenPtr pScreen)
 /**** XvAdaptorRec fields ****/
 
 static int
-KdXVPutVideo(ClientPtr client,
-             DrawablePtr pDraw,
+KdXVPutVideo(DrawablePtr pDraw,
              XvPortPtr pPort,
              GCPtr pGC,
              INT16 vid_x, INT16 vid_y,
@@ -1082,8 +1081,7 @@ KdXVPutVideo(ClientPtr client,
 }
 
 static int
-KdXVPutStill(ClientPtr client,
-             DrawablePtr pDraw,
+KdXVPutStill(DrawablePtr pDraw,
              XvPortPtr pPort,
              GCPtr pGC,
              INT16 vid_x, INT16 vid_y,
@@ -1175,8 +1173,7 @@ KdXVPutStill(ClientPtr client,
 }
 
 static int
-KdXVGetVideo(ClientPtr client,
-             DrawablePtr pDraw,
+KdXVGetVideo(DrawablePtr pDraw,
              XvPortPtr pPort,
              GCPtr pGC,
              INT16 vid_x, INT16 vid_y,
@@ -1229,8 +1226,7 @@ KdXVGetVideo(ClientPtr client,
 }
 
 static int
-KdXVGetStill(ClientPtr client,
-             DrawablePtr pDraw,
+KdXVGetStill(DrawablePtr pDraw,
              XvPortPtr pPort,
              GCPtr pGC,
              INT16 vid_x, INT16 vid_y,
@@ -1292,7 +1288,7 @@ KdXVGetStill(ClientPtr client,
 }
 
 static int
-KdXVStopVideo(ClientPtr client, XvPortPtr pPort, DrawablePtr pDraw)
+KdXVStopVideo(XvPortPtr pPort, DrawablePtr pDraw)
 {
     XvPortRecPrivatePtr portPriv = (XvPortRecPrivatePtr) (pPort->devPriv.ptr);
 
@@ -1318,8 +1314,7 @@ KdXVStopVideo(ClientPtr client, XvPortPtr pPort, DrawablePtr pDraw)
 }
 
 static int
-KdXVSetPortAttribute(ClientPtr client,
-                     XvPortPtr pPort, Atom attribute, INT32 value)
+KdXVSetPortAttribute(XvPortPtr pPort, Atom attribute, INT32 value)
 {
     XvPortRecPrivatePtr portPriv = (XvPortRecPrivatePtr) (pPort->devPriv.ptr);
 
@@ -1329,8 +1324,7 @@ KdXVSetPortAttribute(ClientPtr client,
 }
 
 static int
-KdXVGetPortAttribute(ClientPtr client,
-                     XvPortPtr pPort, Atom attribute, INT32 *p_value)
+KdXVGetPortAttribute(XvPortPtr pPort, Atom attribute, INT32 *p_value)
 {
     XvPortRecPrivatePtr portPriv = (XvPortRecPrivatePtr) (pPort->devPriv.ptr);
 
@@ -1341,8 +1335,7 @@ KdXVGetPortAttribute(ClientPtr client,
 }
 
 static int
-KdXVQueryBestSize(ClientPtr client,
-                  XvPortPtr pPort,
+KdXVQueryBestSize(XvPortPtr pPort,
                   CARD8 motion,
                   CARD16 vid_w, CARD16 vid_h,
                   CARD16 drw_w, CARD16 drw_h,
@@ -1359,8 +1352,7 @@ KdXVQueryBestSize(ClientPtr client,
 }
 
 static int
-KdXVPutImage(ClientPtr client,
-             DrawablePtr pDraw,
+KdXVPutImage(DrawablePtr pDraw,
              XvPortPtr pPort,
              GCPtr pGC,
              INT16 src_x, INT16 src_y,
@@ -1455,8 +1447,7 @@ KdXVPutImage(ClientPtr client,
 }
 
 static int
-KdXVQueryImageAttributes(ClientPtr client,
-                         XvPortPtr pPort,
+KdXVQueryImageAttributes(XvPortPtr pPort,
                          XvImagePtr format,
                          CARD16 *width,
                          CARD16 *height, int *pitches, int *offsets)
diff --git a/hw/xfree86/common/xf86xv.c b/hw/xfree86/common/xf86xv.c
index 141a4ed..d342bde 100644
--- a/hw/xfree86/common/xf86xv.c
+++ b/hw/xfree86/common/xf86xv.c
@@ -56,29 +56,29 @@
 
 /* XvAdaptorRec fields */
 
-static int xf86XVPutVideo(ClientPtr, DrawablePtr, XvPortPtr, GCPtr,
+static int xf86XVPutVideo(DrawablePtr, XvPortPtr, GCPtr,
                           INT16, INT16, CARD16, CARD16,
                           INT16, INT16, CARD16, CARD16);
-static int xf86XVPutStill(ClientPtr, DrawablePtr, XvPortPtr, GCPtr,
+static int xf86XVPutStill(DrawablePtr, XvPortPtr, GCPtr,
                           INT16, INT16, CARD16, CARD16,
                           INT16, INT16, CARD16, CARD16);
-static int xf86XVGetVideo(ClientPtr, DrawablePtr, XvPortPtr, GCPtr,
+static int xf86XVGetVideo(DrawablePtr, XvPortPtr, GCPtr,
                           INT16, INT16, CARD16, CARD16,
                           INT16, INT16, CARD16, CARD16);
-static int xf86XVGetStill(ClientPtr, DrawablePtr, XvPortPtr, GCPtr,
+static int xf86XVGetStill(DrawablePtr, XvPortPtr, GCPtr,
                           INT16, INT16, CARD16, CARD16,
                           INT16, INT16, CARD16, CARD16);
-static int xf86XVStopVideo(ClientPtr, XvPortPtr, DrawablePtr);
-static int xf86XVSetPortAttribute(ClientPtr, XvPortPtr, Atom, INT32);
-static int xf86XVGetPortAttribute(ClientPtr, XvPortPtr, Atom, INT32 *);
-static int xf86XVQueryBestSize(ClientPtr, XvPortPtr, CARD8,
+static int xf86XVStopVideo(XvPortPtr, DrawablePtr);
+static int xf86XVSetPortAttribute(XvPortPtr, Atom, INT32);
+static int xf86XVGetPortAttribute(XvPortPtr, Atom, INT32 *);
+static int xf86XVQueryBestSize(XvPortPtr, CARD8,
                                CARD16, CARD16, CARD16, CARD16,
                                unsigned int *, unsigned int *);
-static int xf86XVPutImage(ClientPtr, DrawablePtr, XvPortPtr, GCPtr,
+static int xf86XVPutImage(DrawablePtr, XvPortPtr, GCPtr,
                           INT16, INT16, CARD16, CARD16,
                           INT16, INT16, CARD16, CARD16,
                           XvImagePtr, unsigned char *, Bool, CARD16, CARD16);
-static int xf86XVQueryImageAttributes(ClientPtr, XvPortPtr, XvImagePtr,
+static int xf86XVQueryImageAttributes(XvPortPtr, XvImagePtr,
                                       CARD16 *, CARD16 *, int *, int *);
 
 /* ScreenRec fields */
@@ -1271,8 +1271,7 @@ xf86XVModeSet(ScrnInfoPtr pScrn)
 /**** XvAdaptorRec fields ****/
 
 static int
-xf86XVPutVideo(ClientPtr client,
-               DrawablePtr pDraw,
+xf86XVPutVideo(DrawablePtr pDraw,
                XvPortPtr pPort,
                GCPtr pGC,
                INT16 vid_x, INT16 vid_y,
@@ -1322,8 +1321,7 @@ xf86XVPutVideo(ClientPtr client,
 }
 
 static int
-xf86XVPutStill(ClientPtr client,
-               DrawablePtr pDraw,
+xf86XVPutStill(DrawablePtr pDraw,
                XvPortPtr pPort,
                GCPtr pGC,
                INT16 vid_x, INT16 vid_y,
@@ -1420,8 +1418,7 @@ xf86XVPutStill(ClientPtr client,
 }
 
 static int
-xf86XVGetVideo(ClientPtr client,
-               DrawablePtr pDraw,
+xf86XVGetVideo(DrawablePtr pDraw,
                XvPortPtr pPort,
                GCPtr pGC,
                INT16 vid_x, INT16 vid_y,
@@ -1471,8 +1468,7 @@ xf86XVGetVideo(ClientPtr client,
 }
 
 static int
-xf86XVGetStill(ClientPtr client,
-               DrawablePtr pDraw,
+xf86XVGetStill(DrawablePtr pDraw,
                XvPortPtr pPort,
                GCPtr pGC,
                INT16 vid_x, INT16 vid_y,
@@ -1531,7 +1527,7 @@ xf86XVGetStill(ClientPtr client,
 }
 
 static int
-xf86XVStopVideo(ClientPtr client, XvPortPtr pPort, DrawablePtr pDraw)
+xf86XVStopVideo(XvPortPtr pPort, DrawablePtr pDraw)
 {
     XvPortRecPrivatePtr portPriv = (XvPortRecPrivatePtr) (pPort->devPriv.ptr);
 
@@ -1555,8 +1551,7 @@ xf86XVStopVideo(ClientPtr client, XvPortPtr pPort, DrawablePtr pDraw)
 }
 
 static int
-xf86XVSetPortAttribute(ClientPtr client,
-                       XvPortPtr pPort, Atom attribute, INT32 value)
+xf86XVSetPortAttribute(XvPortPtr pPort, Atom attribute, INT32 value)
 {
     XvPortRecPrivatePtr portPriv = (XvPortRecPrivatePtr) (pPort->devPriv.ptr);
 
@@ -1566,8 +1561,7 @@ xf86XVSetPortAttribute(ClientPtr client,
 }
 
 static int
-xf86XVGetPortAttribute(ClientPtr client,
-                       XvPortPtr pPort, Atom attribute, INT32 *p_value)
+xf86XVGetPortAttribute(XvPortPtr pPort, Atom attribute, INT32 *p_value)
 {
     XvPortRecPrivatePtr portPriv = (XvPortRecPrivatePtr) (pPort->devPriv.ptr);
 
@@ -1577,8 +1571,7 @@ xf86XVGetPortAttribute(ClientPtr client,
 }
 
 static int
-xf86XVQueryBestSize(ClientPtr client,
-                    XvPortPtr pPort,
+xf86XVQueryBestSize(XvPortPtr pPort,
                     CARD8 motion,
                     CARD16 vid_w, CARD16 vid_h,
                     CARD16 drw_w, CARD16 drw_h,
@@ -1595,8 +1588,7 @@ xf86XVQueryBestSize(ClientPtr client,
 }
 
 static int
-xf86XVPutImage(ClientPtr client,
-               DrawablePtr pDraw,
+xf86XVPutImage(DrawablePtr pDraw,
                XvPortPtr pPort,
                GCPtr pGC,
                INT16 src_x, INT16 src_y,
@@ -1701,8 +1693,7 @@ xf86XVPutImage(ClientPtr client,
 }
 
 static int
-xf86XVQueryImageAttributes(ClientPtr client,
-                           XvPortPtr pPort,
+xf86XVQueryImageAttributes(XvPortPtr pPort,
                            XvImagePtr format,
                            CARD16 *width,
                            CARD16 *height, int *pitches, int *offsets)
commit 850b268e2b9e49445a22e041a356d8ff26ae2147
Author: Eric Anholt <eric at anholt.net>
Date:   Sat Apr 5 10:55:45 2014 +0100

    xv: Remove the no-op AllocatePort/FreePort interfaces.
    
    v2: Fix accidentally squashed-in change for dropping client from the
        arguments, which should have been in the next commit.
    
    Signed-off-by: Eric Anholt <eric at anholt.net>
    Reviewed-by: Keith Packard <keithp at keithp.com> (v2)

diff --git a/Xext/xvdisp.c b/Xext/xvdisp.c
index 71192b3..58c7203 100644
--- a/Xext/xvdisp.c
+++ b/Xext/xvdisp.c
@@ -297,9 +297,6 @@ SWriteListImageFormatsReply(ClientPtr client, xvListImageFormatsReply * rep)
   if ((_c)->swapped) SWriteImageFormatInfo(_c, _d); \
   else WriteToClient(_c, sz_xvImageFormatInfo, _d)
 
-#define _AllocatePort(_i,_p) \
-  ((_p)->id != _i) ? (* (_p)->pAdaptor->ddAllocatePort)(_i,_p,&_p) : Success
-
 static int
 ProcXvQueryExtension(ClientPtr client)
 {
@@ -420,18 +417,12 @@ ProcXvQueryEncodings(ClientPtr client)
     XvPortPtr pPort;
     int ne;
     XvEncodingPtr pe;
-    int status;
 
     REQUEST(xvQueryEncodingsReq);
     REQUEST_SIZE_MATCH(xvQueryEncodingsReq);
 
     VALIDATE_XV_PORT(stuff->port, pPort, DixReadAccess);
 
-    if ((status = _AllocatePort(stuff->port, pPort)) != Success) {
-        client->errorValue = stuff->port;
-        return status;
-    }
-
     rep = (xvQueryEncodingsReply) {
         .type = X_Reply,
         .sequenceNumber = client->sequence,
@@ -483,11 +474,6 @@ ProcXvPutVideo(ClientPtr client)
     VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, DixWriteAccess);
     VALIDATE_XV_PORT(stuff->port, pPort, DixReadAccess);
 
-    if ((status = _AllocatePort(stuff->port, pPort)) != Success) {
-        client->errorValue = stuff->port;
-        return status;
-    }
-
     if (!(pPort->pAdaptor->type & XvInputMask) ||
         !(pPort->pAdaptor->type & XvVideoMask)) {
         client->errorValue = stuff->port;
@@ -518,11 +504,6 @@ ProcXvPutStill(ClientPtr client)
     VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, DixWriteAccess);
     VALIDATE_XV_PORT(stuff->port, pPort, DixReadAccess);
 
-    if ((status = _AllocatePort(stuff->port, pPort)) != Success) {
-        client->errorValue = stuff->port;
-        return status;
-    }
-
     if (!(pPort->pAdaptor->type & XvInputMask) ||
         !(pPort->pAdaptor->type & XvStillMask)) {
         client->errorValue = stuff->port;
@@ -553,11 +534,6 @@ ProcXvGetVideo(ClientPtr client)
     VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, DixReadAccess);
     VALIDATE_XV_PORT(stuff->port, pPort, DixReadAccess);
 
-    if ((status = _AllocatePort(stuff->port, pPort)) != Success) {
-        client->errorValue = stuff->port;
-        return status;
-    }
-
     if (!(pPort->pAdaptor->type & XvOutputMask) ||
         !(pPort->pAdaptor->type & XvVideoMask)) {
         client->errorValue = stuff->port;
@@ -588,11 +564,6 @@ ProcXvGetStill(ClientPtr client)
     VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, DixReadAccess);
     VALIDATE_XV_PORT(stuff->port, pPort, DixReadAccess);
 
-    if ((status = _AllocatePort(stuff->port, pPort)) != Success) {
-        client->errorValue = stuff->port;
-        return status;
-    }
-
     if (!(pPort->pAdaptor->type & XvOutputMask) ||
         !(pPort->pAdaptor->type & XvStillMask)) {
         client->errorValue = stuff->port;
@@ -629,7 +600,6 @@ ProcXvSelectVideoNotify(ClientPtr client)
 static int
 ProcXvSelectPortNotify(ClientPtr client)
 {
-    int status;
     XvPortPtr pPort;
 
     REQUEST(xvSelectPortNotifyReq);
@@ -637,11 +607,6 @@ ProcXvSelectPortNotify(ClientPtr client)
 
     VALIDATE_XV_PORT(stuff->port, pPort, DixReadAccess);
 
-    if ((status = _AllocatePort(stuff->port, pPort)) != Success) {
-        client->errorValue = stuff->port;
-        return status;
-    }
-
     return XvdiSelectPortNotify(client, pPort, stuff->onoff);
 }
 
@@ -657,11 +622,6 @@ ProcXvGrabPort(ClientPtr client)
 
     VALIDATE_XV_PORT(stuff->port, pPort, DixReadAccess);
 
-    if ((status = _AllocatePort(stuff->port, pPort)) != Success) {
-        client->errorValue = stuff->port;
-        return status;
-    }
-
     status = XvdiGrabPort(client, pPort, stuff->time, &result);
 
     if (status != Success) {
@@ -682,7 +642,6 @@ ProcXvGrabPort(ClientPtr client)
 static int
 ProcXvUngrabPort(ClientPtr client)
 {
-    int status;
     XvPortPtr pPort;
 
     REQUEST(xvGrabPortReq);
@@ -690,18 +649,13 @@ ProcXvUngrabPort(ClientPtr client)
 
     VALIDATE_XV_PORT(stuff->port, pPort, DixReadAccess);
 
-    if ((status = _AllocatePort(stuff->port, pPort)) != Success) {
-        client->errorValue = stuff->port;
-        return status;
-    }
-
     return XvdiUngrabPort(client, pPort, stuff->time);
 }
 
 static int
 ProcXvStopVideo(ClientPtr client)
 {
-    int status, ret;
+    int ret;
     DrawablePtr pDraw;
     XvPortPtr pPort;
 
@@ -710,11 +664,6 @@ ProcXvStopVideo(ClientPtr client)
 
     VALIDATE_XV_PORT(stuff->port, pPort, DixReadAccess);
 
-    if ((status = _AllocatePort(stuff->port, pPort)) != Success) {
-        client->errorValue = stuff->port;
-        return status;
-    }
-
     ret = dixLookupDrawable(&pDraw, stuff->drawable, client, 0, DixWriteAccess);
     if (ret != Success)
         return ret;
@@ -733,11 +682,6 @@ ProcXvSetPortAttribute(ClientPtr client)
 
     VALIDATE_XV_PORT(stuff->port, pPort, DixSetAttrAccess);
 
-    if ((status = _AllocatePort(stuff->port, pPort)) != Success) {
-        client->errorValue = stuff->port;
-        return status;
-    }
-
     if (!ValidAtom(stuff->attribute)) {
         client->errorValue = stuff->attribute;
         return BadAtom;
@@ -767,11 +711,6 @@ ProcXvGetPortAttribute(ClientPtr client)
 
     VALIDATE_XV_PORT(stuff->port, pPort, DixGetAttrAccess);
 
-    if ((status = _AllocatePort(stuff->port, pPort)) != Success) {
-        client->errorValue = stuff->port;
-        return status;
-    }
-
     if (!ValidAtom(stuff->attribute)) {
         client->errorValue = stuff->attribute;
         return BadAtom;
@@ -798,7 +737,6 @@ ProcXvGetPortAttribute(ClientPtr client)
 static int
 ProcXvQueryBestSize(ClientPtr client)
 {
-    int status;
     unsigned int actual_width, actual_height;
     XvPortPtr pPort;
     xvQueryBestSizeReply rep;
@@ -808,11 +746,6 @@ ProcXvQueryBestSize(ClientPtr client)
 
     VALIDATE_XV_PORT(stuff->port, pPort, DixReadAccess);
 
-    if ((status = _AllocatePort(stuff->port, pPort)) != Success) {
-        client->errorValue = stuff->port;
-        return status;
-    }
-
     (*pPort->pAdaptor->ddQueryBestSize) (client, pPort, stuff->motion,
                                          stuff->vid_w, stuff->vid_h,
                                          stuff->drw_w, stuff->drw_h,
@@ -834,7 +767,7 @@ ProcXvQueryBestSize(ClientPtr client)
 static int
 ProcXvQueryPortAttributes(ClientPtr client)
 {
-    int status, size, i;
+    int size, i;
     XvPortPtr pPort;
     XvAttributePtr pAtt;
     xvQueryPortAttributesReply rep;
@@ -845,11 +778,6 @@ ProcXvQueryPortAttributes(ClientPtr client)
 
     VALIDATE_XV_PORT(stuff->port, pPort, DixGetAttrAccess);
 
-    if ((status = _AllocatePort(stuff->port, pPort)) != Success) {
-        client->errorValue = stuff->port;
-        return status;
-    }
-
     rep = (xvQueryPortAttributesReply) {
         .type = X_Reply,
         .sequenceNumber = client->sequence,
@@ -900,11 +828,6 @@ ProcXvPutImage(ClientPtr client)
     VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, DixWriteAccess);
     VALIDATE_XV_PORT(stuff->port, pPort, DixReadAccess);
 
-    if ((status = _AllocatePort(stuff->port, pPort)) != Success) {
-        client->errorValue = stuff->port;
-        return status;
-    }
-
     if (!(pPort->pAdaptor->type & XvImageMask) ||
         !(pPort->pAdaptor->type & XvInputMask)) {
         client->errorValue = stuff->port;
@@ -966,11 +889,6 @@ ProcXvShmPutImage(ClientPtr client)
     VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, DixWriteAccess);
     VALIDATE_XV_PORT(stuff->port, pPort, DixReadAccess);
 
-    if ((status = _AllocatePort(stuff->port, pPort)) != Success) {
-        client->errorValue = stuff->port;
-        return status;
-    }
-
     if (!(pPort->pAdaptor->type & XvImageMask) ||
         !(pPort->pAdaptor->type & XvInputMask)) {
         client->errorValue = stuff->port;
diff --git a/Xext/xvdix.h b/Xext/xvdix.h
index 828f67c..9bbfcde 100644
--- a/Xext/xvdix.h
+++ b/Xext/xvdix.h
@@ -157,9 +157,6 @@ typedef struct {
     int nPorts;
     struct _XvPortRec *pPorts;
     ScreenPtr pScreen;
-    int (*ddAllocatePort) (unsigned long, struct _XvPortRec *,
-                           struct _XvPortRec **);
-    int (*ddFreePort) (struct _XvPortRec *);
     int (*ddPutVideo) (ClientPtr, DrawablePtr, struct _XvPortRec *, GCPtr,
                        INT16, INT16, CARD16, CARD16,
                        INT16, INT16, CARD16, CARD16);
diff --git a/Xext/xvmain.c b/Xext/xvmain.c
index 389be0d..b8294fe 100644
--- a/Xext/xvmain.c
+++ b/Xext/xvmain.c
@@ -426,7 +426,7 @@ XvDestroyWindow(WindowPtr pWin)
 static int
 XvdiDestroyPort(void *pPort, XID id)
 {
-    return (*((XvPortPtr) pPort)->pAdaptor->ddFreePort) (pPort);
+    return Success;
 }
 
 static int
diff --git a/hw/kdrive/src/kxv.c b/hw/kdrive/src/kxv.c
index 0b4335a..f9c18d6 100644
--- a/hw/kdrive/src/kxv.c
+++ b/hw/kdrive/src/kxv.c
@@ -58,8 +58,6 @@ of the copyright holder.
 
 /* XvAdaptorRec fields */
 
-static int KdXVAllocatePort(unsigned long, XvPortPtr, XvPortPtr *);
-static int KdXVFreePort(XvPortPtr);
 static int KdXVPutVideo(ClientPtr, DrawablePtr, XvPortPtr, GCPtr,
                         INT16, INT16, CARD16, CARD16,
                         INT16, INT16, CARD16, CARD16);
@@ -260,8 +258,6 @@ KdXVInitAdaptors(ScreenPtr pScreen, KdVideoAdaptorPtr infoPtr, int number)
             continue;
 
         pa->pScreen = pScreen;
-        pa->ddAllocatePort = KdXVAllocatePort;
-        pa->ddFreePort = KdXVFreePort;
         pa->ddPutVideo = KdXVPutVideo;
         pa->ddPutStill = KdXVPutStill;
         pa->ddGetVideo = KdXVGetVideo;
@@ -1032,19 +1028,6 @@ KdXVDisable(ScreenPtr pScreen)
 /**** XvAdaptorRec fields ****/
 
 static int
-KdXVAllocatePort(unsigned long port, XvPortPtr pPort, XvPortPtr * ppPort)
-{
-    *ppPort = pPort;
-    return Success;
-}
-
-static int
-KdXVFreePort(XvPortPtr pPort)
-{
-    return Success;
-}
-
-static int
 KdXVPutVideo(ClientPtr client,
              DrawablePtr pDraw,
              XvPortPtr pPort,
diff --git a/hw/xfree86/common/xf86xv.c b/hw/xfree86/common/xf86xv.c
index 1c250b3..141a4ed 100644
--- a/hw/xfree86/common/xf86xv.c
+++ b/hw/xfree86/common/xf86xv.c
@@ -56,8 +56,6 @@
 
 /* XvAdaptorRec fields */
 
-static int xf86XVAllocatePort(unsigned long, XvPortPtr, XvPortPtr *);
-static int xf86XVFreePort(XvPortPtr);
 static int xf86XVPutVideo(ClientPtr, DrawablePtr, XvPortPtr, GCPtr,
                           INT16, INT16, CARD16, CARD16,
                           INT16, INT16, CARD16, CARD16);
@@ -369,8 +367,6 @@ xf86XVInitAdaptors(ScreenPtr pScreen, XF86VideoAdaptorPtr * infoPtr, int number)
             continue;
 
         pa->pScreen = pScreen;
-        pa->ddAllocatePort = xf86XVAllocatePort;
-        pa->ddFreePort = xf86XVFreePort;
         pa->ddPutVideo = xf86XVPutVideo;
         pa->ddPutStill = xf86XVPutStill;
         pa->ddGetVideo = xf86XVGetVideo;
@@ -1275,19 +1271,6 @@ xf86XVModeSet(ScrnInfoPtr pScrn)
 /**** XvAdaptorRec fields ****/
 
 static int
-xf86XVAllocatePort(unsigned long port, XvPortPtr pPort, XvPortPtr * ppPort)
-{
-    *ppPort = pPort;
-    return Success;
-}
-
-static int
-xf86XVFreePort(XvPortPtr pPort)
-{
-    return Success;
-}
-
-static int
 xf86XVPutVideo(ClientPtr client,
                DrawablePtr pDraw,
                XvPortPtr pPort,
commit 41d4a626c6ceb15d5b008dca00c6f5032ddd9556
Author: Eric Anholt <eric at anholt.net>
Date:   Sat Apr 5 10:35:52 2014 +0100

    kdrive: Don't bother explicitly clearing new window privates to NULL.
    
    Privates are initially cleared to zero by dixInitPrivates().
    
    Signed-off-by: Eric Anholt <eric at anholt.net>
    Reviewed-by: Keith Packard <keithp at keithp.com>

diff --git a/hw/kdrive/src/kxv.c b/hw/kdrive/src/kxv.c
index c916af4..0b4335a 100644
--- a/hw/kdrive/src/kxv.c
+++ b/hw/kdrive/src/kxv.c
@@ -87,7 +87,6 @@ static int KdXVQueryImageAttributes(ClientPtr, XvPortPtr, XvImagePtr,
 
 /* ScreenRec fields */
 
-static Bool KdXVCreateWindow(WindowPtr pWin);
 static Bool KdXVDestroyWindow(WindowPtr pWin);
 static void KdXVWindowExposures(WindowPtr pWin, RegionPtr r1, RegionPtr r2);
 static void KdXVClipNotify(WindowPtr pWin, int dx, int dy);
@@ -155,7 +154,6 @@ KdXVScreenInit(ScreenPtr pScreen, KdVideoAdaptorPtr adaptors, int num)
     if (!ScreenPriv)
         return FALSE;
 
-    ScreenPriv->CreateWindow = pScreen->CreateWindow;
     ScreenPriv->DestroyWindow = pScreen->DestroyWindow;
     ScreenPriv->WindowExposures = pScreen->WindowExposures;
     ScreenPriv->ClipNotify = pScreen->ClipNotify;
@@ -163,7 +161,6 @@ KdXVScreenInit(ScreenPtr pScreen, KdVideoAdaptorPtr adaptors, int num)
 
 /*   fprintf(stderr,"XV: Wrapping screen funcs\n"); */
 
-    pScreen->CreateWindow = KdXVCreateWindow;
     pScreen->DestroyWindow = KdXVDestroyWindow;
     pScreen->WindowExposures = KdXVWindowExposures;
     pScreen->ClipNotify = KdXVClipNotify;
@@ -797,23 +794,6 @@ KdXVRemovePortFromWindow(WindowPtr pWin, XvPortRecPrivatePtr portPriv)
 /****  ScreenRec fields ****/
 
 static Bool
-KdXVCreateWindow(WindowPtr pWin)
-{
-    ScreenPtr pScreen = pWin->drawable.pScreen;
-    KdXVScreenPtr ScreenPriv = GET_KDXV_SCREEN(pScreen);
-    int ret;
-
-    pScreen->CreateWindow = ScreenPriv->CreateWindow;
-    ret = (*pScreen->CreateWindow) (pWin);
-    pScreen->CreateWindow = KdXVCreateWindow;
-
-    if (ret)
-        dixSetPrivate(&pWin->devPrivates, KdXVWindowKey, NULL);
-
-    return ret;
-}
-
-static Bool
 KdXVDestroyWindow(WindowPtr pWin)
 {
     ScreenPtr pScreen = pWin->drawable.pScreen;
@@ -977,7 +957,6 @@ KdXVCloseScreen(ScreenPtr pScreen)
     if (!ScreenPriv)
         return TRUE;
 
-    pScreen->CreateWindow = ScreenPriv->CreateWindow;
     pScreen->DestroyWindow = ScreenPriv->DestroyWindow;
     pScreen->WindowExposures = ScreenPriv->WindowExposures;
     pScreen->ClipNotify = ScreenPriv->ClipNotify;
diff --git a/hw/kdrive/src/kxv.h b/hw/kdrive/src/kxv.h
index 190b326..4eb4054 100644
--- a/hw/kdrive/src/kxv.h
+++ b/hw/kdrive/src/kxv.h
@@ -181,7 +181,6 @@ void KdXVDisable(ScreenPtr);
 /*** These are DDX layer privates ***/
 
 typedef struct {
-    CreateWindowProcPtr CreateWindow;
     DestroyWindowProcPtr DestroyWindow;
     ClipNotifyProcPtr ClipNotify;
     WindowExposuresProcPtr WindowExposures;
commit e311318b35ef4f82996c6e277137569005893b44
Author: Eric Anholt <eric at anholt.net>
Date:   Sat Apr 5 09:11:03 2014 +0100

    kdrive: Remove dead KXVPaintRegion().
    
    It's been unused since mach64 was deleted, and now there's a helper in
    core XV.
    
    Signed-off-by: Eric Anholt <eric at anholt.net>
    Reviewed-by: Keith Packard <keithp at keithp.com>

diff --git a/hw/kdrive/src/kxv.c b/hw/kdrive/src/kxv.c
index 47e1357..c916af4 100644
--- a/hw/kdrive/src/kxv.c
+++ b/hw/kdrive/src/kxv.c
@@ -1650,44 +1650,3 @@ KdXVCopyPlanarData(KdScreenInfo * screen, CARD8 *src, CARD8 *dst, int randr,
         }
     }
 }
-
-void
-KXVPaintRegion(DrawablePtr pDraw, RegionPtr pRgn, Pixel fg)
-{
-    GCPtr pGC;
-    ChangeGCVal val[2];
-    xRectangle *rects, *r;
-    BoxPtr pBox = RegionRects(pRgn);
-    int nBox = RegionNumRects(pRgn);
-
-    rects = malloc(nBox * sizeof(xRectangle));
-    if (!rects)
-        goto bail0;
-    r = rects;
-    while (nBox--) {
-        r->x = pBox->x1 - pDraw->x;
-        r->y = pBox->y1 - pDraw->y;
-        r->width = pBox->x2 - pBox->x1;
-        r->height = pBox->y2 - pBox->y1;
-        r++;
-        pBox++;
-    }
-
-    pGC = GetScratchGC(pDraw->depth, pDraw->pScreen);
-    if (!pGC)
-        goto bail1;
-
-    val[0].val = fg;
-    val[1].val = IncludeInferiors;
-    ChangeGC(NullClient, pGC, GCForeground | GCSubwindowMode, val);
-
-    ValidateGC(pDraw, pGC);
-
-    (*pGC->ops->PolyFillRect) (pDraw, pGC, RegionNumRects(pRgn), rects);
-
-    FreeScratchGC(pGC);
- bail1:
-    free(rects);
- bail0:
-    ;
-}
diff --git a/hw/kdrive/src/kxv.h b/hw/kdrive/src/kxv.h
index 451d3fa..190b326 100644
--- a/hw/kdrive/src/kxv.h
+++ b/hw/kdrive/src/kxv.h
@@ -170,9 +170,6 @@ KdXVCopyPlanarData(KdScreenInfo * screen, CARD8 *src, CARD8 *dst, int randr,
                    int srcH, int height, int top, int left, int h, int w,
                    int id);
 
-void
- KXVPaintRegion(DrawablePtr pDraw, RegionPtr pRgn, Pixel fg);
-
 KdVideoAdaptorPtr KdXVAllocateVideoAdaptorRec(KdScreenInfo * screen);
 
 void KdXVFreeVideoAdaptorRec(KdVideoAdaptorPtr ptr);
commit 7eac142fb6e8abb011ce59feda3c2d7b04f2b225
Author: Eric Anholt <eric at anholt.net>
Date:   Sat Apr 5 09:09:17 2014 +0100

    xv: Fix malloc-failure cases in the fill color key helper.
    
    Signed-off-by: Eric Anholt <eric at anholt.net>
    Reviewed-by: Alex Deucher <alexander.deucher at amd.com>

diff --git a/Xext/xvmain.c b/Xext/xvmain.c
index d932dfd..389be0d 100644
--- a/Xext/xvmain.c
+++ b/Xext/xvmain.c
@@ -1094,22 +1094,26 @@ XvFillColorKey(DrawablePtr pDraw, CARD32 key, RegionPtr region)
     GCPtr gc;
 
     gc = GetScratchGC(pDraw->depth, pScreen);
+    if (!gc)
+        return;
+
     pval[0].val = key;
     pval[1].val = IncludeInferiors;
     (void) ChangeGC(NullClient, gc, GCForeground | GCSubwindowMode, pval);
     ValidateGC(pDraw, gc);
 
     rects = malloc(nbox * sizeof(xRectangle));
+    if (rects) {
+        for (i = 0; i < nbox; i++, pbox++) {
+            rects[i].x = pbox->x1 - pDraw->x;
+            rects[i].y = pbox->y1 - pDraw->y;
+            rects[i].width = pbox->x2 - pbox->x1;
+            rects[i].height = pbox->y2 - pbox->y1;
+        }
 
-    for (i = 0; i < nbox; i++, pbox++) {
-        rects[i].x = pbox->x1 - pDraw->x;
-        rects[i].y = pbox->y1 - pDraw->y;
-        rects[i].width = pbox->x2 - pbox->x1;
-        rects[i].height = pbox->y2 - pbox->y1;
-    }
-
-    (*gc->ops->PolyFillRect) (pDraw, gc, nbox, rects);
+        (*gc->ops->PolyFillRect) (pDraw, gc, nbox, rects);
 
-    free(rects);
+        free(rects);
+    }
     FreeScratchGC(gc);
 }
commit ea3f3b0786d58b2ba6a9bbf0a32e734670f54b73
Author: Eric Anholt <eric at anholt.net>
Date:   Sat Apr 5 09:07:18 2014 +0100

    xv: Move xf86 XV color key helper to core.
    
    Color key overlay implementations want to reuse this code, and XF86's
    had bugs (to be fixed in the next commit).
    
    Signed-off-by: Eric Anholt <eric at anholt.net>
    Reviewed-by: Keith Packard <keithp at keithp.com>

diff --git a/Xext/xvdix.h b/Xext/xvdix.h
index 534e7d3..828f67c 100644
--- a/Xext/xvdix.h
+++ b/Xext/xvdix.h
@@ -233,6 +233,8 @@ extern _X_EXPORT int XvScreenInit(ScreenPtr);
 extern _X_EXPORT DevPrivateKey XvGetScreenKey(void);
 extern _X_EXPORT unsigned long XvGetRTPort(void);
 extern _X_EXPORT void XvFreeAdaptor(XvAdaptorPtr pAdaptor);
+extern void _X_EXPORT XvFillColorKey(DrawablePtr pDraw, CARD32 key,
+                                     RegionPtr region);
 extern _X_EXPORT int XvdiSendPortNotify(XvPortPtr, Atom, INT32);
 
 extern _X_EXPORT int XvdiPutVideo(ClientPtr, DrawablePtr, XvPortPtr, GCPtr,
diff --git a/Xext/xvmain.c b/Xext/xvmain.c
index 4a439e3..d932dfd 100644
--- a/Xext/xvmain.c
+++ b/Xext/xvmain.c
@@ -1082,3 +1082,34 @@ XvFreeAdaptor(XvAdaptorPtr pAdaptor)
     free(pAdaptor->devPriv.ptr);
     pAdaptor->devPriv.ptr = NULL;
 }
+
+void
+XvFillColorKey(DrawablePtr pDraw, CARD32 key, RegionPtr region)
+{
+    ScreenPtr pScreen = pDraw->pScreen;
+    ChangeGCVal pval[2];
+    BoxPtr pbox = RegionRects(region);
+    int i, nbox = RegionNumRects(region);
+    xRectangle *rects;
+    GCPtr gc;
+
+    gc = GetScratchGC(pDraw->depth, pScreen);
+    pval[0].val = key;
+    pval[1].val = IncludeInferiors;
+    (void) ChangeGC(NullClient, gc, GCForeground | GCSubwindowMode, pval);
+    ValidateGC(pDraw, gc);
+
+    rects = malloc(nbox * sizeof(xRectangle));
+
+    for (i = 0; i < nbox; i++, pbox++) {
+        rects[i].x = pbox->x1 - pDraw->x;
+        rects[i].y = pbox->y1 - pDraw->y;
+        rects[i].width = pbox->x2 - pbox->x1;
+        rects[i].height = pbox->y2 - pbox->y1;
+    }
+
+    (*gc->ops->PolyFillRect) (pDraw, gc, nbox, rects);
+
+    free(rects);
+    FreeScratchGC(gc);
+}
diff --git a/hw/xfree86/common/xf86xv.c b/hw/xfree86/common/xf86xv.c
index 3e31046..1c250b3 100644
--- a/hw/xfree86/common/xf86xv.c
+++ b/hw/xfree86/common/xf86xv.c
@@ -1736,34 +1736,11 @@ void
 xf86XVFillKeyHelperDrawable(DrawablePtr pDraw, CARD32 key, RegionPtr fillboxes)
 {
     ScreenPtr pScreen = pDraw->pScreen;
-    ChangeGCVal pval[2];
-    BoxPtr pbox = RegionRects(fillboxes);
-    int i, nbox = RegionNumRects(fillboxes);
-    xRectangle *rects;
-    GCPtr gc;
 
     if (!xf86ScreenToScrn(pScreen)->vtSema)
         return;
 
-    gc = GetScratchGC(pDraw->depth, pScreen);
-    pval[0].val = key;
-    pval[1].val = IncludeInferiors;
-    (void) ChangeGC(NullClient, gc, GCForeground | GCSubwindowMode, pval);
-    ValidateGC(pDraw, gc);
-
-    rects = malloc(nbox * sizeof(xRectangle));
-
-    for (i = 0; i < nbox; i++, pbox++) {
-        rects[i].x = pbox->x1 - pDraw->x;
-        rects[i].y = pbox->y1 - pDraw->y;
-        rects[i].width = pbox->x2 - pbox->x1;
-        rects[i].height = pbox->y2 - pbox->y1;
-    }
-
-    (*gc->ops->PolyFillRect) (pDraw, gc, nbox, rects);
-
-    free(rects);
-    FreeScratchGC(gc);
+    XvFillColorKey(pDraw, key, fillboxes);
 }
 
 void
commit b01cfe5f23766b9c13ed6bd889263d5d7a8a351d
Author: Eric Anholt <eric at anholt.net>
Date:   Fri Apr 4 22:58:37 2014 +0100

    xv: Move CloseScreen setup from a DIX hook to normal wrapping.
    
    Signed-off-by: Eric Anholt <eric at anholt.net>
    Reviewed-by: Keith Packard <keithp at keithp.com>

diff --git a/Xext/xvdix.h b/Xext/xvdix.h
index b61659c..534e7d3 100644
--- a/Xext/xvdix.h
+++ b/Xext/xvdix.h
@@ -213,7 +213,6 @@ typedef struct {
     DestroyWindowProcPtr DestroyWindow;
     DestroyPixmapProcPtr DestroyPixmap;
     CloseScreenProcPtr CloseScreen;
-    Bool (*ddCloseScreen) (ScreenPtr);
 } XvScreenRec, *XvScreenPtr;
 
 #define SCREEN_PROLOGUE(pScreen, field) ((pScreen)->field = ((XvScreenPtr) \
diff --git a/Xext/xvmain.c b/Xext/xvmain.c
index 2046b9d..4a439e3 100644
--- a/Xext/xvmain.c
+++ b/Xext/xvmain.c
@@ -302,8 +302,6 @@ XvCloseScreen(ScreenPtr pScreen)
     pScreen->DestroyWindow = pxvs->DestroyWindow;
     pScreen->CloseScreen = pxvs->CloseScreen;
 
-    (*pxvs->ddCloseScreen) (pScreen);
-
     free(pxvs);
 
     dixSetPrivate(&pScreen->devPrivates, XvScreenKey, NULL);
diff --git a/hw/kdrive/src/kxv.c b/hw/kdrive/src/kxv.c
index ad51cf9..47e1357 100644
--- a/hw/kdrive/src/kxv.c
+++ b/hw/kdrive/src/kxv.c
@@ -56,10 +56,6 @@ of the copyright holder.
 #include "kxv.h"
 #include "fourcc.h"
 
-/* XvScreenRec fields */
-
-static Bool KdXVCloseScreen(ScreenPtr);
-
 /* XvAdaptorRec fields */
 
 static int KdXVAllocatePort(unsigned long, XvPortPtr, XvPortPtr *);
@@ -95,6 +91,7 @@ static Bool KdXVCreateWindow(WindowPtr pWin);
 static Bool KdXVDestroyWindow(WindowPtr pWin);
 static void KdXVWindowExposures(WindowPtr pWin, RegionPtr r1, RegionPtr r2);
 static void KdXVClipNotify(WindowPtr pWin, int dx, int dy);
+static Bool KdXVCloseScreen(ScreenPtr);
 
 /* misc */
 static Bool KdXVInitAdaptors(ScreenPtr, KdVideoAdaptorPtr, int);
@@ -132,7 +129,6 @@ Bool
 KdXVScreenInit(ScreenPtr pScreen, KdVideoAdaptorPtr adaptors, int num)
 {
     KdXVScreenPtr ScreenPriv;
-    XvScreenPtr pxvs;
 
 /*   fprintf(stderr,"KdXVScreenInit initializing %d adaptors\n",num); */
 
@@ -153,13 +149,6 @@ KdXVScreenInit(ScreenPtr pScreen, KdVideoAdaptorPtr adaptors, int num)
     KdXvScreenKey = XvGetScreenKey();
     PortResource = XvGetRTPort();
 
-    pxvs = GET_XV_SCREEN(pScreen);
-
-    /* Anyone initializing the Xv layer must provide this.
-       The Xv di layer calls it without even checking if it exists! */
-
-    pxvs->ddCloseScreen = KdXVCloseScreen;
-
     ScreenPriv = malloc(sizeof(KdXVScreenRec));
     dixSetPrivate(&pScreen->devPrivates, &KdXVScreenPrivateKey, ScreenPriv);
 
@@ -170,6 +159,7 @@ KdXVScreenInit(ScreenPtr pScreen, KdVideoAdaptorPtr adaptors, int num)
     ScreenPriv->DestroyWindow = pScreen->DestroyWindow;
     ScreenPriv->WindowExposures = pScreen->WindowExposures;
     ScreenPriv->ClipNotify = pScreen->ClipNotify;
+    ScreenPriv->CloseScreen = pScreen->CloseScreen;
 
 /*   fprintf(stderr,"XV: Wrapping screen funcs\n"); */
 
@@ -177,6 +167,7 @@ KdXVScreenInit(ScreenPtr pScreen, KdVideoAdaptorPtr adaptors, int num)
     pScreen->DestroyWindow = KdXVDestroyWindow;
     pScreen->WindowExposures = KdXVWindowExposures;
     pScreen->ClipNotify = KdXVClipNotify;
+    pScreen->CloseScreen = KdXVCloseScreen;
 
     if (!KdXVInitAdaptors(pScreen, adaptors, num))
         return FALSE;
@@ -990,6 +981,7 @@ KdXVCloseScreen(ScreenPtr pScreen)
     pScreen->DestroyWindow = ScreenPriv->DestroyWindow;
     pScreen->WindowExposures = ScreenPriv->WindowExposures;
     pScreen->ClipNotify = ScreenPriv->ClipNotify;
+    pScreen->CloseScreen = ScreenPriv->CloseScreen;
 
 /*   fprintf(stderr,"XV: Unwrapping screen funcs\n"); */
 
@@ -1000,7 +992,7 @@ KdXVCloseScreen(ScreenPtr pScreen)
     free(pxvs->pAdaptors);
     free(ScreenPriv);
 
-    return TRUE;
+    return pScreen->CloseScreen(pScreen);
 }
 
 static Bool
diff --git a/hw/kdrive/src/kxv.h b/hw/kdrive/src/kxv.h
index fe467a9..451d3fa 100644
--- a/hw/kdrive/src/kxv.h
+++ b/hw/kdrive/src/kxv.h
@@ -188,6 +188,7 @@ typedef struct {
     DestroyWindowProcPtr DestroyWindow;
     ClipNotifyProcPtr ClipNotify;
     WindowExposuresProcPtr WindowExposures;
+    CloseScreenProcPtr CloseScreen;
 } KdXVScreenRec, *KdXVScreenPtr;
 
 typedef struct {
diff --git a/hw/xfree86/common/xf86xv.c b/hw/xfree86/common/xf86xv.c
index 0f3b09b..3e31046 100644
--- a/hw/xfree86/common/xf86xv.c
+++ b/hw/xfree86/common/xf86xv.c
@@ -54,10 +54,6 @@
 
 #include "xf86xvpriv.h"
 
-/* XvScreenRec fields */
-
-static Bool xf86XVCloseScreen(ScreenPtr);
-
 /* XvAdaptorRec fields */
 
 static int xf86XVAllocatePort(unsigned long, XvPortPtr, XvPortPtr *);
@@ -94,6 +90,7 @@ static void xf86XVWindowExposures(WindowPtr pWin, RegionPtr r1, RegionPtr r2);
 static void xf86XVPostValidateTree(WindowPtr pWin, WindowPtr pLayerWin,
                                    VTKind kind);
 static void xf86XVClipNotify(WindowPtr pWin, int dx, int dy);
+static Bool xf86XVCloseScreen(ScreenPtr);
 
 #define PostValidateTreeUndefined ((PostValidateTreeProcPtr)-1)
 
@@ -234,7 +231,6 @@ xf86XVScreenInit(ScreenPtr pScreen, XF86VideoAdaptorPtr * adaptors, int num)
 {
     ScrnInfoPtr pScrn;
     XF86XVScreenPtr ScreenPriv;
-    XvScreenPtr pxvs;
 
     if (num <= 0 || noXvExtension)
         return FALSE;
@@ -251,13 +247,6 @@ xf86XVScreenInit(ScreenPtr pScreen, XF86VideoAdaptorPtr * adaptors, int num)
 
     PortResource = XvGetRTPort();
 
-    pxvs = GET_XV_SCREEN(pScreen);
-
-    /* Anyone initializing the Xv layer must provide this.
-       The Xv di layer calls it without even checking if it exists! */
-
-    pxvs->ddCloseScreen = xf86XVCloseScreen;
-
     ScreenPriv = malloc(sizeof(XF86XVScreenRec));
     dixSetPrivate(&pScreen->devPrivates, &XF86XVScreenPrivateKey, ScreenPriv);
 
@@ -270,6 +259,7 @@ xf86XVScreenInit(ScreenPtr pScreen, XF86VideoAdaptorPtr * adaptors, int num)
     ScreenPriv->WindowExposures = pScreen->WindowExposures;
     ScreenPriv->PostValidateTree = PostValidateTreeUndefined;
     ScreenPriv->ClipNotify = pScreen->ClipNotify;
+    ScreenPriv->CloseScreen = pScreen->CloseScreen;
     ScreenPriv->EnterVT = pScrn->EnterVT;
     ScreenPriv->LeaveVT = pScrn->LeaveVT;
     ScreenPriv->AdjustFrame = pScrn->AdjustFrame;
@@ -278,6 +268,7 @@ xf86XVScreenInit(ScreenPtr pScreen, XF86VideoAdaptorPtr * adaptors, int num)
     pScreen->DestroyWindow = xf86XVDestroyWindow;
     pScreen->WindowExposures = xf86XVWindowExposures;
     pScreen->ClipNotify = xf86XVClipNotify;
+    pScreen->CloseScreen = xf86XVCloseScreen;
     pScrn->EnterVT = xf86XVEnterVT;
     pScrn->LeaveVT = xf86XVLeaveVT;
     if (pScrn->AdjustFrame)
@@ -1168,6 +1159,7 @@ xf86XVCloseScreen(ScreenPtr pScreen)
     pScreen->DestroyWindow = ScreenPriv->DestroyWindow;
     pScreen->WindowExposures = ScreenPriv->WindowExposures;
     pScreen->ClipNotify = ScreenPriv->ClipNotify;
+    pScreen->CloseScreen = ScreenPriv->CloseScreen;
 
     pScrn->EnterVT = ScreenPriv->EnterVT;
     pScrn->LeaveVT = ScreenPriv->LeaveVT;
@@ -1180,7 +1172,8 @@ xf86XVCloseScreen(ScreenPtr pScreen)
 
     free(pxvs->pAdaptors);
     free(ScreenPriv);
-    return TRUE;
+
+    return pScreen->CloseScreen(pScreen);
 }
 
 /**** ScrnInfoRec fields ****/
diff --git a/hw/xfree86/common/xf86xvpriv.h b/hw/xfree86/common/xf86xvpriv.h
index e95f959..c0dff16 100644
--- a/hw/xfree86/common/xf86xvpriv.h
+++ b/hw/xfree86/common/xf86xvpriv.h
@@ -45,6 +45,7 @@ typedef struct {
     Bool (*EnterVT) (ScrnInfoPtr);
     void (*LeaveVT) (ScrnInfoPtr);
     xf86ModeSetProc *ModeSet;
+    CloseScreenProcPtr CloseScreen;
 } XF86XVScreenRec, *XF86XVScreenPtr;
 
 typedef struct {
commit 6a71ee79aabe6b611cae443a49786824a0322313
Author: Eric Anholt <eric at anholt.net>
Date:   Fri Apr 4 18:02:14 2014 +0100

    xv: Drop unused XvdiVideoStopped().
    
    Signed-off-by: Eric Anholt <eric at anholt.net>
    Reviewed-by: Keith Packard <keithp at keithp.com>

diff --git a/Xext/xvdix.h b/Xext/xvdix.h
index ddd8abb..b61659c 100644
--- a/Xext/xvdix.h
+++ b/Xext/xvdix.h
@@ -235,7 +235,6 @@ extern _X_EXPORT DevPrivateKey XvGetScreenKey(void);
 extern _X_EXPORT unsigned long XvGetRTPort(void);
 extern _X_EXPORT void XvFreeAdaptor(XvAdaptorPtr pAdaptor);
 extern _X_EXPORT int XvdiSendPortNotify(XvPortPtr, Atom, INT32);
-extern _X_EXPORT int XvdiVideoStopped(XvPortPtr, int);
 
 extern _X_EXPORT int XvdiPutVideo(ClientPtr, DrawablePtr, XvPortPtr, GCPtr,
                                   INT16, INT16, CARD16, CARD16,
diff --git a/Xext/xvmain.c b/Xext/xvmain.c
index ea3771f..2046b9d 100644
--- a/Xext/xvmain.c
+++ b/Xext/xvmain.c
@@ -425,30 +425,6 @@ XvDestroyWindow(WindowPtr pWin)
 
 }
 
-/* The XvdiVideoStopped procedure is a hook for the device dependent layer.
-   It provides a way for the dd layer to inform the di layer that video has
-   stopped in a port for reasons that the di layer had no control over; note
-   that it doesn't call back into the dd layer */
-
-int
-XvdiVideoStopped(XvPortPtr pPort, int reason)
-{
-
-    /* IF PORT ISN'T ACTIVE THEN WE'RE DONE */
-
-    if (!pPort->pDraw)
-        return Success;
-
-    XvdiSendVideoNotify(pPort, pPort->pDraw, reason);
-
-    pPort->pDraw = NULL;
-    pPort->client = NULL;
-    pPort->time = currentTime;
-
-    return Success;
-
-}
-
 static int
 XvdiDestroyPort(void *pPort, XID id)
 {
commit 4a095902a37cb98d7954d0873dcf1376cbab54b8
Author: Eric Anholt <eric at anholt.net>
Date:   Fri Apr 4 18:01:07 2014 +0100

    xv: Drop unused XvdiPreemptVideo().
    
    Signed-off-by: Eric Anholt <eric at anholt.net>
    Reviewed-by: Keith Packard <keithp at keithp.com>

diff --git a/Xext/xvdix.h b/Xext/xvdix.h
index 2437eb4..ddd8abb 100644
--- a/Xext/xvdix.h
+++ b/Xext/xvdix.h
@@ -259,7 +259,6 @@ extern _X_EXPORT int XvdiSelectPortNotify(ClientPtr, XvPortPtr, BOOL);
 extern _X_EXPORT int XvdiSetPortAttribute(ClientPtr, XvPortPtr, Atom, INT32);
 extern _X_EXPORT int XvdiGetPortAttribute(ClientPtr, XvPortPtr, Atom, INT32 *);
 extern _X_EXPORT int XvdiStopVideo(ClientPtr, XvPortPtr, DrawablePtr);
-extern _X_EXPORT int XvdiPreemptVideo(ClientPtr, XvPortPtr, DrawablePtr);
 extern _X_EXPORT int XvdiMatchPort(XvPortPtr, DrawablePtr);
 extern _X_EXPORT int XvdiGrabPort(ClientPtr, XvPortPtr, Time, int *);
 extern _X_EXPORT int XvdiUngrabPort(ClientPtr, XvPortPtr, Time);
diff --git a/Xext/xvmain.c b/Xext/xvmain.c
index 9084e40..ea3771f 100644
--- a/Xext/xvmain.c
+++ b/Xext/xvmain.c
@@ -992,28 +992,6 @@ XvdiStopVideo(ClientPtr client, XvPortPtr pPort, DrawablePtr pDraw)
 }
 
 int
-XvdiPreemptVideo(ClientPtr client, XvPortPtr pPort, DrawablePtr pDraw)
-{
-    int status;
-
-    /* IF PORT ISN'T ACTIVE THEN WE'RE DONE */
-
-    if (!pPort->pDraw || (pPort->pDraw != pDraw))
-        return Success;
-
-    XvdiSendVideoNotify(pPort, pPort->pDraw, XvPreempted);
-
-    status = (*pPort->pAdaptor->ddStopVideo) (client, pPort, pPort->pDraw);
-
-    pPort->pDraw = NULL;
-    pPort->client = (ClientPtr) client;
-    pPort->time = currentTime;
-
-    return status;
-
-}
-
-int
 XvdiMatchPort(XvPortPtr pPort, DrawablePtr pDraw)
 {
 
commit e7dde86f2343832c52ef74f5c4fe44a72054c79b
Author: Eric Anholt <eric at anholt.net>
Date:   Fri Apr 4 17:54:58 2014 +0100

    xv: Move the DDX XV screen private allocation into the DDXes.
    
    XV was going against convention by having the core infrastructure
    allocate the private on behalf of the DDX.  I was interested in this
    because I was trying to make multiple pieces of DDX be able to
    allocate adaptors, and that wasn't going to work if DDX-specific code
    was hung off of a single global screen private.
    
    Signed-off-by: Eric Anholt <eric at anholt.net>
    Reviewed-by: Keith Packard <keithp at keithp.com>

diff --git a/Xext/xvdix.h b/Xext/xvdix.h
index 7afa88a..2437eb4 100644
--- a/Xext/xvdix.h
+++ b/Xext/xvdix.h
@@ -214,7 +214,6 @@ typedef struct {
     DestroyPixmapProcPtr DestroyPixmap;
     CloseScreenProcPtr CloseScreen;
     Bool (*ddCloseScreen) (ScreenPtr);
-    DevUnion devPriv;
 } XvScreenRec, *XvScreenPtr;
 
 #define SCREEN_PROLOGUE(pScreen, field) ((pScreen)->field = ((XvScreenPtr) \
diff --git a/hw/kdrive/src/kxv.c b/hw/kdrive/src/kxv.c
index 0896c81..ad51cf9 100644
--- a/hw/kdrive/src/kxv.c
+++ b/hw/kdrive/src/kxv.c
@@ -103,6 +103,7 @@ static DevPrivateKeyRec KdXVWindowKeyRec;
 
 #define KdXVWindowKey (&KdXVWindowKeyRec)
 static DevPrivateKey KdXvScreenKey;
+static DevPrivateKeyRec KdXVScreenPrivateKey;
 static unsigned long KdXVGeneration = 0;
 static unsigned long PortResource = 0;
 
@@ -110,7 +111,7 @@ static unsigned long PortResource = 0;
     dixLookupPrivate(&(pScreen)->devPrivates, KdXvScreenKey))
 
 #define GET_KDXV_SCREEN(pScreen) \
-  	((KdXVScreenPtr)(GET_XV_SCREEN(pScreen)->devPriv.ptr))
+    ((KdXVScreenPtr)(dixGetPrivate(&pScreen->devPrivates, &KdXVScreenPrivateKey)))
 
 #define GET_KDXV_WINDOW(pWin) ((KdXVWindowPtr) \
     dixLookupPrivate(&(pWin)->devPrivates, KdXVWindowKey))
@@ -143,6 +144,8 @@ KdXVScreenInit(ScreenPtr pScreen, KdVideoAdaptorPtr adaptors, int num)
 
     if (!dixRegisterPrivateKey(&KdXVWindowKeyRec, PRIVATE_WINDOW, 0))
         return FALSE;
+    if (!dixRegisterPrivateKey(&KdXVScreenPrivateKey, PRIVATE_SCREEN, 0))
+        return FALSE;
 
     if (Success != XvScreenInit(pScreen))
         return FALSE;
@@ -157,13 +160,8 @@ KdXVScreenInit(ScreenPtr pScreen, KdVideoAdaptorPtr adaptors, int num)
 
     pxvs->ddCloseScreen = KdXVCloseScreen;
 
-    /* The Xv di layer provides us with a private hook so that we don't
-       have to allocate our own screen private.  They also provide
-       a CloseScreen hook so that we don't have to wrap it.  I'm not
-       sure that I appreciate that.  */
-
     ScreenPriv = malloc(sizeof(KdXVScreenRec));
-    pxvs->devPriv.ptr = (void *) ScreenPriv;
+    dixSetPrivate(&pScreen->devPrivates, &KdXVScreenPrivateKey, ScreenPriv);
 
     if (!ScreenPriv)
         return FALSE;
diff --git a/hw/xfree86/common/xf86xv.c b/hw/xfree86/common/xf86xv.c
index 35dd664..0f3b09b 100644
--- a/hw/xfree86/common/xf86xv.c
+++ b/hw/xfree86/common/xf86xv.c
@@ -112,7 +112,10 @@ static DevPrivateKeyRec XF86XVWindowKeyRec;
 
 #define XF86XVWindowKey (&XF86XVWindowKeyRec)
 
+/* dixmain.c XvScreenPtr screen private */
 DevPrivateKey XF86XvScreenKey;
+/** xf86xv.c XF86XVScreenPtr screen private */
+static DevPrivateKeyRec XF86XVScreenPrivateKey;
 
 static unsigned long PortResource = 0;
 
@@ -120,7 +123,7 @@ static unsigned long PortResource = 0;
     ((XvScreenPtr)dixLookupPrivate(&(pScreen)->devPrivates, XF86XvScreenKey))
 
 #define GET_XF86XV_SCREEN(pScreen) \
-    ((XF86XVScreenPtr)(GET_XV_SCREEN(pScreen)->devPriv.ptr))
+    ((XF86XVScreenPtr)(dixGetPrivate(&pScreen->devPrivates, &XF86XVScreenPrivateKey)))
 
 #define GET_XF86XV_WINDOW(pWin) \
     ((XF86XVWindowPtr)dixLookupPrivate(&(pWin)->devPrivates, XF86XVWindowKey))
@@ -241,6 +244,8 @@ xf86XVScreenInit(ScreenPtr pScreen, XF86VideoAdaptorPtr * adaptors, int num)
 
     if (!dixRegisterPrivateKey(&XF86XVWindowKeyRec, PRIVATE_WINDOW, 0))
         return FALSE;
+    if (!dixRegisterPrivateKey(&XF86XVScreenPrivateKey, PRIVATE_SCREEN, 0))
+        return FALSE;
 
     XF86XvScreenKey = XvGetScreenKey();
 
@@ -253,13 +258,8 @@ xf86XVScreenInit(ScreenPtr pScreen, XF86VideoAdaptorPtr * adaptors, int num)
 
     pxvs->ddCloseScreen = xf86XVCloseScreen;
 
-    /* The Xv di layer provides us with a private hook so that we don't
-       have to allocate our own screen private.  They also provide
-       a CloseScreen hook so that we don't have to wrap it.  I'm not
-       sure that I appreciate that.  */
-
     ScreenPriv = malloc(sizeof(XF86XVScreenRec));
-    pxvs->devPriv.ptr = (void *) ScreenPriv;
+    dixSetPrivate(&pScreen->devPrivates, &XF86XVScreenPrivateKey, ScreenPriv);
 
     if (!ScreenPriv)
         return FALSE;
commit a146c6d4212ed199002e40419b4aa22da8f49e3a
Author: Eric Anholt <eric at anholt.net>
Date:   Fri Apr 4 13:12:34 2014 +0100

    xv: Drop the ddQueryAdaptors() interface.
    
    The core was passing pointers to pxvs's nAdaptors and pAdaptors, and
    the two hardware implementations were copying pxvs's nAdaptors and
    pAdaptors into those pointers.
    
    Signed-off-by: Eric Anholt <eric at anholt.net>
    Reviewed-by: Keith Packard <keithp at keithp.com>

diff --git a/Xext/xvdisp.c b/Xext/xvdisp.c
index f2d49a2..71192b3 100644
--- a/Xext/xvdisp.c
+++ b/Xext/xvdisp.c
@@ -356,8 +356,6 @@ ProcXvQueryAdaptors(ClientPtr client)
         return Success;
     }
 
-    (*pxvs->ddQueryAdaptors) (pScreen, &pxvs->pAdaptors, &pxvs->nAdaptors);
-
     rep = (xvQueryAdaptorsReply) {
         .type = X_Reply,
         .sequenceNumber = client->sequence,
diff --git a/Xext/xvdix.h b/Xext/xvdix.h
index f62adf8..7afa88a 100644
--- a/Xext/xvdix.h
+++ b/Xext/xvdix.h
@@ -214,7 +214,6 @@ typedef struct {
     DestroyPixmapProcPtr DestroyPixmap;
     CloseScreenProcPtr CloseScreen;
     Bool (*ddCloseScreen) (ScreenPtr);
-    int (*ddQueryAdaptors) (ScreenPtr, XvAdaptorPtr *, int *);
     DevUnion devPriv;
 } XvScreenRec, *XvScreenPtr;
 
diff --git a/hw/kdrive/src/kxv.c b/hw/kdrive/src/kxv.c
index 5aae8f7..0896c81 100644
--- a/hw/kdrive/src/kxv.c
+++ b/hw/kdrive/src/kxv.c
@@ -59,7 +59,6 @@ of the copyright holder.
 /* XvScreenRec fields */
 
 static Bool KdXVCloseScreen(ScreenPtr);
-static int KdXVQueryAdaptors(ScreenPtr, XvAdaptorPtr *, int *);
 
 /* XvAdaptorRec fields */
 
@@ -153,11 +152,10 @@ KdXVScreenInit(ScreenPtr pScreen, KdVideoAdaptorPtr adaptors, int num)
 
     pxvs = GET_XV_SCREEN(pScreen);
 
-    /* Anyone initializing the Xv layer must provide these two.
-       The Xv di layer calls them without even checking if they exist! */
+    /* Anyone initializing the Xv layer must provide this.
+       The Xv di layer calls it without even checking if it exists! */
 
     pxvs->ddCloseScreen = KdXVCloseScreen;
-    pxvs->ddQueryAdaptors = KdXVQueryAdaptors;
 
     /* The Xv di layer provides us with a private hook so that we don't
        have to allocate our own screen private.  They also provide
@@ -1007,18 +1005,6 @@ KdXVCloseScreen(ScreenPtr pScreen)
     return TRUE;
 }
 
-static int
-KdXVQueryAdaptors(ScreenPtr pScreen,
-                  XvAdaptorPtr * p_pAdaptors, int *p_nAdaptors)
-{
-    XvScreenPtr pxvs = GET_XV_SCREEN(pScreen);
-
-    *p_nAdaptors = pxvs->nAdaptors;
-    *p_pAdaptors = pxvs->pAdaptors;
-
-    return Success;
-}
-
 static Bool
 KdXVRunning(ScreenPtr pScreen)
 {
diff --git a/hw/xfree86/common/xf86xv.c b/hw/xfree86/common/xf86xv.c
index ae20b58..35dd664 100644
--- a/hw/xfree86/common/xf86xv.c
+++ b/hw/xfree86/common/xf86xv.c
@@ -57,7 +57,6 @@
 /* XvScreenRec fields */
 
 static Bool xf86XVCloseScreen(ScreenPtr);
-static int xf86XVQueryAdaptors(ScreenPtr, XvAdaptorPtr *, int *);
 
 /* XvAdaptorRec fields */
 
@@ -249,11 +248,10 @@ xf86XVScreenInit(ScreenPtr pScreen, XF86VideoAdaptorPtr * adaptors, int num)
 
     pxvs = GET_XV_SCREEN(pScreen);
 
-    /* Anyone initializing the Xv layer must provide these two.
-       The Xv di layer calls them without even checking if they exist! */
+    /* Anyone initializing the Xv layer must provide this.
+       The Xv di layer calls it without even checking if it exists! */
 
     pxvs->ddCloseScreen = xf86XVCloseScreen;
-    pxvs->ddQueryAdaptors = xf86XVQueryAdaptors;
 
     /* The Xv di layer provides us with a private hook so that we don't
        have to allocate our own screen private.  They also provide
@@ -1185,18 +1183,6 @@ xf86XVCloseScreen(ScreenPtr pScreen)
     return TRUE;
 }
 
-static int
-xf86XVQueryAdaptors(ScreenPtr pScreen,
-                    XvAdaptorPtr * p_pAdaptors, int *p_nAdaptors)
-{
-    XvScreenPtr pxvs = GET_XV_SCREEN(pScreen);
-
-    *p_nAdaptors = pxvs->nAdaptors;
-    *p_pAdaptors = pxvs->pAdaptors;
-
-    return Success;
-}
-
 /**** ScrnInfoRec fields ****/
 
 static Bool
commit cb42805c6675bbb9f0b37609fe2ffecc07f46290
Author: Eric Anholt <eric at anholt.net>
Date:   Fri Dec 27 21:54:26 2013 -0800

    xv: Move common code for adaptor cleanup to xvmain.c
    
    Since any DDX XV screen cleanup would need this same code for freeing
    the tree of pointers for xv adaptors, move it to the dix.
    
    v2: Unconditionalize the pPorts freeing, to match the block above it.
    
    Signed-off-by: Eric Anholt <eric at anholt.net>
    Reviewed-by: Keith Packard <keithp at keithp.com> (v1)

diff --git a/Xext/xvdix.h b/Xext/xvdix.h
index bb08cf4..f62adf8 100644
--- a/Xext/xvdix.h
+++ b/Xext/xvdix.h
@@ -235,6 +235,7 @@ extern _X_EXPORT int SProcXvDispatch(ClientPtr);
 extern _X_EXPORT int XvScreenInit(ScreenPtr);
 extern _X_EXPORT DevPrivateKey XvGetScreenKey(void);
 extern _X_EXPORT unsigned long XvGetRTPort(void);
+extern _X_EXPORT void XvFreeAdaptor(XvAdaptorPtr pAdaptor);
 extern _X_EXPORT int XvdiSendPortNotify(XvPortPtr, Atom, INT32);
 extern _X_EXPORT int XvdiVideoStopped(XvPortPtr, int);
 
diff --git a/Xext/xvmain.c b/Xext/xvmain.c
index 00b5179..9084e40 100644
--- a/Xext/xvmain.c
+++ b/Xext/xvmain.c
@@ -1091,3 +1091,42 @@ WriteSwappedPortNotifyEvent(xvEvent * from, xvEvent * to)
     cpswapl(from->u.portNotify.value, to->u.portNotify.value);
 
 }
+
+void
+XvFreeAdaptor(XvAdaptorPtr pAdaptor)
+{
+    int i;
+
+    free(pAdaptor->name);
+    pAdaptor->name = NULL;
+
+    if (pAdaptor->pEncodings) {
+        XvEncodingPtr pEncode = pAdaptor->pEncodings;
+
+        for (i = 0; i < pAdaptor->nEncodings; i++, pEncode++)
+            free(pEncode->name);
+        free(pAdaptor->pEncodings);
+        pAdaptor->pEncodings = NULL;
+    }
+
+    free(pAdaptor->pFormats);
+    pAdaptor->pFormats = NULL;
+
+    free(pAdaptor->pPorts);
+    pAdaptor->pPorts = NULL;
+
+    if (pAdaptor->pAttributes) {
+        XvAttributePtr pAttribute = pAdaptor->pAttributes;
+
+        for (i = 0; i < pAdaptor->nAttributes; i++, pAttribute++)
+            free(pAttribute->name);
+        free(pAdaptor->pAttributes);
+        pAdaptor->pAttributes = NULL;
+    }
+
+    free(pAdaptor->pImages);
+    pAdaptor->pImages = NULL;
+
+    free(pAdaptor->devPriv.ptr);
+    pAdaptor->devPriv.ptr = NULL;
+}
diff --git a/hw/kdrive/src/kxv.c b/hw/kdrive/src/kxv.c
index 3d63304..5aae8f7 100644
--- a/hw/kdrive/src/kxv.c
+++ b/hw/kdrive/src/kxv.c
@@ -193,19 +193,6 @@ KdXVFreeAdaptor(XvAdaptorPtr pAdaptor)
 {
     int i;
 
-    free(pAdaptor->name);
-
-    if (pAdaptor->pEncodings) {
-        XvEncodingPtr pEncode = pAdaptor->pEncodings;
-
-        for (i = 0; i < pAdaptor->nEncodings; i++, pEncode++) {
-            free(pEncode->name);
-        }
-        free(pAdaptor->pEncodings);
-    }
-
-    free(pAdaptor->pFormats);
-
     if (pAdaptor->pPorts) {
         XvPortPtr pPort = pAdaptor->pPorts;
         XvPortRecPrivatePtr pPriv;
@@ -220,22 +207,9 @@ KdXVFreeAdaptor(XvAdaptorPtr pAdaptor)
                 free(pPriv);
             }
         }
-        free(pAdaptor->pPorts);
     }
 
-    if (pAdaptor->nAttributes) {
-        XvAttributePtr pAttribute = pAdaptor->pAttributes;
-
-        for (i = 0; i < pAdaptor->nAttributes; i++, pAttribute++) {
-            free(pAttribute->name);
-        }
-
-        free(pAdaptor->pAttributes);
-    }
-
-    free(pAdaptor->pImages);
-
-    free(pAdaptor->devPriv.ptr);
+    XvFreeAdaptor(pAdaptor);
 }
 
 static Bool
diff --git a/hw/xfree86/common/xf86xv.c b/hw/xfree86/common/xf86xv.c
index 6302b8d..ae20b58 100644
--- a/hw/xfree86/common/xf86xv.c
+++ b/hw/xfree86/common/xf86xv.c
@@ -297,21 +297,6 @@ xf86XVFreeAdaptor(XvAdaptorPtr pAdaptor)
 {
     int i;
 
-    free(pAdaptor->name);
-    pAdaptor->name = NULL;
-
-    if (pAdaptor->pEncodings) {
-        XvEncodingPtr pEncode = pAdaptor->pEncodings;
-
-        for (i = 0; i < pAdaptor->nEncodings; i++, pEncode++)
-            free(pEncode->name);
-        free(pAdaptor->pEncodings);
-        pAdaptor->pEncodings = NULL;
-    }
-
-    free(pAdaptor->pFormats);
-    pAdaptor->pFormats = NULL;
-
     if (pAdaptor->pPorts) {
         XvPortPtr pPort = pAdaptor->pPorts;
         XvPortRecPrivatePtr pPriv;
@@ -328,23 +313,9 @@ xf86XVFreeAdaptor(XvAdaptorPtr pAdaptor)
                 free(pPriv);
             }
         }
-        free(pAdaptor->pPorts);
-        pAdaptor->pPorts = NULL;
-    }
-
-    if (pAdaptor->pAttributes) {
-        XvAttributePtr pAttribute = pAdaptor->pAttributes;
-
-        for (i = 0; i < pAdaptor->nAttributes; i++, pAttribute++)
-            free(pAttribute->name);
-        free(pAdaptor->pAttributes);
-        pAdaptor->pAttributes = NULL;
     }
 
-    free(pAdaptor->pImages);
-    free(pAdaptor->devPriv.ptr);
-    pAdaptor->pImages = NULL;
-    pAdaptor->devPriv.ptr = NULL;
+    XvFreeAdaptor(pAdaptor);
 }
 
 static Bool
commit 8cb0da29404d3fed13c1cbedb5c6164e4733ea82
Author: Eric Anholt <eric at anholt.net>
Date:   Fri Dec 27 20:59:12 2013 -0800

    xv: Remove dead VIDEO_NO_CLIPPING from the xorg and kdrive DDXes.
    
    As far as I can see, nothing has ever used this flag except possibly
    the i.mx6 xorg ddx debug during bringup.
    
    Signed-off-by: Eric Anholt <eric at anholt.net>
    Reviewed-by: Keith Packard <keithp at keithp.com>

diff --git a/hw/kdrive/src/kxv.c b/hw/kdrive/src/kxv.c
index f808fb0..3d63304 100644
--- a/hw/kdrive/src/kxv.c
+++ b/hw/kdrive/src/kxv.c
@@ -664,18 +664,6 @@ KdXVReputVideo(XvPortRecPrivatePtr portPriv)
         goto CLIP_VIDEO_BAILOUT;
     }
 
-    /* bailout if we have to clip but the hardware doesn't support it */
-    if (portPriv->AdaptorRec->flags & VIDEO_NO_CLIPPING) {
-        BoxPtr clipBox = RegionRects(&ClipRegion);
-
-        if ((RegionNumRects(&ClipRegion) != 1) ||
-            (clipBox->x1 != WinBox.x1) || (clipBox->x2 != WinBox.x2) ||
-            (clipBox->y1 != WinBox.y1) || (clipBox->y2 != WinBox.y2)) {
-            clippedAway = TRUE;
-            goto CLIP_VIDEO_BAILOUT;
-        }
-    }
-
     ret = (*portPriv->AdaptorRec->PutVideo) (portPriv->screen, portPriv->pDraw,
                                              portPriv->vid_x, portPriv->vid_y,
                                              WinBox.x1, WinBox.y1,
@@ -752,18 +740,6 @@ KdXVReputImage(XvPortRecPrivatePtr portPriv)
         goto CLIP_VIDEO_BAILOUT;
     }
 
-    /* bailout if we have to clip but the hardware doesn't support it */
-    if (portPriv->AdaptorRec->flags & VIDEO_NO_CLIPPING) {
-        BoxPtr clipBox = RegionRects(&ClipRegion);
-
-        if ((RegionNumRects(&ClipRegion) != 1) ||
-            (clipBox->x1 != WinBox.x1) || (clipBox->x2 != WinBox.x2) ||
-            (clipBox->y1 != WinBox.y1) || (clipBox->y2 != WinBox.y2)) {
-            clippedAway = TRUE;
-            goto CLIP_VIDEO_BAILOUT;
-        }
-    }
-
     ret =
         (*portPriv->AdaptorRec->ReputImage) (portPriv->screen, portPriv->pDraw,
                                              WinBox.x1, WinBox.y1, &ClipRegion,
@@ -1251,17 +1227,6 @@ KdXVPutStill(ClientPtr client,
         goto PUT_STILL_BAILOUT;
     }
 
-    if (portPriv->AdaptorRec->flags & VIDEO_NO_CLIPPING) {
-        BoxPtr clipBox = RegionRects(&ClipRegion);
-
-        if ((RegionNumRects(&ClipRegion) != 1) ||
-            (clipBox->x1 != WinBox.x1) || (clipBox->x2 != WinBox.x2) ||
-            (clipBox->y1 != WinBox.y1) || (clipBox->y2 != WinBox.y2)) {
-            clippedAway = TRUE;
-            goto PUT_STILL_BAILOUT;
-        }
-    }
-
     ret = (*portPriv->AdaptorRec->PutStill) (portPriv->screen, pDraw,
                                              vid_x, vid_y, WinBox.x1, WinBox.y1,
                                              vid_w, vid_h, drw_w, drw_h,
@@ -1541,17 +1506,6 @@ KdXVPutImage(ClientPtr client,
         goto PUT_IMAGE_BAILOUT;
     }
 
-    if (portPriv->AdaptorRec->flags & VIDEO_NO_CLIPPING) {
-        BoxPtr clipBox = RegionRects(&ClipRegion);
-
-        if ((RegionNumRects(&ClipRegion) != 1) ||
-            (clipBox->x1 != WinBox.x1) || (clipBox->x2 != WinBox.x2) ||
-            (clipBox->y1 != WinBox.y1) || (clipBox->y2 != WinBox.y2)) {
-            clippedAway = TRUE;
-            goto PUT_IMAGE_BAILOUT;
-        }
-    }
-
     ret = (*portPriv->AdaptorRec->PutImage) (portPriv->screen, pDraw,
                                              src_x, src_y, WinBox.x1, WinBox.y1,
                                              src_w, src_h, drw_w, drw_h,
diff --git a/hw/kdrive/src/kxv.h b/hw/kdrive/src/kxv.h
index adedbda..fe467a9 100644
--- a/hw/kdrive/src/kxv.h
+++ b/hw/kdrive/src/kxv.h
@@ -50,7 +50,6 @@ of the copyright holder.
 
 #include "../../Xext/xvdix.h"
 
-#define VIDEO_NO_CLIPPING			0x00000001
 #define VIDEO_OVERLAID_IMAGES			0x00000004
 #define VIDEO_OVERLAID_STILLS			0x00000008
 #define VIDEO_CLIP_TO_VIEWPORT			0x00000010
diff --git a/hw/xfree86/common/xf86xv.c b/hw/xfree86/common/xf86xv.c
index bb91758..6302b8d 100644
--- a/hw/xfree86/common/xf86xv.c
+++ b/hw/xfree86/common/xf86xv.c
@@ -784,18 +784,6 @@ xf86XVReputVideo(XvPortRecPrivatePtr portPriv)
         goto CLIP_VIDEO_BAILOUT;
     }
 
-    /* bailout if we have to clip but the hardware doesn't support it */
-    if (portPriv->AdaptorRec->flags & VIDEO_NO_CLIPPING) {
-        BoxPtr clipBox = RegionRects(&ClipRegion);
-
-        if ((RegionNumRects(&ClipRegion) != 1) ||
-            (clipBox->x1 != WinBox.x1) || (clipBox->x2 != WinBox.x2) ||
-            (clipBox->y1 != WinBox.y1) || (clipBox->y2 != WinBox.y2)) {
-            clippedAway = TRUE;
-            goto CLIP_VIDEO_BAILOUT;
-        }
-    }
-
     ret = (*portPriv->AdaptorRec->PutVideo) (portPriv->pScrn,
                                              portPriv->vid_x, portPriv->vid_y,
                                              WinBox.x1, WinBox.y1,
@@ -874,18 +862,6 @@ xf86XVReputImage(XvPortRecPrivatePtr portPriv)
         goto CLIP_VIDEO_BAILOUT;
     }
 
-    /* bailout if we have to clip but the hardware doesn't support it */
-    if (portPriv->AdaptorRec->flags & VIDEO_NO_CLIPPING) {
-        BoxPtr clipBox = RegionRects(&ClipRegion);
-
-        if ((RegionNumRects(&ClipRegion) != 1) ||
-            (clipBox->x1 != WinBox.x1) || (clipBox->x2 != WinBox.x2) ||
-            (clipBox->y1 != WinBox.y1) || (clipBox->y2 != WinBox.y2)) {
-            clippedAway = TRUE;
-            goto CLIP_VIDEO_BAILOUT;
-        }
-    }
-
     ret = (*portPriv->AdaptorRec->ReputImage) (portPriv->pScrn,
                                                portPriv->vid_x, portPriv->vid_y,
                                                WinBox.x1, WinBox.y1,
@@ -1468,17 +1444,6 @@ xf86XVPutStill(ClientPtr client,
         goto PUT_STILL_BAILOUT;
     }
 
-    if (portPriv->AdaptorRec->flags & VIDEO_NO_CLIPPING) {
-        BoxPtr clipBox = RegionRects(&ClipRegion);
-
-        if ((RegionNumRects(&ClipRegion) != 1) ||
-            (clipBox->x1 != WinBox.x1) || (clipBox->x2 != WinBox.x2) ||
-            (clipBox->y1 != WinBox.y1) || (clipBox->y2 != WinBox.y2)) {
-            clippedAway = TRUE;
-            goto PUT_STILL_BAILOUT;
-        }
-    }
-
     ret = (*portPriv->AdaptorRec->PutStill) (portPriv->pScrn,
                                              vid_x, vid_y, WinBox.x1, WinBox.y1,
                                              vid_w, vid_h, drw_w, drw_h,
@@ -1760,17 +1725,6 @@ xf86XVPutImage(ClientPtr client,
         goto PUT_IMAGE_BAILOUT;
     }
 
-    if (portPriv->AdaptorRec->flags & VIDEO_NO_CLIPPING) {
-        BoxPtr clipBox = RegionRects(&ClipRegion);
-
-        if ((RegionNumRects(&ClipRegion) != 1) ||
-            (clipBox->x1 != WinBox.x1) || (clipBox->x2 != WinBox.x2) ||
-            (clipBox->y1 != WinBox.y1) || (clipBox->y2 != WinBox.y2)) {
-            clippedAway = TRUE;
-            goto PUT_IMAGE_BAILOUT;
-        }
-    }
-
     ret = (*portPriv->AdaptorRec->PutImage) (portPriv->pScrn,
                                              src_x, src_y, WinBox.x1, WinBox.y1,
                                              src_w, src_h, drw_w, drw_h,
diff --git a/hw/xfree86/common/xf86xv.h b/hw/xfree86/common/xf86xv.h
index fc6cf5d..c6455d7 100644
--- a/hw/xfree86/common/xf86xv.h
+++ b/hw/xfree86/common/xf86xv.h
@@ -32,7 +32,6 @@
 #include "xvdix.h"
 #include "xf86str.h"
 
-#define VIDEO_NO_CLIPPING			0x00000001
 #define VIDEO_OVERLAID_IMAGES			0x00000004
 #define VIDEO_OVERLAID_STILLS			0x00000008
 /*
diff --git a/hw/xfree86/doc/ddxDesign.xml b/hw/xfree86/doc/ddxDesign.xml
index 969fb0f..6a9de9e 100644
--- a/hw/xfree86/doc/ddxDesign.xml
+++ b/hw/xfree86/doc/ddxDesign.xml
@@ -4543,21 +4543,6 @@ as follows:
 
 	      <variablelist>
 		<varlistentry>
-		  <term><constant>VIDEO_NO_CLIPPING</constant></term>
-		  <listitem><para>
-	   This indicates that the video adaptor does not support
-	   clipping.  The driver will never receive <quote>Put</quote> requests
-	   where less than the entire area determined by
-	   <parameter>drw_x</parameter>, <parameter>drw_y</parameter>,
-	   <parameter>drw_w</parameter> and <parameter>drw_h</parameter> is visible.
-	   This flag does not apply to <quote>Get</quote> requests.  Hardware
-	   that is incapable of clipping <quote>Gets</quote> may punt or get
-	   the extents of the clipping region passed to it.
-		    </para></listitem>
-
-		</varlistentry>
-
-		<varlistentry>
 		  <term><constant>VIDEO_OVERLAID_STILLS</constant></term>
 		  <listitem><para>
 	   Implementing PutStill for hardware that does video as an
@@ -4714,9 +4699,7 @@ as follows:
 	    </para>
 
 	    <para>
-	If the <constant>VIDEO_NO_CLIPPING</constant>
-	flag is set, the <literal remap="tt">clipBoxes</literal> may be ignored by
-	the driver.  <literal remap="tt">ClipBoxes</literal> is an <literal remap="tt">X-Y</literal>
+	<literal remap="tt">ClipBoxes</literal> is an <literal remap="tt">X-Y</literal>
 	banded region identical to those used throughout the server.
 	The clipBoxes represent the visible portions of the area determined
 	by <literal remap="tt">drw_x</literal>, <literal remap="tt">drw_y</literal>,
commit a6ec7d5278405d69e60cca2964006fb7ce32c556
Author: Eric Anholt <eric at anholt.net>
Date:   Fri Dec 27 20:53:00 2013 -0800

    xv: Remove dead VIDEO_INVERT_CLIPLIST from the xorg and kdrive DDXes.
    
    As far as I can see (looking at trees on my disk, plus googling for
    the term), nothing has ever used this flag
    
    Signed-off-by: Eric Anholt <eric at anholt.net>
    Reviewed-by: Keith Packard <keithp at keithp.com>

diff --git a/hw/kdrive/src/kxv.c b/hw/kdrive/src/kxv.c
index 60a8345..f808fb0 100644
--- a/hw/kdrive/src/kxv.c
+++ b/hw/kdrive/src/kxv.c
@@ -588,10 +588,6 @@ KdXVRegetVideo(XvPortRecPrivatePtr portPriv)
         goto CLIP_VIDEO_BAILOUT;
     }
 
-    if (portPriv->AdaptorRec->flags & VIDEO_INVERT_CLIPLIST) {
-        RegionSubtract(&ClipRegion, &WinRegion, &ClipRegion);
-    }
-
     ret = (*portPriv->AdaptorRec->GetVideo) (portPriv->screen, portPriv->pDraw,
                                              portPriv->vid_x, portPriv->vid_y,
                                              WinBox.x1, WinBox.y1,
@@ -680,10 +676,6 @@ KdXVReputVideo(XvPortRecPrivatePtr portPriv)
         }
     }
 
-    if (portPriv->AdaptorRec->flags & VIDEO_INVERT_CLIPLIST) {
-        RegionSubtract(&ClipRegion, &WinRegion, &ClipRegion);
-    }
-
     ret = (*portPriv->AdaptorRec->PutVideo) (portPriv->screen, portPriv->pDraw,
                                              portPriv->vid_x, portPriv->vid_y,
                                              WinBox.x1, WinBox.y1,
@@ -772,10 +764,6 @@ KdXVReputImage(XvPortRecPrivatePtr portPriv)
         }
     }
 
-    if (portPriv->AdaptorRec->flags & VIDEO_INVERT_CLIPLIST) {
-        RegionSubtract(&ClipRegion, &WinRegion, &ClipRegion);
-    }
-
     ret =
         (*portPriv->AdaptorRec->ReputImage) (portPriv->screen, portPriv->pDraw,
                                              WinBox.x1, WinBox.y1, &ClipRegion,
@@ -1274,10 +1262,6 @@ KdXVPutStill(ClientPtr client,
         }
     }
 
-    if (portPriv->AdaptorRec->flags & VIDEO_INVERT_CLIPLIST) {
-        RegionSubtract(&ClipRegion, &WinRegion, &ClipRegion);
-    }
-
     ret = (*portPriv->AdaptorRec->PutStill) (portPriv->screen, pDraw,
                                              vid_x, vid_y, WinBox.x1, WinBox.y1,
                                              vid_w, vid_h, drw_w, drw_h,
@@ -1410,10 +1394,6 @@ KdXVGetStill(ClientPtr client,
         goto GET_STILL_BAILOUT;
     }
 
-    if (portPriv->AdaptorRec->flags & VIDEO_INVERT_CLIPLIST) {
-        RegionSubtract(&ClipRegion, &WinRegion, &ClipRegion);
-    }
-
     ret = (*portPriv->AdaptorRec->GetStill) (portPriv->screen, pDraw,
                                              vid_x, vid_y, WinBox.x1, WinBox.y1,
                                              vid_w, vid_h, drw_w, drw_h,
@@ -1572,10 +1552,6 @@ KdXVPutImage(ClientPtr client,
         }
     }
 
-    if (portPriv->AdaptorRec->flags & VIDEO_INVERT_CLIPLIST) {
-        RegionSubtract(&ClipRegion, &WinRegion, &ClipRegion);
-    }
-
     ret = (*portPriv->AdaptorRec->PutImage) (portPriv->screen, pDraw,
                                              src_x, src_y, WinBox.x1, WinBox.y1,
                                              src_w, src_h, drw_w, drw_h,
diff --git a/hw/kdrive/src/kxv.h b/hw/kdrive/src/kxv.h
index 3a49a65..adedbda 100644
--- a/hw/kdrive/src/kxv.h
+++ b/hw/kdrive/src/kxv.h
@@ -51,7 +51,6 @@ of the copyright holder.
 #include "../../Xext/xvdix.h"
 
 #define VIDEO_NO_CLIPPING			0x00000001
-#define VIDEO_INVERT_CLIPLIST			0x00000002
 #define VIDEO_OVERLAID_IMAGES			0x00000004
 #define VIDEO_OVERLAID_STILLS			0x00000008
 #define VIDEO_CLIP_TO_VIEWPORT			0x00000010
diff --git a/hw/xfree86/common/xf86xv.c b/hw/xfree86/common/xf86xv.c
index e212a73..bb91758 100644
--- a/hw/xfree86/common/xf86xv.c
+++ b/hw/xfree86/common/xf86xv.c
@@ -712,10 +712,6 @@ xf86XVRegetVideo(XvPortRecPrivatePtr portPriv)
         goto CLIP_VIDEO_BAILOUT;
     }
 
-    if (portPriv->AdaptorRec->flags & VIDEO_INVERT_CLIPLIST) {
-        RegionSubtract(&ClipRegion, &WinRegion, &ClipRegion);
-    }
-
     ret = (*portPriv->AdaptorRec->GetVideo) (portPriv->pScrn,
                                              portPriv->vid_x, portPriv->vid_y,
                                              WinBox.x1, WinBox.y1,
@@ -800,10 +796,6 @@ xf86XVReputVideo(XvPortRecPrivatePtr portPriv)
         }
     }
 
-    if (portPriv->AdaptorRec->flags & VIDEO_INVERT_CLIPLIST) {
-        RegionSubtract(&ClipRegion, &WinRegion, &ClipRegion);
-    }
-
     ret = (*portPriv->AdaptorRec->PutVideo) (portPriv->pScrn,
                                              portPriv->vid_x, portPriv->vid_y,
                                              WinBox.x1, WinBox.y1,
@@ -894,10 +886,6 @@ xf86XVReputImage(XvPortRecPrivatePtr portPriv)
         }
     }
 
-    if (portPriv->AdaptorRec->flags & VIDEO_INVERT_CLIPLIST) {
-        RegionSubtract(&ClipRegion, &WinRegion, &ClipRegion);
-    }
-
     ret = (*portPriv->AdaptorRec->ReputImage) (portPriv->pScrn,
                                                portPriv->vid_x, portPriv->vid_y,
                                                WinBox.x1, WinBox.y1,
@@ -1491,10 +1479,6 @@ xf86XVPutStill(ClientPtr client,
         }
     }
 
-    if (portPriv->AdaptorRec->flags & VIDEO_INVERT_CLIPLIST) {
-        RegionSubtract(&ClipRegion, &WinRegion, &ClipRegion);
-    }
-
     ret = (*portPriv->AdaptorRec->PutStill) (portPriv->pScrn,
                                              vid_x, vid_y, WinBox.x1, WinBox.y1,
                                              vid_w, vid_h, drw_w, drw_h,
@@ -1628,10 +1612,6 @@ xf86XVGetStill(ClientPtr client,
         goto GET_STILL_BAILOUT;
     }
 
-    if (portPriv->AdaptorRec->flags & VIDEO_INVERT_CLIPLIST) {
-        RegionSubtract(&ClipRegion, &WinRegion, &ClipRegion);
-    }
-
     ret = (*portPriv->AdaptorRec->GetStill) (portPriv->pScrn,
                                              vid_x, vid_y, WinBox.x1, WinBox.y1,
                                              vid_w, vid_h, drw_w, drw_h,
@@ -1791,10 +1771,6 @@ xf86XVPutImage(ClientPtr client,
         }
     }
 
-    if (portPriv->AdaptorRec->flags & VIDEO_INVERT_CLIPLIST) {
-        RegionSubtract(&ClipRegion, &WinRegion, &ClipRegion);
-    }
-
     ret = (*portPriv->AdaptorRec->PutImage) (portPriv->pScrn,
                                              src_x, src_y, WinBox.x1, WinBox.y1,
                                              src_w, src_h, drw_w, drw_h,
diff --git a/hw/xfree86/common/xf86xv.h b/hw/xfree86/common/xf86xv.h
index de17eb1..fc6cf5d 100644
--- a/hw/xfree86/common/xf86xv.h
+++ b/hw/xfree86/common/xf86xv.h
@@ -33,7 +33,6 @@
 #include "xf86str.h"
 
 #define VIDEO_NO_CLIPPING			0x00000001
-#define VIDEO_INVERT_CLIPLIST			0x00000002
 #define VIDEO_OVERLAID_IMAGES			0x00000004
 #define VIDEO_OVERLAID_STILLS			0x00000008
 /*
diff --git a/hw/xfree86/doc/ddxDesign.xml b/hw/xfree86/doc/ddxDesign.xml
index fcf2228..969fb0f 100644
--- a/hw/xfree86/doc/ddxDesign.xml
+++ b/hw/xfree86/doc/ddxDesign.xml
@@ -4558,16 +4558,6 @@ as follows:
 		</varlistentry>
 
 		<varlistentry>
-		  <term><constant>VIDEO_INVERT_CLIPLIST</constant></term>
-		  <listitem><para>
-	   This indicates that the video driver requires the clip
-	   list to contain the regions which are obscured rather
-	   than the regions which are are visible.
-		    </para></listitem>
-
-		</varlistentry>
-
-		<varlistentry>
 		  <term><constant>VIDEO_OVERLAID_STILLS</constant></term>
 		  <listitem><para>
 	   Implementing PutStill for hardware that does video as an
@@ -4733,9 +4723,6 @@ as follows:
 	<literal remap="tt">drw_w</literal> and <literal remap="tt">drw_h</literal> in the Get/Put
 	function.  The boxes are in screen coordinates, are guaranteed
 	not to overlap and an empty region will never be passed.
-	If the driver has specified <constant>VIDEO_INVERT_CLIPLIST</constant>,
-	<literal remap="tt">clipBoxes</literal> will indicate the areas of the primitive
-	which are obscured rather than the areas visible.
 
 	    </para></listitem></varlistentry>
       </variablelist>
commit e6c8c7e46c79b2837a7d0b12079a47734eff1eb7
Author: Egbert Eich <eich at freedesktop.org>
Date:   Mon Aug 4 19:16:30 2014 +0200

    BellProc: Send bell event on core protocol bell when requested
    
    XKB allows to override the BellProc() ringing the 'keyboard bell':
    instead an event is sent to an X client which can perform an
    appropriate action.
    In most cases this effectively prevents the core protocol bell
    from ringing: if no BellProc() is set for the device, no attempt
    is made to ring a bell.
    This patch ensures that an XKB bell event is sent also when
    the core protocol bell is rung end thus an appropriate action
    can be taken by a client.
    
    Signed-off-by: Egbert Eich <eich at freedesktop.org>
    Acked-by: Peter Hutterer <peter.hutterer at who-t.net>
    Signed-off-by: Keith Packard <keithp at keithp.com>

diff --git a/dix/devices.c b/dix/devices.c
index 7f079ff..5d26fae 100644
--- a/dix/devices.c
+++ b/dix/devices.c
@@ -2257,7 +2257,7 @@ ProcBell(ClientPtr client)
     for (dev = inputInfo.devices; dev; dev = dev->next) {
         if ((dev == keybd ||
              (!IsMaster(dev) && GetMaster(dev, MASTER_KEYBOARD) == keybd)) &&
-            dev->kbdfeed && dev->kbdfeed->BellProc) {
+            ((dev->kbdfeed && dev->kbdfeed->BellProc) || dev->xkb_interest)) {
 
             rc = XaceHook(XACE_DEVICE_ACCESS, client, dev, DixBellAccess);
             if (rc != Success)
commit e8373e4b6a793b48487b1a82d798d97b5c9a10a3
Author: Keith Packard <keithp at keithp.com>
Date:   Thu Jul 31 19:57:53 2014 -0700

    Add X_BYTE_ORDER to xorg-server.h
    
    Drivers don't get to use dix-config.h, they use xorg-server.h
    instead. Add X_BYTE_ORDER to that file so drivers can see the value.
    
    Signed-off-by: Keith Packard <keithp at keithp.com>
    Reviewed-by: Michel Dänzer <michel.daenzer at amd.com>

diff --git a/include/xorg-server.h.in b/include/xorg-server.h.in
index 09b79b6..4cb9487 100644
--- a/include/xorg-server.h.in
+++ b/include/xorg-server.h.in
@@ -231,4 +231,7 @@
 /* Ask fontsproto to make font path element names const */
 #define FONT_PATH_ELEMENT_NAME_CONST    1
 
+/* byte order */
+#undef X_BYTE_ORDER
+
 #endif /* _XORG_SERVER_H_ */
commit e31564e1a21e73f4d20d6471da4fc7a9b63e4062
Author: Michel Dänzer <michel at daenzer.net>
Date:   Thu Jul 31 08:35:13 2014 -0700

    Check for dix-config.h or xorg-server.h before using X_BYTE_ORDER
    
    Now that servermd.h depends on X_BYTE_ORDER being defined in
    dix-config.h or xorg-server.h, check to make sure one of those has
    been included before using the value.
    
    Reviewed-by: Keith Packard <keithp at keithp.com>
    Signed-off-by: Keith Packard <keithp at keithp.com>

diff --git a/include/servermd.h b/include/servermd.h
index 0132d67..c88a542 100644
--- a/include/servermd.h
+++ b/include/servermd.h
@@ -47,7 +47,10 @@ SOFTWARE.
 #ifndef SERVERMD_H
 #define SERVERMD_H 1
 
-#include "dix-config.h"
+#if !defined(_DIX_CONFIG_H_) && !defined(_XORG_SERVER_H_)
+#error Drivers must include xorg-server.h before any other xserver headers
+#error xserver code must include dix-config.h before any other headers
+#endif
 
 #if X_BYTE_ORDER == X_LITTLE_ENDIAN
 #define IMAGE_BYTE_ORDER        LSBFirst
commit 61afe950e6a1a640ad9c5368549914ea32b90d48
Author: Keith Packard <keithp at keithp.com>
Date:   Mon Jul 21 19:27:20 2014 -0700

    xfree86/modes: rotation damage is automatically destroyed on close
    
    Don't try to destroy rotation_damage in the xf86RotateCloseScreen; it
    will have been destroyed when the screen pixmap was destroyed.
    
    Signed-off-by: Keith Packard <keithp at keithp.com>
    Reviewed-by: Eric Anholt <eric at anholt.net>

diff --git a/hw/xfree86/modes/xf86Rotate.c b/hw/xfree86/modes/xf86Rotate.c
index 54cbf2e..9c00a44 100644
--- a/hw/xfree86/modes/xf86Rotate.c
+++ b/hw/xfree86/modes/xf86Rotate.c
@@ -309,6 +309,8 @@ xf86RotateCloseScreen(ScreenPtr screen)
     xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
     int c;
 
+    /* This has already been destroyed when the root window was destroyed */
+    xf86_config->rotation_damage = NULL;
     for (c = 0; c < xf86_config->num_crtc; c++)
         xf86RotateDestroy(xf86_config->crtc[c]);
 }
commit 40dc81154ad38514793f2181447d597b57d39e80
Author: Keith Packard <keithp at keithp.com>
Date:   Sun Jul 20 18:57:42 2014 -0700

    present: Avoid crash at server shutdown
    
    When a present flip operation is still in process during server reset,
    the call to present_set_abort_flip may not happen until the screen is
    being closed, at which point there is no root window to set pixmaps
    for. Check to make sure there's a window before resetting window pixmaps.
    
    Signed-off-by: Keith Packard <keithp at keithp.com>
    Reviewed-by: Eric Anholt <eric at anholt.net>

diff --git a/present/present.c b/present/present.c
index f624e5b..f488e21 100644
--- a/present/present.c
+++ b/present/present.c
@@ -399,7 +399,8 @@ present_set_abort_flip(ScreenPtr screen)
         present_set_tree_pixmap(screen_priv->flip_window,
                                   (*screen->GetScreenPixmap)(screen));
 
-    present_set_tree_pixmap(screen->root, (*screen->GetScreenPixmap)(screen));
+    if (screen->root)
+        present_set_tree_pixmap(screen->root, (*screen->GetScreenPixmap)(screen));
 
     screen_priv->flip_pending->abort_flip = TRUE;
 }
commit 627bce80894647c681b146a709aad4c390b4374e
Author: Keith Packard <keithp at keithp.com>
Date:   Sun Jul 20 18:53:52 2014 -0700

    present: Make window MSC offset 0 initially
    
    The MSC offset used by a window is adjusted as the window moves
    between screens, and between shown/unshown. The value shouldn't
    matter, but it's helpful for debugging to have window MSC values be
    the same as the CRTC MSC at first.
    
    This patch introduces a unique CRTC value so that Present can detect
    the first time a window is a PresentPixmap destination and set the MSC
    offset to zero, rather than using the fake MSC value as the previous
    window MSC.
    
    Signed-off-by: Keith Packard <keithp at keithp.com>
    Reviewed-by: Eric Anholt <eric at anholt.net>

diff --git a/present/present.c b/present/present.c
index 3aea0d7..f624e5b 100644
--- a/present/present.c
+++ b/present/present.c
@@ -291,14 +291,18 @@ present_window_to_crtc_msc(WindowPtr window, RRCrtcPtr crtc, uint64_t window_msc
     if (crtc != window_priv->crtc) {
         uint64_t        old_ust, old_msc;
 
-        /* The old CRTC may have been turned off, in which case
-         * we'll just use whatever previous MSC we'd seen from this CRTC
-         */
+        if (window_priv->crtc == PresentCrtcNeverSet) {
+            window_priv->msc_offset = 0;
+        } else {
+            /* The old CRTC may have been turned off, in which case
+             * we'll just use whatever previous MSC we'd seen from this CRTC
+             */
 
-        if (present_get_ust_msc(window->drawable.pScreen, window_priv->crtc, &old_ust, &old_msc) != Success)
-            old_msc = window_priv->msc;
+            if (present_get_ust_msc(window->drawable.pScreen, window_priv->crtc, &old_ust, &old_msc) != Success)
+                old_msc = window_priv->msc;
 
-        window_priv->msc_offset += new_msc - old_msc;
+            window_priv->msc_offset += new_msc - old_msc;
+        }
         window_priv->crtc = crtc;
     }
 
@@ -725,7 +729,7 @@ present_pixmap(WindowPtr window,
         if (!pixmap)
             target_crtc = window_priv->crtc;
 
-        if (!target_crtc)
+        if (!target_crtc || target_crtc == PresentCrtcNeverSet)
             target_crtc = present_get_crtc(window);
     }
 
diff --git a/present/present_priv.h b/present/present_priv.h
index d8569a2..f5c1652 100644
--- a/present/present_priv.h
+++ b/present/present_priv.h
@@ -134,6 +134,8 @@ typedef struct present_window_priv {
     struct xorg_list       notifies;
 } present_window_priv_rec, *present_window_priv_ptr;
 
+#define PresentCrtcNeverSet     ((RRCrtcPtr) 1)
+
 extern DevPrivateKeyRec present_window_private_key;
 
 static inline present_window_priv_ptr
diff --git a/present/present_screen.c b/present/present_screen.c
index 25ef681..2f91ac7 100644
--- a/present/present_screen.c
+++ b/present/present_screen.c
@@ -45,6 +45,7 @@ present_get_window_priv(WindowPtr window, Bool create)
         return NULL;
     xorg_list_init(&window_priv->vblank);
     xorg_list_init(&window_priv->notifies);
+    window_priv->crtc = PresentCrtcNeverSet;
     dixSetPrivate(&window->devPrivates, &present_window_private_key, window_priv);
     return window_priv;
 }
commit bd4198b01f2baf2284e61ea7ebf4600f554800e9
Author: Keith Packard <keithp at keithp.com>
Date:   Fri Jul 18 11:19:01 2014 -0700

    xfree86: Avoid compiler warning for unused vars without systemd
    
    When systemd isn't being used, systemd_logind_release_fd is defined
    as an empty macro, leaving the arguments unused. Fix the compiler
    warnings by simply removing the local variables and referencing the
    structure within the macro call.
    
    Signed-off-by: Keith Packard <keithp at keithp.com>
    Reviewed-by: Eric Anholt <eric at anholt.net>

diff --git a/hw/xfree86/common/xf86platformBus.c b/hw/xfree86/common/xf86platformBus.c
index 22e4603..9460399 100644
--- a/hw/xfree86/common/xf86platformBus.c
+++ b/hw/xfree86/common/xf86platformBus.c
@@ -348,7 +348,7 @@ static Bool doPlatformProbe(struct xf86_platform_device *dev, DriverPtr drvp,
                             GDevPtr gdev, int flags, intptr_t match_data)
 {
     Bool foundScreen = FALSE;
-    int entity, fd, major, minor;
+    int entity;
 
     if (gdev && gdev->screen == 0 && !xf86_check_platform_slot(dev))
         return FALSE;
@@ -374,10 +374,7 @@ static Bool doPlatformProbe(struct xf86_platform_device *dev, DriverPtr drvp,
     if (entity != -1) {
         if ((dev->flags & XF86_PDEV_SERVER_FD) && (!drvp->driverFunc ||
                 !drvp->driverFunc(NULL, SUPPORTS_SERVER_FDS, NULL))) {
-            fd = dev->attribs->fd;
-            major = dev->attribs->major;
-            minor = dev->attribs->minor;
-            systemd_logind_release_fd(major, minor, fd);
+            systemd_logind_release_fd(dev->attribs->major, dev->attribs->minor, dev->attribs->fd);
             dev->attribs->fd = -1;
             dev->flags &= ~XF86_PDEV_SERVER_FD;
         }
commit b063a185ab9d2c54669fb6e036fdbae3707c9e4b
Author: David Ung <davidu at nvidia.com>
Date:   Tue Jul 29 15:01:39 2014 -0700

    randr: Fix logic in RRPointerToNearestCrtc
    
    RRPointerToNearestCrtc is suppose to snap to the nearest Crtc,
    but best_x and best_y is always positive, hence when calling
    SetCursorPosition it will make the cursor even further away.
    Correct delta x/y to allow negative values and also use
    "width/height -1" in the calculation.  Also choose the closest
    Crtc by setting the "best" value.
    
    Signed-off-by: David Ung <davidu at nvidia.com>
    Reviewed-by: Keith Packard <keithp at keithp.com>
    Signed-off-by: Keith Packard <keithp at keithp.com>

diff --git a/randr/rrpointer.c b/randr/rrpointer.c
index eb6b677..b301d05 100644
--- a/randr/rrpointer.c
+++ b/randr/rrpointer.c
@@ -77,21 +77,22 @@ RRPointerToNearestCrtc(DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y,
 
         if (x < crtc->x)
             dx = crtc->x - x;
-        else if (x > crtc->x + scan_width)
-            dx = x - (crtc->x + scan_width);
+        else if (x > crtc->x + scan_width - 1)
+            dx = crtc->x + (scan_width - 1) - x;
         else
             dx = 0;
         if (y < crtc->y)
             dy = crtc->y - y;
-        else if (y > crtc->y + scan_height)
-            dy = y - (crtc->y + scan_height);
+        else if (y > crtc->y + scan_height - 1)
+            dy = crtc->y + (scan_height - 1) - y;
         else
             dy = 0;
-        dist = dx + dy;
+        dist = dx * dx + dy * dy;
         if (!nearest || dist < best) {
             nearest = crtc;
             best_dx = dx;
             best_dy = dy;
+            best = dist;
         }
     }
     if (best_dx || best_dy)
commit 90803042bcbb9dc6261b5d112acf5613829d9f70
Author: Keith Packard <keithp at keithp.com>
Date:   Wed Jul 30 10:13:53 2014 -0700

    Fix files including xorg-server.h by mistake
    
    A few files in the server are including xorg-server.h, which is only
    for use by Xorg server drivers. This fixes those errors and then adds
    a check to make sure it doesn't happen again.
    
    Signed-off-by: Keith Packard <keithp at keithp.com>
    Reviewed-by: Adam Jackson <ajax at redhat.com>

diff --git a/dri3/dri3.h b/dri3/dri3.h
index edc7fa2..7562352 100644
--- a/dri3/dri3.h
+++ b/dri3/dri3.h
@@ -23,8 +23,6 @@
 #ifndef _DRI3_H_
 #define _DRI3_H_
 
-#include <xorg-server.h>
-
 #ifdef DRI3
 
 #include <X11/extensions/dri3proto.h>
diff --git a/glamor/glamor_egl.c b/glamor/glamor_egl.c
index 54af275..182e2e8 100644
--- a/glamor/glamor_egl.c
+++ b/glamor/glamor_egl.c
@@ -30,7 +30,6 @@
 #include "dix-config.h"
 
 #define GLAMOR_FOR_XORG
-#include <xorg-server.h>
 #include <unistd.h>
 #include <fcntl.h>
 #include <sys/ioctl.h>
diff --git a/glamor/glamor_eglmodule.c b/glamor/glamor_eglmodule.c
index d7e1836..dd4664b 100644
--- a/glamor/glamor_eglmodule.c
+++ b/glamor/glamor_eglmodule.c
@@ -29,7 +29,6 @@
 
 #include "dix-config.h"
 
-#include <xorg-server.h>
 #include <xf86.h>
 #define GLAMOR_FOR_XORG
 #include <xf86Module.h>
diff --git a/glamor/glamor_priv.h b/glamor/glamor_priv.h
index 57a4687..385c027 100644
--- a/glamor/glamor_priv.h
+++ b/glamor/glamor_priv.h
@@ -29,7 +29,6 @@
 
 #include "dix-config.h"
 
-#include <xorg-server.h>
 #include "glamor.h"
 #include "xvdix.h"
 
diff --git a/hw/xwayland/xwayland.h b/hw/xwayland/xwayland.h
index fc68550..60b0c29 100644
--- a/hw/xwayland/xwayland.h
+++ b/hw/xwayland/xwayland.h
@@ -27,7 +27,6 @@
 #define XWAYLAND_H
 
 #include <dix-config.h>
-#include <xorg-server.h>
 
 #include <stdio.h>
 #include <unistd.h>
diff --git a/include/xorg-server.h.in b/include/xorg-server.h.in
index 8bf9d38..09b79b6 100644
--- a/include/xorg-server.h.in
+++ b/include/xorg-server.h.in
@@ -16,6 +16,10 @@
 #ifndef _XORG_SERVER_H_
 #define _XORG_SERVER_H_
 
+#ifdef HAVE_XORG_CONFIG_H
+#error Include xorg-config.h when building the X server
+#endif
+
 /* Support BigRequests extension */
 #undef BIGREQS
 
commit a08e7a098aa37351294a25fe62b7ff6e95622e64
Author: Adam Jackson <ajax at redhat.com>
Date:   Tue Jun 24 14:21:57 2014 -0400

    dri1: Remove unused DRI{,Post}ValidateTree
    
    i810, mga, savage, and tdfx do reference these slots, but only to set
    them to NULL, so while this does have API impact it's not actually used.
    
    Reviewed-by: Keith Packard <keithp at keithp.com>
    Signed-off-by: Adam Jackson <ajax at redhat.com>

diff --git a/hw/xfree86/dri/dri.c b/hw/xfree86/dri/dri.c
index 95828bb..3f2f6a9 100644
--- a/hw/xfree86/dri/dri.c
+++ b/hw/xfree86/dri/dri.c
@@ -595,14 +595,6 @@ DRIFinishScreenInit(ScreenPtr pScreen)
     DRIInfoPtr pDRIInfo = pDRIPriv->pDriverInfo;
 
     /* Wrap DRI support */
-    if (pDRIInfo->wrap.ValidateTree) {
-        pDRIPriv->wrap.ValidateTree = pScreen->ValidateTree;
-        pScreen->ValidateTree = pDRIInfo->wrap.ValidateTree;
-    }
-    if (pDRIInfo->wrap.PostValidateTree) {
-        pDRIPriv->wrap.PostValidateTree = pScreen->PostValidateTree;
-        pScreen->PostValidateTree = pDRIInfo->wrap.PostValidateTree;
-    }
     if (pDRIInfo->wrap.WindowExposures) {
         pDRIPriv->wrap.WindowExposures = pScreen->WindowExposures;
         pScreen->WindowExposures = pDRIInfo->wrap.WindowExposures;
@@ -652,14 +644,6 @@ DRICloseScreen(ScreenPtr pScreen)
 
         if (pDRIPriv->wrapped) {
             /* Unwrap DRI Functions */
-            if (pDRIInfo->wrap.ValidateTree) {
-                pScreen->ValidateTree = pDRIPriv->wrap.ValidateTree;
-                pDRIPriv->wrap.ValidateTree = NULL;
-            }
-            if (pDRIInfo->wrap.PostValidateTree) {
-                pScreen->PostValidateTree = pDRIPriv->wrap.PostValidateTree;
-                pDRIPriv->wrap.PostValidateTree = NULL;
-            }
             if (pDRIInfo->wrap.WindowExposures) {
                 pScreen->WindowExposures = pDRIPriv->wrap.WindowExposures;
                 pDRIPriv->wrap.WindowExposures = NULL;
@@ -1601,8 +1585,6 @@ DRICreateInfoRec(void)
     inforec->wrap.BlockHandler = DRIDoBlockHandler;
     inforec->wrap.WindowExposures = DRIWindowExposures;
     inforec->wrap.CopyWindow = DRICopyWindow;
-    inforec->wrap.ValidateTree = DRIValidateTree;
-    inforec->wrap.PostValidateTree = DRIPostValidateTree;
     inforec->wrap.ClipNotify = DRIClipNotify;
     inforec->wrap.AdjustFrame = DRIAdjustFrame;
 
@@ -2064,61 +2046,6 @@ DRILockTree(ScreenPtr pScreen)
     }
 }
 
-int
-DRIValidateTree(WindowPtr pParent, WindowPtr pChild, VTKind kind)
-{
-    ScreenPtr pScreen = pParent->drawable.pScreen;
-    DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen);
-
-    int returnValue = 1;        /* always return 1, not checked by dix/window.c */
-
-    if (!pDRIPriv)
-        return returnValue;
-
-    /* call lower wrapped functions */
-    if (pDRIPriv->wrap.ValidateTree) {
-        /* unwrap */
-        pScreen->ValidateTree = pDRIPriv->wrap.ValidateTree;
-
-        /* call lower layers */
-        returnValue = (*pScreen->ValidateTree) (pParent, pChild, kind);
-
-        /* rewrap */
-        pDRIPriv->wrap.ValidateTree = pScreen->ValidateTree;
-        pScreen->ValidateTree = DRIValidateTree;
-    }
-
-    return returnValue;
-}
-
-void
-DRIPostValidateTree(WindowPtr pParent, WindowPtr pChild, VTKind kind)
-{
-    ScreenPtr pScreen;
-    DRIScreenPrivPtr pDRIPriv;
-
-    if (pParent) {
-        pScreen = pParent->drawable.pScreen;
-    }
-    else {
-        pScreen = pChild->drawable.pScreen;
-    }
-    if (!(pDRIPriv = DRI_SCREEN_PRIV(pScreen)))
-        return;
-
-    if (pDRIPriv->wrap.PostValidateTree) {
-        /* unwrap */
-        pScreen->PostValidateTree = pDRIPriv->wrap.PostValidateTree;
-
-        /* call lower layers */
-        (*pScreen->PostValidateTree) (pParent, pChild, kind);
-
-        /* rewrap */
-        pDRIPriv->wrap.PostValidateTree = pScreen->PostValidateTree;
-        pScreen->PostValidateTree = DRIPostValidateTree;
-    }
-}
-
 void
 DRIClipNotify(WindowPtr pWin, int dx, int dy)
 {
diff --git a/hw/xfree86/dri/dri.h b/hw/xfree86/dri/dri.h
index 64cd7c9..dec6885 100644
--- a/hw/xfree86/dri/dri.h
+++ b/hw/xfree86/dri/dri.h
@@ -85,8 +85,6 @@ typedef struct {
     ScreenBlockHandlerProcPtr BlockHandler;
     WindowExposuresProcPtr WindowExposures;
     CopyWindowProcPtr CopyWindow;
-    ValidateTreeProcPtr ValidateTree;
-    PostValidateTreeProcPtr PostValidateTree;
     ClipNotifyProcPtr ClipNotify;
     AdjustFramePtr AdjustFrame;
 } DRIWrappedFuncsRec, *DRIWrappedFuncsPtr;
@@ -290,12 +288,6 @@ extern _X_EXPORT Bool DRIDestroyWindow(WindowPtr pWin);
 extern _X_EXPORT void DRICopyWindow(WindowPtr pWin,
                                     DDXPointRec ptOldOrg, RegionPtr prgnSrc);
 
-extern _X_EXPORT int DRIValidateTree(WindowPtr pParent,
-                                     WindowPtr pChild, VTKind kind);
-
-extern _X_EXPORT void DRIPostValidateTree(WindowPtr pParent,
-                                          WindowPtr pChild, VTKind kind);
-
 extern _X_EXPORT void DRIClipNotify(WindowPtr pWin, int dx, int dy);
 
 extern _X_EXPORT CARD32 DRIGetDrawableIndex(WindowPtr pWin);
commit 5486c834fa3eebd79a4811143e513d6a92b7e504
Author: Adam Jackson <ajax at redhat.com>
Date:   Tue Jun 24 14:16:55 2014 -0400

    xquartz: Remove unused DRI{,Post}ValidateTree
    
    Cargo-culted from DRI1, not actually used for anything.
    
    Reviewed-by: Jeremy Huddleston Sequoia <jeremyhu at apple.com>
    Reviewed-by: Keith Packard <keithp at keithp.com>
    Signed-off-by: Adam Jackson <ajax at redhat.com>

diff --git a/hw/xquartz/xpr/dri.c b/hw/xquartz/xpr/dri.c
index 014709b..0f19047 100644
--- a/hw/xquartz/xpr/dri.c
+++ b/hw/xquartz/xpr/dri.c
@@ -138,12 +138,6 @@ DRIFinishScreenInit(ScreenPtr pScreen)
     DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen);
 
     /* Wrap DRI support */
-    pDRIPriv->wrap.ValidateTree = pScreen->ValidateTree;
-    pScreen->ValidateTree = DRIValidateTree;
-
-    pDRIPriv->wrap.PostValidateTree = pScreen->PostValidateTree;
-    pScreen->PostValidateTree = DRIPostValidateTree;
-
     pDRIPriv->wrap.WindowExposures = pScreen->WindowExposures;
     pScreen->WindowExposures = DRIWindowExposures;
 
@@ -624,51 +618,6 @@ DRICopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc)
     pScreen->CopyWindow = DRICopyWindow;
 }
 
-int
-DRIValidateTree(WindowPtr pParent, WindowPtr pChild, VTKind kind)
-{
-    ScreenPtr pScreen = pParent->drawable.pScreen;
-    DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen);
-    int returnValue;
-
-    /* unwrap */
-    pScreen->ValidateTree = pDRIPriv->wrap.ValidateTree;
-
-    /* call lower layers */
-    returnValue = (*pScreen->ValidateTree)(pParent, pChild, kind);
-
-    /* rewrap */
-    pScreen->ValidateTree = DRIValidateTree;
-
-    return returnValue;
-}
-
-void
-DRIPostValidateTree(WindowPtr pParent, WindowPtr pChild, VTKind kind)
-{
-    ScreenPtr pScreen;
-    DRIScreenPrivPtr pDRIPriv;
-
-    if (pParent) {
-        pScreen = pParent->drawable.pScreen;
-    }
-    else {
-        pScreen = pChild->drawable.pScreen;
-    }
-    pDRIPriv = DRI_SCREEN_PRIV(pScreen);
-
-    if (pDRIPriv->wrap.PostValidateTree) {
-        /* unwrap */
-        pScreen->PostValidateTree = pDRIPriv->wrap.PostValidateTree;
-
-        /* call lower layers */
-        (*pScreen->PostValidateTree)(pParent, pChild, kind);
-
-        /* rewrap */
-        pScreen->PostValidateTree = DRIPostValidateTree;
-    }
-}
-
 void
 DRIClipNotify(WindowPtr pWin, int dx, int dy)
 {
diff --git a/hw/xquartz/xpr/dri.h b/hw/xquartz/xpr/dri.h
index 70cb8b6..4476b06 100644
--- a/hw/xquartz/xpr/dri.h
+++ b/hw/xquartz/xpr/dri.h
@@ -53,8 +53,6 @@ typedef void (*ClipNotifyPtr)(WindowPtr, int, int);
 typedef struct {
     WindowExposuresProcPtr WindowExposures;
     CopyWindowProcPtr CopyWindow;
-    ValidateTreeProcPtr ValidateTree;
-    PostValidateTreeProcPtr PostValidateTree;
     ClipNotifyProcPtr ClipNotify;
 } DRIWrappedFuncsRec, *DRIWrappedFuncsPtr;
 
@@ -107,12 +105,6 @@ DRIGetWrappedFuncs(ScreenPtr pScreen);
 extern void
 DRICopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc);
 
-extern int
-DRIValidateTree(WindowPtr pParent, WindowPtr pChild, VTKind kind);
-
-extern void
-DRIPostValidateTree(WindowPtr pParent, WindowPtr pChild, VTKind kind);
-
 extern void
 DRIClipNotify(WindowPtr pWin, int dx, int dy);
 
commit a5e7701058c676231d2bc3f9a0c7c0fa9da7ad45
Author: Adam Jackson <ajax at redhat.com>
Date:   Wed May 28 14:48:14 2014 -0400

    xkb: Remove some fascinating paranoia from event emission
    
    XkbInterestPtrs are created by clients that already exist, meaning,
    clients that have already had ProcVector installed as something other
    than InitialProcVector.
    
    Reviewed-by: Daniel Stone <daniel at fooishbar.org>
    Signed-off-by: Adam Jackson <ajax at redhat.com>

diff --git a/xkb/xkbEvents.c b/xkb/xkbEvents.c
index 210d8eb..cc9a535 100644
--- a/xkb/xkbEvents.c
+++ b/xkb/xkbEvents.c
@@ -237,7 +237,6 @@ XkbSendStateNotify(DeviceIntPtr kbd, xkbStateNotify * pSN)
 
     while (interest) {
         if ((!interest->client->clientGone) &&
-            (interest->client->requestVector != InitialVector) &&
             (interest->client->xkbClientFlags & _XkbClientInitialized) &&
             (interest->stateNotifyMask & changed)) {
             pSN->sequenceNumber = interest->client->sequence;
@@ -400,7 +399,6 @@ XkbSendControlsNotify(DeviceIntPtr kbd, xkbControlsNotify * pCN)
     pCN->numGroups = xkbi->desc->ctrls->num_groups;
     while (interest) {
         if ((!interest->client->clientGone) &&
-            (interest->client->requestVector != InitialVector) &&
             (interest->client->xkbClientFlags & _XkbClientInitialized) &&
             (interest->ctrlsNotifyMask & changedControls)) {
             if (!initialized) {
@@ -447,7 +445,6 @@ XkbSendIndicatorNotify(DeviceIntPtr kbd, int xkbType, xkbIndicatorNotify * pEv)
     changed = pEv->changed;
     while (interest) {
         if ((!interest->client->clientGone) &&
-            (interest->client->requestVector != InitialVector) &&
             (interest->client->xkbClientFlags & _XkbClientInitialized) &&
             (((xkbType == XkbIndicatorStateNotify) &&
               (interest->iStateNotifyMask & changed)) ||
@@ -528,7 +525,6 @@ XkbHandleBell(BOOL force,
     initialized = 0;
     while (interest) {
         if ((!interest->client->clientGone) &&
-            (interest->client->requestVector != InitialVector) &&
             (interest->client->xkbClientFlags & _XkbClientInitialized) &&
             (interest->bellNotifyMask)) {
             if (!initialized) {
@@ -581,7 +577,6 @@ XkbSendAccessXNotify(DeviceIntPtr kbd, xkbAccessXNotify * pEv)
     db_delay = pEv->debounceDelay;
     while (interest) {
         if ((!interest->client->clientGone) &&
-            (interest->client->requestVector != InitialVector) &&
             (interest->client->xkbClientFlags & _XkbClientInitialized) &&
             (interest->accessXNotifyMask & (1 << pEv->detail))) {
             if (!initialized) {
@@ -627,7 +622,6 @@ XkbSendNamesNotify(DeviceIntPtr kbd, xkbNamesNotify * pEv)
     changedVirtualMods = pEv->changedVirtualMods;
     while (interest) {
         if ((!interest->client->clientGone) &&
-            (interest->client->requestVector != InitialVector) &&
             (interest->client->xkbClientFlags & _XkbClientInitialized) &&
             (interest->namesNotifyMask & pEv->changed)) {
             if (!initialized) {
@@ -671,7 +665,6 @@ XkbSendCompatMapNotify(DeviceIntPtr kbd, xkbCompatMapNotify * pEv)
     initialized = 0;
     while (interest) {
         if ((!interest->client->clientGone) &&
-            (interest->client->requestVector != InitialVector) &&
             (interest->client->xkbClientFlags & _XkbClientInitialized) &&
             (interest->compatNotifyMask)) {
             if (!initialized) {
@@ -722,7 +715,6 @@ XkbSendActionMessage(DeviceIntPtr kbd, xkbActionMessage * pEv)
     pEv->group = xkbi->state.group;
     while (interest) {
         if ((!interest->client->clientGone) &&
-            (interest->client->requestVector != InitialVector) &&
             (interest->client->xkbClientFlags & _XkbClientInitialized) &&
             (interest->actionMessageMask)) {
             if (!initialized) {
@@ -766,7 +758,6 @@ XkbSendExtensionDeviceNotify(DeviceIntPtr dev,
     state = pEv->ledState;
     while (interest) {
         if ((!interest->client->clientGone) &&
-            (interest->client->requestVector != InitialVector) &&
             (interest->client->xkbClientFlags & _XkbClientInitialized) &&
             (interest->extDevNotifyMask & reason)) {
             if (!initialized) {
commit ac3af4bd21394291ef6dd9cfcdd8ce6fceefec40
Author: Adam Jackson <ajax at redhat.com>
Date:   Tue Jun 17 12:58:41 2014 -0400

    xfree86: Remove unused HardEdges
    
    Reviewed-by: Alex Deucher <alexander.deucher at amd.com>
    Signed-off-by: Adam Jackson <ajax at redhat.com>

diff --git a/hw/xfree86/common/xf86Cursor.c b/hw/xfree86/common/xf86Cursor.c
index c6abf12..92c08af 100644
--- a/hw/xfree86/common/xf86Cursor.c
+++ b/hw/xfree86/common/xf86Cursor.c
@@ -74,8 +74,6 @@ static miPointerScreenFuncRec xf86PointerScreenFuncs = {
 
 static xf86ScreenLayoutRec xf86ScreenLayout[MAXSCREENS];
 
-static Bool HardEdges;
-
 /*
  * xf86InitViewport --
  *      Initialize paning & zooming parameters, so that a driver must only
@@ -429,16 +427,6 @@ xf86CursorOffScreen(ScreenPtr *pScreen, int *x, int *y)
         }
     }
 
-#if 0
-    /* This presents problems for overlapping screens when
-       HardEdges is used.  Have to think about the logic more */
-    if ((*x < 0) || (*x >= (*pScreen)->width) ||
-        (*y < 0) || (*y >= (*pScreen)->height)) {
-        /* We may have crossed more than one screen */
-        xf86CursorOffScreen(pScreen, x, y);
-    }
-#endif
-
     return TRUE;
 }
 
@@ -582,9 +570,6 @@ xf86InitOrigins(void)
     xf86ScreenLayoutPtr pLayout;
     Bool OldStyleConfig = FALSE;
 
-    /* need to have this set up with a config file option */
-    HardEdges = FALSE;
-
     memset(xf86ScreenLayout, 0, MAXSCREENS * sizeof(xf86ScreenLayoutRec));
 
     screensLeft = prevScreensLeft = (1 << xf86NumScreens) - 1;
@@ -836,7 +821,7 @@ xf86InitOrigins(void)
         }
     }
 
-    if (!HardEdges && !OldStyleConfig) {
+    if (!OldStyleConfig) {
         for (i = 0; i < xf86NumScreens; i++) {
             pLayout = &xf86ScreenLayout[i];
             pScreen = xf86Screens[i]->pScreen;
commit 4100687ea667970733c3aa69f704be0e3747f9fd
Author: Adam Jackson <ajax at redhat.com>
Date:   Mon Jun 23 15:42:23 2014 -0400

    xfree86: Remove useless #include "fb.h"
    
    Reviewed-by: Alex Deucher <alexander.deucher at amd.com>
    Signed-off-by: Adam Jackson <ajax at redhat.com>

diff --git a/hw/xfree86/modes/xf86Rotate.c b/hw/xfree86/modes/xf86Rotate.c
index 1627e61..54cbf2e 100644
--- a/hw/xfree86/modes/xf86Rotate.c
+++ b/hw/xfree86/modes/xf86Rotate.c
@@ -35,7 +35,6 @@
 
 #include "xf86.h"
 #include "xf86DDC.h"
-#include "fb.h"
 #include "windowstr.h"
 #include "xf86Crtc.h"
 #include "xf86Modes.h"
commit 2d451c5cdc7f81ea0c94c3542fab45027f829736
Author: Adam Jackson <ajax at redhat.com>
Date:   Thu May 22 14:04:16 2014 -0400

    xfree86: Remove pointless xf86RandRCreateScreenResources
    
    Given the #if 0 this was wrapping for no effect.
    
    Reviewed-by: Keith Packard <keithp at keithp.com>
    Signed-off-by: Adam Jackson <ajax at redhat.com>

diff --git a/hw/xfree86/common/xf86RandR.c b/hw/xfree86/common/xf86RandR.c
index 2418731..08f656b 100644
--- a/hw/xfree86/common/xf86RandR.c
+++ b/hw/xfree86/common/xf86RandR.c
@@ -37,7 +37,6 @@
 #include "inputstr.h"
 
 typedef struct _xf86RandRInfo {
-    CreateScreenResourcesProcPtr CreateScreenResources;
     CloseScreenProcPtr CloseScreen;
     int virtualX;
     int virtualY;
@@ -336,34 +335,6 @@ xf86RandRSetConfig(ScreenPtr pScreen,
 }
 
 /*
- * Wait until the screen is initialized before whacking the
- * sizes around; otherwise the screen pixmap will be allocated
- * at the current mode size rather than the maximum size
- */
-static Bool
-xf86RandRCreateScreenResources(ScreenPtr pScreen)
-{
-    XF86RandRInfoPtr randrp = XF86RANDRINFO(pScreen);
-
-#if 0
-    ScrnInfoPtr scrp = xf86ScreenToScrn(pScreen);
-    DisplayModePtr mode;
-#endif
-
-    pScreen->CreateScreenResources = randrp->CreateScreenResources;
-    if (!(*pScreen->CreateScreenResources) (pScreen))
-        return FALSE;
-
-#if 0
-    mode = scrp->currentMode;
-    if (mode)
-        xf86RandRSetMode(pScreen, mode, TRUE);
-#endif
-
-    return TRUE;
-}
-
-/*
  * Reset size back to original
  */
 static Bool
@@ -463,9 +434,6 @@ xf86RandRInit(ScreenPtr pScreen)
     randrp->mmWidth = pScreen->mmWidth;
     randrp->mmHeight = pScreen->mmHeight;
 
-    randrp->CreateScreenResources = pScreen->CreateScreenResources;
-    pScreen->CreateScreenResources = xf86RandRCreateScreenResources;
-
     randrp->CloseScreen = pScreen->CloseScreen;
     pScreen->CloseScreen = xf86RandRCloseScreen;
 
commit a8cca7bd5ad7ea36a9585f4927ed53cfa6db1daf
Author: Adam Jackson <ajax at redhat.com>
Date:   Fri May 2 11:43:14 2014 -0400

    xfree86: Remove protectMem from VidMemInfo
    
    Never filled in.
    
    Reviewed-by: Keith Packard <keithp at keithp.com>
    Signed-off-by: Adam Jackson <ajax at redhat.com>

diff --git a/hw/xfree86/os-support/xf86OSpriv.h b/hw/xfree86/os-support/xf86OSpriv.h
index 7f003e8..b56f45a 100644
--- a/hw/xfree86/os-support/xf86OSpriv.h
+++ b/hw/xfree86/os-support/xf86OSpriv.h
@@ -36,14 +36,12 @@ typedef void *(*MapMemProcPtr) (int, unsigned long, unsigned long, int);
 typedef void (*UnmapMemProcPtr) (int, void *, unsigned long);
 typedef void *(*SetWCProcPtr) (int, unsigned long, unsigned long, Bool,
                                  MessageType);
-typedef void (*ProtectMemProcPtr) (int, void *, unsigned long, Bool);
 typedef void (*UndoWCProcPtr) (int, void *);
 
 typedef struct {
     Bool initialised;
     MapMemProcPtr mapMem;
     UnmapMemProcPtr unmapMem;
-    ProtectMemProcPtr protectMem;
     SetWCProcPtr setWC;
     UndoWCProcPtr undoWC;
     Bool linearSupported;
commit e4cf1e58f5745dd39a9dd5eb29acd1cb28710094
Author: Adam Jackson <ajax at redhat.com>
Date:   Fri May 2 11:11:14 2014 -0400

    xfree86: Remove unused xf86{Map,Unmap}LegacyIO
    
    I ported these to pciaccess in:
    
        commit 858fbbb40d7c69540cd1fb5315cebf811c6e7b3f
        Author: Adam Jackson <ajax at redhat.com>
        Date:   Fri Sep 16 13:33:04 2011 -0400
    
            pci: Port xf86MapLegacyIO to pciaccess
    
    As of yet there are still no drivers using them, and there's not a lot
    of value in having the wrappers when they just trivially call pciaccess
    anyway.  Nuke 'em.
    
    Reviewed-by: Keith Packard <keithp at keithp.com>
    Signed-off-by: Adam Jackson <ajax at redhat.com>

diff --git a/hw/xfree86/common/xf86pciBus.c b/hw/xfree86/common/xf86pciBus.c
index 33fbd7f..e86ecb9 100644
--- a/hw/xfree86/common/xf86pciBus.c
+++ b/hw/xfree86/common/xf86pciBus.c
@@ -1473,15 +1473,3 @@ xf86PciConfigureNewDev(void *busData, struct pci_device *pVideo,
     if (*chipset < 0)
         *chipset = (pVideo->vendor_id << 16) | pVideo->device_id;
 }
-
-struct pci_io_handle *
-xf86MapLegacyIO(struct pci_device *dev)
-{
-    return pci_legacy_open_io(dev, 0, 64 * 1024);
-}
-
-void
-xf86UnmapLegacyIO(struct pci_device *dev, struct pci_io_handle *handle)
-{
-    pci_device_close_io(dev, handle);
-}
diff --git a/hw/xfree86/os-support/bus/xf86Pci.h b/hw/xfree86/os-support/bus/xf86Pci.h
index 5b34310..210ab3d 100644
--- a/hw/xfree86/os-support/bus/xf86Pci.h
+++ b/hw/xfree86/os-support/bus/xf86Pci.h
@@ -235,9 +235,4 @@
 /* Public PCI access functions */
 extern _X_EXPORT Bool xf86scanpci(void);
 
-/* Domain access functions.  Some of these probably shouldn't be public */
-extern _X_EXPORT struct pci_io_handle *xf86MapLegacyIO(struct pci_device *dev);
-extern _X_EXPORT void xf86UnmapLegacyIO(struct pci_device *,
-                                        struct pci_io_handle *);
-
 #endif                          /* _XF86PCI_H */
commit 96206cf47752af3fc8ca14dc1e03c59ed482167f
Author: Adam Jackson <ajax at redhat.com>
Date:   Tue Jul 8 13:19:08 2014 -0400

    xfree86: Remove deprecated PCI types
    
    Reviewed-by: Keith Packard <keithp at keithp.com>
    Signed-off-by: Adam Jackson <ajax at redhat.com>

diff --git a/hw/xfree86/os-support/bus/xf86Pci.h b/hw/xfree86/os-support/bus/xf86Pci.h
index 0397796..5b34310 100644
--- a/hw/xfree86/os-support/bus/xf86Pci.h
+++ b/hw/xfree86/os-support/bus/xf86Pci.h
@@ -232,10 +232,6 @@
  * Typedefs, etc...
  */
 
-/* Primitive Types */
-typedef unsigned long IOADDRESS _X_DEPRECATED;  /* Must be large enough for a pointer */
-typedef CARD32 PCITAG _X_DEPRECATED;
-
 /* Public PCI access functions */
 extern _X_EXPORT Bool xf86scanpci(void);
 
commit 46fd5a28ef7191b5ad0244f849c756dd2c5f43b6
Author: Adam Jackson <ajax at redhat.com>
Date:   Fri May 2 11:09:53 2014 -0400

    xfree86: Remove some unused pre-pciaccess types
    
    Reviewed-by: Keith Packard <keithp at keithp.com>
    Signed-off-by: Adam Jackson <ajax at redhat.com>

diff --git a/hw/xfree86/os-support/bus/xf86Pci.h b/hw/xfree86/os-support/bus/xf86Pci.h
index f69e55b..0397796 100644
--- a/hw/xfree86/os-support/bus/xf86Pci.h
+++ b/hw/xfree86/os-support/bus/xf86Pci.h
@@ -233,21 +233,9 @@
  */
 
 /* Primitive Types */
-typedef unsigned long ADDRESS;  /* Memory/PCI address */
 typedef unsigned long IOADDRESS _X_DEPRECATED;  /* Must be large enough for a pointer */
 typedef CARD32 PCITAG _X_DEPRECATED;
 
-typedef enum {
-    PCI_MEM,
-    PCI_MEM_SIZE,
-    PCI_MEM_SPARSE_BASE,
-    PCI_MEM_SPARSE_MASK,
-    PCI_IO,
-    PCI_IO_SIZE,
-    PCI_IO_SPARSE_BASE,
-    PCI_IO_SPARSE_MASK
-} PciAddrType;
-
 /* Public PCI access functions */
 extern _X_EXPORT Bool xf86scanpci(void);
 
commit 3bb9f9862b5bea3720ba7922714af729cab38776
Author: Adam Jackson <ajax at redhat.com>
Date:   Fri Feb 28 13:31:08 2014 -0500

    xfree86: Remove xf86ConfigActivePciEntity
    
    The giant OBSOLETE DO NOT USE comment has been there since 2000,
    probably it's safe to nuke by now.
    
    Reviewed-by: Alex Deucher <alexander.deucher at amd.com>
    Signed-off-by: Adam Jackson <ajax at redhat.com>

diff --git a/hw/xfree86/common/xf86.h b/hw/xfree86/common/xf86.h
index cec3135..49ff35b 100644
--- a/hw/xfree86/common/xf86.h
+++ b/hw/xfree86/common/xf86.h
@@ -129,14 +129,6 @@ extern _X_EXPORT ScrnInfoPtr xf86ConfigPciEntity(ScrnInfoPtr pScrn,
                                                  EntityProc enter,
                                                  EntityProc leave,
                                                  void *private);
-/* Obsolete! don't use */
-extern _X_EXPORT Bool xf86ConfigActivePciEntity(ScrnInfoPtr pScrn,
-                                                int entityIndex,
-                                                PciChipsets * p_chip,
-                                                void *dummy, EntityProc init,
-                                                EntityProc enter,
-                                                EntityProc leave,
-                                                void *private);
 #else
 #define xf86VGAarbiterInit() do {} while (0)
 #define xf86VGAarbiterFini() do {} while (0)
diff --git a/hw/xfree86/common/xf86pciBus.c b/hw/xfree86/common/xf86pciBus.c
index c06b040..33fbd7f 100644
--- a/hw/xfree86/common/xf86pciBus.c
+++ b/hw/xfree86/common/xf86pciBus.c
@@ -1061,33 +1061,6 @@ xf86ConfigPciEntity(ScrnInfoPtr pScrn, int scrnFlag, int entityIndex,
     return pScrn;
 }
 
-/*
- *  OBSOLETE ! xf86ConfigActivePciEntity() is an obsolete function.
- *             It is likely to be removed. Don't use!
- */
-Bool
-xf86ConfigActivePciEntity(ScrnInfoPtr pScrn, int entityIndex,
-                          PciChipsets * p_chip, void *dummy, EntityProc init,
-                          EntityProc enter, EntityProc leave, void *private)
-{
-    EntityInfoPtr pEnt = xf86GetEntityInfo(entityIndex);
-
-    if (!pEnt)
-        return FALSE;
-
-    if (!pEnt->active || !(pEnt->location.type == BUS_PCI)) {
-        free(pEnt);
-        return FALSE;
-    }
-    xf86AddEntityToScreen(pScrn, entityIndex);
-
-    free(pEnt);
-    if (!xf86SetEntityFuncs(entityIndex, init, enter, leave, private))
-        return FALSE;
-
-    return TRUE;
-}
-
 int
 xf86VideoPtrToDriverList(struct pci_device *dev,
                      char *returnList[], int returnListMax)
commit 51531a67179e342f6ad798de21accf014748a04f
Author: Adam Jackson <ajax at redhat.com>
Date:   Tue Jun 10 13:10:28 2014 -0400

    vgahw: Nuke unused vgaCmap.c
    
    Never been built since m12n, can't be needed.
    
    Reviewed-by: Keith Packard <keithp at keithp.com>
    Signed-off-by: Adam Jackson <ajax at redhat.com>

diff --git a/hw/xfree86/doc/ddxDesign.xml b/hw/xfree86/doc/ddxDesign.xml
index d1fd9af..fcf2228 100644
--- a/hw/xfree86/doc/ddxDesign.xml
+++ b/hw/xfree86/doc/ddxDesign.xml
@@ -9094,8 +9094,7 @@ ZZZScreenInit(ScreenPtr pScreen, int argc, char **argv)
     xf86SetBlackWhitePixels(pScreen);
 
     /*
-     * Install colourmap functions.  If using the vgahw module,
-     * vgaHandleColormaps would usually be called here.
+     * Install colourmap functions.
      */
 
     ...
diff --git a/hw/xfree86/vgahw/Makefile.am b/hw/xfree86/vgahw/Makefile.am
index 4b718b4..b8196a6 100644
--- a/hw/xfree86/vgahw/Makefile.am
+++ b/hw/xfree86/vgahw/Makefile.am
@@ -6,5 +6,3 @@ AM_CPPFLAGS = $(XORG_INCS) -I$(srcdir)/../ddc -I$(srcdir)/../i2c
 AM_CFLAGS = $(DIX_CFLAGS) $(XORG_CFLAGS)
 
 sdk_HEADERS = vgaHW.h
-
-EXTRA_DIST = vgaCmap.c
diff --git a/hw/xfree86/vgahw/vgaCmap.c b/hw/xfree86/vgahw/vgaCmap.c
deleted file mode 100644
index bf61225..0000000
--- a/hw/xfree86/vgahw/vgaCmap.c
+++ /dev/null
@@ -1,275 +0,0 @@
-/*
- * Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany.
- *
- * Permission to use, copy, modify, distribute, and sell this software and its
- * documentation for any purpose is hereby granted without fee, provided that
- * the above copyright notice appear in all copies and that both that
- * copyright notice and this permission notice appear in supporting
- * documentation, and that the name of Thomas Roell not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission.  Thomas Roell makes no representations
- * about the suitability of this software for any purpose.  It is provided
- * "as is" without express or implied warranty.
- *
- * THOMAS ROELL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL THOMAS ROELL BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- * PERFORMANCE OF THIS SOFTWARE.
- *
- */
-
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include <X11/X.h>
-#include <X11/Xproto.h>
-#include "windowstr.h"
-#include "mipointer.h"
-#include "micmap.h"
-
-#include "xf86.h"
-#include "vgaHW.h"
-
-#include <X11/extensions/xf86dgaproto.h>
-#include "dgaproc.h"
-
-#define NOMAPYET        (ColormapPtr) 0
-
-int
-vgaListInstalledColormaps(pScreen, pmaps)
-ScreenPtr pScreen;
-Colormap *pmaps;
-{
-    /* By the time we are processing requests, we can guarantee that there
-     * is always a colormap installed */
-
-    *pmaps = GetInstalledmiColormap(pScreen)->mid;
-    return 1;
-}
-
-int
-vgaGetInstalledColormaps(pScreen, pmaps)
-ScreenPtr pScreen;
-ColormapPtr *pmaps;
-{
-    /* By the time we are processing requests, we can guarantee that there
-     * is always a colormap installed */
-
-    *pmaps = GetInstalledmiColormap(pScreen);
-    return 1;
-}
-
-int
-vgaCheckColorMap(ColormapPtr pmap)
-{
-    return (pmap != GetInstalledmiColormap(pmap->pScreen));
-}
-
-void
-vgaStoreColors(pmap, ndef, pdefs)
-ColormapPtr pmap;
-int ndef;
-xColorItem *pdefs;
-{
-    int i;
-    unsigned char *cmap, *tmp = NULL;
-    xColorItem directDefs[256];
-    Bool new_overscan = FALSE;
-    Bool writeColormap;
-    int scrnIndex = pmap->pScreen->myNum;
-    ScrnInfoPtr scrninfp = xf86ScreenToScrn(pmap->pScreen);
-    vgaHWPtr hwp = VGAHWPTR(scrninfp);
-
-    unsigned char overscan = hwp->ModeReg.Attribute[OVERSCAN];
-    unsigned char tmp_overscan = 0;
-
-    if (vgaCheckColorMap(pmap))
-        return;
-
-    if ((pmap->pVisual->class | DynamicClass) == DirectColor) {
-        ndef = miExpandDirectColors(pmap, ndef, pdefs, directDefs);
-        pdefs = directDefs;
-    }
-
-    writeColormap = scrninfp->vtSema;
-    if (DGAScreenAvailable(pmap->pScreen)) {
-        writeColormap = writeColormap ||
-            (DGAGetDirectMode(scrnIndex) &&
-             !(DGAGetFlags(scrnIndex) & XF86DGADirectColormap)) ||
-            (DGAGetFlags(scrnIndex) & XF86DGAHasColormap);
-    }
-
-    if (writeColormap)
-        hwp->enablePalette(hwp);
-
-    for (i = 0; i < ndef; i++) {
-        if (pdefs[i].pixel == overscan) {
-            new_overscan = TRUE;
-        }
-        cmap = &(hwp->ModeReg.DAC[pdefs[i].pixel * 3]);
-        if (scrninfp->rgbBits == 8) {
-            cmap[0] = pdefs[i].red >> 8;
-            cmap[1] = pdefs[i].green >> 8;
-            cmap[2] = pdefs[i].blue >> 8;
-        }
-        else {
-            cmap[0] = pdefs[i].red >> 10;
-            cmap[1] = pdefs[i].green >> 10;
-            cmap[2] = pdefs[i].blue >> 10;
-        }
-#if 0
-        if (clgd6225Lcd) {
-            /* The LCD doesn't like white */
-            if (cmap[0] == 63)
-                cmap[0] = 62;
-            if (cmap[1] == 63)
-                cmap[1] = 62;
-            if (cmap[2] == 63)
-                cmap[2] = 62;
-        }
-#endif
-
-        if (writeColormap) {
-            if (hwp->ShowOverscan && i == 255)
-                continue;
-            hwp->writeDacWriteAddr(hwp, pdefs[i].pixel);
-            DACDelay(hwp);
-            hwp->writeDacData(hwp, cmap[0]);
-            DACDelay(hwp);
-            hwp->writeDacData(hwp, cmap[1]);
-            DACDelay(hwp);
-            hwp->writeDacData(hwp, cmap[2]);
-            DACDelay(hwp);
-        }
-    }
-    if (new_overscan && !hwp->ShowOverscan) {
-        new_overscan = FALSE;
-        for (i = 0; i < ndef; i++) {
-            if (pdefs[i].pixel == overscan) {
-                if ((pdefs[i].red != 0) ||
-                    (pdefs[i].green != 0) || (pdefs[i].blue != 0)) {
-                    new_overscan = TRUE;
-                    tmp_overscan = overscan;
-                    tmp = &(hwp->ModeReg.DAC[pdefs[i].pixel * 3]);
-                }
-                break;
-            }
-        }
-        if (new_overscan) {
-            /*
-             * Find a black pixel, or the nearest match.
-             */
-            for (i = 255; i >= 0; i--) {
-                cmap = &(hwp->ModeReg.DAC[i * 3]);
-                if ((cmap[0] == 0) && (cmap[1] == 0) && (cmap[2] == 0)) {
-                    overscan = i;
-                    break;
-                }
-                else {
-                    if ((cmap[0] < tmp[0]) &&
-                        (cmap[1] < tmp[1]) && (cmap[2] < tmp[2])) {
-                        tmp = cmap;
-                        tmp_overscan = i;
-                    }
-                }
-            }
-            if (i < 0) {
-                overscan = tmp_overscan;
-            }
-            hwp->ModeReg.Attribute[OVERSCAN] = overscan;
-            if (writeColormap) {
-                hwp->writeAttr(hwp, OVERSCAN, overscan);
-            }
-        }
-    }
-
-    if (writeColormap)
-        hwp->disablePalette(hwp);
-}
-
-void
-vgaInstallColormap(pmap)
-ColormapPtr pmap;
-{
-    ColormapPtr oldmap = GetInstalledmiColormap(pmap->pScreen);
-    int entries;
-    Pixel *ppix;
-    xrgb *prgb;
-    xColorItem *defs;
-    int i;
-
-    if (pmap == oldmap)
-        return;
-
-    if ((pmap->pVisual->class | DynamicClass) == DirectColor)
-        entries = (pmap->pVisual->redMask |
-                   pmap->pVisual->greenMask | pmap->pVisual->blueMask) + 1;
-    else
-        entries = pmap->pVisual->ColormapEntries;
-
-    ppix = (Pixel *) malloc(entries * sizeof(Pixel));
-    prgb = (xrgb *) malloc(entries * sizeof(xrgb));
-    defs = (xColorItem *) malloc(entries * sizeof(xColorItem));
-
-    if (oldmap != NOMAPYET)
-        WalkTree(pmap->pScreen, TellLostMap, &oldmap->mid);
-
-    SetInstalledmiColormap(pmap->pScreen, pmap);
-
-    for (i = 0; i < entries; i++)
-        ppix[i] = i;
-
-    QueryColors(pmap, entries, ppix, prgb, serverClient);
-
-    for (i = 0; i < entries; i++) {     /* convert xrgbs to xColorItems */
-        defs[i].pixel = ppix[i];
-        defs[i].red = prgb[i].red;
-        defs[i].green = prgb[i].green;
-        defs[i].blue = prgb[i].blue;
-        defs[i].flags = DoRed | DoGreen | DoBlue;
-    }
-    pmap->pScreen->StoreColors(pmap, entries, defs);
-
-    WalkTree(pmap->pScreen, TellGainedMap, &pmap->mid);
-
-    free(ppix);
-    free(prgb);
-    free(defs);
-}
-
-void
-vgaUninstallColormap(pmap)
-ColormapPtr pmap;
-{
-
-    ColormapPtr defColormap;
-
-    if (pmap != GetInstalledmiColormap(pmap->pScreen))
-        return;
-
-    dixLookupResourceByType((void **) &defColormap,
-                            pmap->pScreen->defColormap, RT_COLORMAP,
-                            serverClient, DixInstallAccess);
-
-    if (defColormap == GetInstalledmiColormap(pmap->pScreen))
-        return;
-
-    (*pmap->pScreen->InstallColormap) (defColormap);
-}
-
-void
-vgaHandleColormaps(ScreenPtr pScreen, ScrnInfoPtr scrnp)
-{
-    if (scrnp->bitsPerPixel > 1) {
-        if (scrnp->bitsPerPixel <= 8) { /* For 8bpp SVGA and VGA16 */
-            pScreen->InstallColormap = vgaInstallColormap;
-            pScreen->UninstallColormap = vgaUninstallColormap;
-            pScreen->ListInstalledColormaps = vgaListInstalledColormaps;
-            pScreen->StoreColors = vgaStoreColors;
-        }
-    }
-}
commit 2db71b232c4756773562182cadb7ccdf5194a62d
Author: Adam Jackson <ajax at redhat.com>
Date:   Tue Jun 10 13:00:11 2014 -0400

    saver: Don't open-code IsMapInstalled
    
    Reviewed-by: Keith Packard <keithp at keithp.com>
    Signed-off-by: Adam Jackson <ajax at redhat.com>

diff --git a/Xext/saver.c b/Xext/saver.c
index 8e92fdf..2c14ea0 100644
--- a/Xext/saver.c
+++ b/Xext/saver.c
@@ -467,9 +467,6 @@ CreateSaverWindow(ScreenPtr pScreen)
     WindowPtr pWin;
     int result;
     unsigned long mask;
-    Colormap *installedMaps;
-    int numInstalled;
-    int i;
     Colormap wantMap;
     ColormapPtr pCmap;
 
@@ -545,18 +542,7 @@ CreateSaverWindow(ScreenPtr pScreen)
 
     /* check and install our own colormap if it isn't installed now */
     wantMap = wColormap(pWin);
-    if (wantMap == None)
-        return TRUE;
-    installedMaps = malloc(pScreen->maxInstalledCmaps * sizeof(Colormap));
-    numInstalled = (*pWin->drawable.pScreen->ListInstalledColormaps)
-        (pScreen, installedMaps);
-    for (i = 0; i < numInstalled; i++)
-        if (installedMaps[i] == wantMap)
-            break;
-
-    free((char *) installedMaps);
-
-    if (i < numInstalled)
+    if (wantMap == None || IsMapInstalled(wantMap, pWin))
         return TRUE;
 
     result = dixLookupResourceByType((void **) &pCmap, wantMap, RT_COLORMAP,
commit dd0e8491f75afbd72bea17172a042aa45ff7e30b
Author: Adam Jackson <ajax at redhat.com>
Date:   Fri Jun 20 12:36:10 2014 -0400

    render: Remove unused CopyPicture
    
    Arguably this would be useful API, but it's never called, and a careful
    reading of the CPClipMask path reveals that callers would be fairly
    disappointed.
    
    Reviewed-by: Keith Packard <keithp at keithp.com>
    Signed-off-by: Adam Jackson <ajax at redhat.com>

diff --git a/render/picture.c b/render/picture.c
index 7da9310..58535d4 100644
--- a/render/picture.c
+++ b/render/picture.c
@@ -1332,87 +1332,6 @@ SetPictureTransform(PicturePtr pPicture, PictTransform * transform)
     return Success;
 }
 
-void
-CopyPicture(PicturePtr pSrc, Mask mask, PicturePtr pDst)
-{
-    PictureScreenPtr ps = GetPictureScreen(pSrc->pDrawable->pScreen);
-    Mask origMask = mask;
-
-    pDst->serialNumber |= GC_CHANGE_SERIAL_BIT;
-    pDst->stateChanges |= mask;
-
-    while (mask) {
-        Mask bit = lowbit(mask);
-
-        switch (bit) {
-        case CPRepeat:
-            pDst->repeat = pSrc->repeat;
-            pDst->repeatType = pSrc->repeatType;
-            break;
-        case CPAlphaMap:
-            if (pSrc->alphaMap &&
-                pSrc->alphaMap->pDrawable->type == DRAWABLE_PIXMAP)
-                pSrc->alphaMap->refcnt++;
-            if (pDst->alphaMap)
-                FreePicture((void *) pDst->alphaMap, (XID) 0);
-            pDst->alphaMap = pSrc->alphaMap;
-            break;
-        case CPAlphaXOrigin:
-            pDst->alphaOrigin.x = pSrc->alphaOrigin.x;
-            break;
-        case CPAlphaYOrigin:
-            pDst->alphaOrigin.y = pSrc->alphaOrigin.y;
-            break;
-        case CPClipXOrigin:
-            pDst->clipOrigin.x = pSrc->clipOrigin.x;
-            break;
-        case CPClipYOrigin:
-            pDst->clipOrigin.y = pSrc->clipOrigin.y;
-            break;
-        case CPClipMask:
-            switch (pSrc->clientClipType) {
-            case CT_NONE:
-                (*ps->ChangePictureClip) (pDst, CT_NONE, NULL, 0);
-                break;
-            case CT_REGION:
-                if (!pSrc->clientClip) {
-                    (*ps->ChangePictureClip) (pDst, CT_NONE, NULL, 0);
-                }
-                else {
-                    RegionPtr clientClip;
-                    RegionPtr srcClientClip = (RegionPtr) pSrc->clientClip;
-
-                    clientClip = RegionCreate(RegionExtents(srcClientClip),
-                                              RegionNumRects(srcClientClip));
-                    (*ps->ChangePictureClip) (pDst, CT_REGION, clientClip, 0);
-                }
-                break;
-            default:
-                /* XXX: CT_PIXMAP unimplemented */
-                break;
-            }
-            break;
-        case CPGraphicsExposure:
-            pDst->graphicsExposures = pSrc->graphicsExposures;
-            break;
-        case CPPolyEdge:
-            pDst->polyEdge = pSrc->polyEdge;
-            break;
-        case CPPolyMode:
-            pDst->polyMode = pSrc->polyMode;
-            break;
-        case CPDither:
-            break;
-        case CPComponentAlpha:
-            pDst->componentAlpha = pSrc->componentAlpha;
-            break;
-        }
-        mask &= ~bit;
-    }
-
-    (*ps->ChangePicture) (pDst, origMask);
-}
-
 static void
 ValidateOnePicture(PicturePtr pPicture)
 {
diff --git a/render/picturestr.h b/render/picturestr.h
index 8c8100d..1278f62 100644
--- a/render/picturestr.h
+++ b/render/picturestr.h
@@ -476,9 +476,6 @@ extern _X_EXPORT int
  SetPictureTransform(PicturePtr pPicture, PictTransform * transform);
 
 extern _X_EXPORT void
- CopyPicture(PicturePtr pSrc, Mask mask, PicturePtr pDst);
-
-extern _X_EXPORT void
  ValidatePicture(PicturePtr pPicture);
 
 extern _X_EXPORT int
commit 578026fcd58d12dd0be4c0976ee5ecf95a9d61f0
Author: Adam Jackson <ajax at redhat.com>
Date:   Tue May 20 12:43:59 2014 -0400

    os: Remove LocalClientCred
    
    The comment lies, shm hasn't used this code since:
    
        commit fdef7be5c8d5989e0aa453d0a5b86d0a6952e960
        Author: Alan Coopersmith <alan.coopersmith at sun.com>
        Date:   Tue Oct 9 18:44:04 2007 -0700
    
            Sun bug 6589829: include zoneid of shm segment in access [...]
    
    Reviewed-by: Alan Coopersmith <alan.coopersmith at oracle.com>
    Signed-off-by: Adam Jackson <ajax at redhat.com>

diff --git a/include/os.h b/include/os.h
index 9982c9b..e4ec4b1 100644
--- a/include/os.h
+++ b/include/os.h
@@ -380,9 +380,6 @@ typedef struct sockaddr *sockaddrPtr;
 extern _X_EXPORT int
 InvalidHost(sockaddrPtr /*saddr */ , int /*len */ , ClientPtr client);
 
-extern _X_EXPORT int
-LocalClientCred(ClientPtr, int *, int *);
-
 #define LCC_UID_SET	(1 << 0)
 #define LCC_GID_SET	(1 << 1)
 #define LCC_PID_SET	(1 << 2)
diff --git a/os/access.c b/os/access.c
index 9fcf99a..125f35f 100644
--- a/os/access.c
+++ b/os/access.c
@@ -1008,33 +1008,6 @@ ComputeLocalClient(ClientPtr client)
 }
 
 /*
- * Return the uid and gid of a connected local client
- * 
- * Used by XShm to test access rights to shared memory segments
- */
-int
-LocalClientCred(ClientPtr client, int *pUid, int *pGid)
-{
-    LocalClientCredRec *lcc;
-    int ret = GetLocalClientCreds(client, &lcc);
-
-    if (ret == 0) {
-#ifdef HAVE_GETZONEID           /* only local if in the same zone */
-        if ((lcc->fieldsSet & LCC_ZID_SET) && (lcc->zoneid != getzoneid())) {
-            FreeLocalClientCreds(lcc);
-            return -1;
-        }
-#endif
-        if ((lcc->fieldsSet & LCC_UID_SET) && (pUid != NULL))
-            *pUid = lcc->euid;
-        if ((lcc->fieldsSet & LCC_GID_SET) && (pGid != NULL))
-            *pGid = lcc->egid;
-        FreeLocalClientCreds(lcc);
-    }
-    return ret;
-}
-
-/*
  * Return the uid and all gids of a connected local client
  * Allocates a LocalClientCredRec - caller must call FreeLocalClientCreds
  * 
commit cad9b053d52f62432dfd70e42e0240de77027cae
Author: Adam Jackson <ajax at redhat.com>
Date:   Tue Jul 8 13:24:25 2014 -0400

    os: Remove deprecated malloc/free wrappers
    
    Reviewed-by: Alex Deucher <alexander.deucher at amd.com>
    Signed-off-by: Adam Jackson <ajax at redhat.com>

diff --git a/doc/Xserver-spec.xml b/doc/Xserver-spec.xml
index cd1a9d0..4c34419 100644
--- a/doc/Xserver-spec.xml
+++ b/doc/Xserver-spec.xml
@@ -1217,11 +1217,9 @@ library is contained in dix/dixfonts.c
 <section>
   <title>Memory Management</title>
 <para>
-Memory management is based on functions in the C runtime library.
-Xalloc(), Xrealloc(), and Xfree() are deprecated aliases for malloc(),
+Memory management is based on functions in the C runtime library, malloc(),
 realloc(), and free(), and you should simply call the C library functions
-directly.  Consult a C runtime library reference
-manual for more details.
+directly.  Consult a C runtime library reference manual for more details.
 </para>
 <para>
 Treat memory allocation carefully in your implementation.  Memory
diff --git a/include/os.h b/include/os.h
index 0cbb928..9982c9b 100644
--- a/include/os.h
+++ b/include/os.h
@@ -67,15 +67,11 @@ SOFTWARE.
 typedef struct _FontPathRec *FontPathPtr;
 typedef struct _NewClientRec *NewClientPtr;
 
-#ifndef xalloc
+#ifndef xnfalloc
 #define xnfalloc(size) XNFalloc((unsigned long)(size))
 #define xnfcalloc(_num, _size) XNFcalloc((unsigned long)(_num)*(unsigned long)(_size))
 #define xnfrealloc(ptr, size) XNFrealloc((void *)(ptr), (unsigned long)(size))
 
-#define xalloc(size) Xalloc((unsigned long)(size))
-#define xcalloc(_num, _size) Xcalloc((unsigned long)(_num)*(unsigned long)(_size))
-#define xrealloc(ptr, size) Xrealloc((void *)(ptr), (unsigned long)(size))
-#define xfree(ptr) Xfree((void *)(ptr))
 #define xstrdup(s) Xstrdup(s)
 #define xnfstrdup(s) XNFstrdup(s)
 #endif
@@ -214,37 +210,6 @@ extern _X_EXPORT int set_font_authorizations(char **authorizations,
                                              int *authlen,
                                              void *client);
 
-#ifndef _HAVE_XALLOC_DECLS
-#define _HAVE_XALLOC_DECLS
-
-/*
- * Use malloc(3) instead.
- */
-extern _X_EXPORT void *
-Xalloc(unsigned long /*amount */ ) _X_DEPRECATED;
-
-/*
- * Use calloc(3) instead
- */
-extern _X_EXPORT void *
-Xcalloc(unsigned long /*amount */ ) _X_DEPRECATED;
-
-/*
- * Use realloc(3) instead
- */
-extern _X_EXPORT void *
-Xrealloc(void * /*ptr */ , unsigned long /*amount */ )
- _X_DEPRECATED;
-
-/*
- * Use free(3) instead
- */
-extern _X_EXPORT void
-Xfree(void * /*ptr */ )
-    _X_DEPRECATED;
-
-#endif
-
 /*
  * This function malloc(3)s buffer, terminating the server if there is not
  * enough memory.
diff --git a/os/utils.c b/os/utils.c
index ed7581e..f319743 100644
--- a/os/utils.c
+++ b/os/utils.c
@@ -1090,24 +1090,6 @@ set_font_authorizations(char **authorizations, int *authlen, void *client)
 }
 
 void *
-Xalloc(unsigned long amount)
-{
-    /*
-     * Xalloc used to return NULL when large amount of memory is requested. In
-     * order to catch the buggy callers this warning has been added, slated to
-     * removal by anyone who touches this code (or just looks at it) in 2011.
-     *
-     * -- Mikhail Gusarov
-     */
-    if ((long) amount <= 0)
-        ErrorF("Warning: Xalloc: "
-               "requesting unpleasantly large amount of memory: %lu bytes.\n",
-               amount);
-
-    return malloc(amount);
-}
-
-void *
 XNFalloc(unsigned long amount)
 {
     void *ptr = malloc(amount);
@@ -1118,12 +1100,6 @@ XNFalloc(unsigned long amount)
 }
 
 void *
-Xcalloc(unsigned long amount)
-{
-    return calloc(1, amount);
-}
-
-void *
 XNFcalloc(unsigned long amount)
 {
     void *ret = calloc(1, amount);
@@ -1134,24 +1110,6 @@ XNFcalloc(unsigned long amount)
 }
 
 void *
-Xrealloc(void *ptr, unsigned long amount)
-{
-    /*
-     * Xrealloc used to return NULL when large amount of memory is requested. In
-     * order to catch the buggy callers this warning has been added, slated to
-     * removal by anyone who touches this code (or just looks at it) in 2011.
-     *
-     * -- Mikhail Gusarov
-     */
-    if ((long) amount <= 0)
-        ErrorF("Warning: Xrealloc: "
-               "requesting unpleasantly large amount of memory: %lu bytes.\n",
-               amount);
-
-    return realloc(ptr, amount);
-}
-
-void *
 XNFrealloc(void *ptr, unsigned long amount)
 {
     void *ret = realloc(ptr, amount);
@@ -1161,12 +1119,6 @@ XNFrealloc(void *ptr, unsigned long amount)
     return ret;
 }
 
-void
-Xfree(void *ptr)
-{
-    free(ptr);
-}
-
 char *
 Xstrdup(const char *s)
 {
commit d5b279977236c4f80a8ba81db1f81a314484facf
Author: Adam Jackson <ajax at redhat.com>
Date:   Thu May 22 13:58:45 2014 -0400

    miext/shadow: Remove shadowInit
    
    This code is nonsensical.  You end up creating a screen-sized pixmap
    that's totally detached from everything else, which you then listen for
    damage on, which means you'll never hear any damage, which means your
    shadow update hooks will never get called.  Any driver using this would
    be sorely disappointed.
    
    Reviewed-by: Keith Packard <keithp at keithp.com>
    Signed-off-by: Adam Jackson <ajax at redhat.com>

diff --git a/miext/shadow/shadow.c b/miext/shadow/shadow.c
index 6690f70..0dd3604a 100644
--- a/miext/shadow/shadow.c
+++ b/miext/shadow/shadow.c
@@ -196,23 +196,3 @@ shadowRemove(ScreenPtr pScreen, PixmapPtr pPixmap)
     RemoveBlockAndWakeupHandlers(shadowBlockHandler, shadowWakeupHandler,
                                  (void *) pScreen);
 }
-
-Bool
-shadowInit(ScreenPtr pScreen, ShadowUpdateProc update, ShadowWindowProc window)
-{
-    PixmapPtr pPixmap;
-
-    pPixmap = pScreen->CreatePixmap(pScreen, pScreen->width, pScreen->height,
-                                    pScreen->rootDepth, 0);
-    if (!pPixmap)
-        return FALSE;
-
-    if (!shadowSetup(pScreen)) {
-        pScreen->DestroyPixmap(pPixmap);
-        return FALSE;
-    }
-
-    shadowAdd(pScreen, pPixmap, update, window, SHADOW_ROTATE_0, 0);
-
-    return TRUE;
-}
diff --git a/miext/shadow/shadow.h b/miext/shadow/shadow.h
index 9c5f991..86fa944 100644
--- a/miext/shadow/shadow.h
+++ b/miext/shadow/shadow.h
@@ -87,10 +87,6 @@ shadowAdd(ScreenPtr pScreen,
 extern _X_EXPORT void
  shadowRemove(ScreenPtr pScreen, PixmapPtr pPixmap);
 
-extern _X_EXPORT Bool
-
-shadowInit(ScreenPtr pScreen, ShadowUpdateProc update, ShadowWindowProc window);
-
 extern _X_EXPORT void *shadowAlloc(int width, int height, int bpp);
 
 extern _X_EXPORT void
commit cf4793d99ecee4dfd6094e02b1ccb89eb744d313
Author: Adam Jackson <ajax at redhat.com>
Date:   Fri Feb 28 15:36:31 2014 -0500

    miext/shadow: Remove ancient backwards-compatibility hack
    
    Here's a trip down memory lane.  Back when we merged kdrive we adopted
    kdrive's version of shadow, which used damage directly instead of
    hand-rolling it.  However a couple of Xorg drivers referred to the
    accumulated damage region in the shadow private directly, so I added a
    hack to copy the damage region around.
    
    That was 9148d8700b7c5afc2644e5820c57c509378f93ce, back in early 2006.
    Eight years is unusually patient for me.  The neomagic and trident drivers
    were still relying on this, but they've been modified to ask the damage
    code for the region instead.
    
    Reviewed-by: Keith Packard <keithp at keithp.com>
    Signed-off-by: Adam Jackson <ajax at redhat.com>

diff --git a/miext/shadow/shadow.c b/miext/shadow/shadow.c
index 522e21b..6690f70 100644
--- a/miext/shadow/shadow.c
+++ b/miext/shadow/shadow.c
@@ -93,8 +93,6 @@ shadowGetImage(DrawablePtr pDrawable, int sx, int sy, int w, int h,
     wrap(pBuf, pScreen, GetImage);
 }
 
-#define BACKWARDS_COMPATIBILITY
-
 static Bool
 shadowCloseScreen(ScreenPtr pScreen)
 {
@@ -104,35 +102,12 @@ shadowCloseScreen(ScreenPtr pScreen)
     unwrap(pBuf, pScreen, CloseScreen);
     shadowRemove(pScreen, pBuf->pPixmap);
     DamageDestroy(pBuf->pDamage);
-#ifdef BACKWARDS_COMPATIBILITY
-    RegionUninit(&pBuf->damage);        /* bc */
-#endif
     if (pBuf->pPixmap)
         pScreen->DestroyPixmap(pBuf->pPixmap);
     free(pBuf);
     return pScreen->CloseScreen(pScreen);
 }
 
-#ifdef BACKWARDS_COMPATIBILITY
-static void
-shadowReportFunc(DamagePtr pDamage, RegionPtr pRegion, void *closure)
-{
-    ScreenPtr pScreen = closure;
-    shadowBufPtr pBuf = (shadowBufPtr)
-        dixLookupPrivate(&pScreen->devPrivates, shadowScrPrivateKey);
-
-    /* Register the damaged region, use DamageReportNone below when we
-     * want to break BC below... */
-    RegionUnion(&pDamage->damage, &pDamage->damage, pRegion);
-
-    /*
-     * BC hack.  In 7.0 and earlier several drivers would inspect the
-     * 'damage' member directly, so we have to keep it existing.
-     */
-    RegionCopy(&pBuf->damage, pRegion);
-}
-#endif
-
 Bool
 shadowSetup(ScreenPtr pScreen)
 {
@@ -147,15 +122,9 @@ shadowSetup(ScreenPtr pScreen)
     pBuf = malloc(sizeof(shadowBufRec));
     if (!pBuf)
         return FALSE;
-#ifdef BACKWARDS_COMPATIBILITY
-    pBuf->pDamage = DamageCreate((DamageReportFunc) shadowReportFunc,
-                                 (DamageDestroyFunc) NULL,
-                                 DamageReportRawRegion, TRUE, pScreen, pScreen);
-#else
     pBuf->pDamage = DamageCreate((DamageReportFunc) NULL,
                                  (DamageDestroyFunc) NULL,
                                  DamageReportNone, TRUE, pScreen, pScreen);
-#endif
     if (!pBuf->pDamage) {
         free(pBuf);
         return FALSE;
@@ -168,9 +137,6 @@ shadowSetup(ScreenPtr pScreen)
     pBuf->pPixmap = 0;
     pBuf->closure = 0;
     pBuf->randr = 0;
-#ifdef BACKWARDS_COMPATIBILITY
-    RegionNull(&pBuf->damage);  /* bc */
-#endif
 
     dixSetPrivate(&pScreen->devPrivates, shadowScrPrivateKey, pBuf);
     return TRUE;
diff --git a/miext/shadow/shadow.h b/miext/shadow/shadow.h
index 421ae96..9c5f991 100644
--- a/miext/shadow/shadow.h
+++ b/miext/shadow/shadow.h
@@ -43,12 +43,10 @@ typedef void *(*ShadowWindowProc) (ScreenPtr pScreen,
                                    CARD32 offset,
                                    int mode, CARD32 *size, void *closure);
 
-/* BC hack: do not move the damage member.  see shadow.c for explanation. */
 typedef struct _shadowBuf {
     DamagePtr pDamage;
     ShadowUpdateProc update;
     ShadowWindowProc window;
-    RegionRec damage;
     PixmapPtr pPixmap;
     void *closure;
     int randr;
commit 35eabf2e5272e17e6765027d4baea43b34c66933
Author: Adam Jackson <ajax at redhat.com>
Date:   Tue Jul 8 14:11:22 2014 -0400

    mi: Remove apparently unused miSegregateChildren
    
    This came in between XFree86 4.3 and 4.4, I'm not entirely sure what it
    was meant to do.
    
    Reviewed-by: Keith Packard <keithp at keithp.com>
    Signed-off-by: Adam Jackson <ajax at redhat.com>

diff --git a/mi/mi.h b/mi/mi.h
index feba5cb..d5a5ba3 100644
--- a/mi/mi.h
+++ b/mi/mi.h
@@ -515,9 +515,6 @@ extern _X_EXPORT void miMarkUnrealizedWindow(WindowPtr /*pChild */ ,
                                              Bool       /*fromConfigure */
     );
 
-extern _X_EXPORT void miSegregateChildren(WindowPtr pWin, RegionPtr pReg,
-                                          int depth);
-
 extern _X_EXPORT WindowPtr miSpriteTrace(SpritePtr pSprite, int x, int y);
 
 extern _X_EXPORT WindowPtr miXYToWindow(ScreenPtr pScreen, SpritePtr pSprite, int x, int y);
diff --git a/mi/miwindow.c b/mi/miwindow.c
index 57de91b..82c3513 100644
--- a/mi/miwindow.c
+++ b/mi/miwindow.c
@@ -746,20 +746,6 @@ miMarkUnrealizedWindow(WindowPtr pChild, WindowPtr pWin, Bool fromConfigure)
     }
 }
 
-void
-miSegregateChildren(WindowPtr pWin, RegionPtr pReg, int depth)
-{
-    WindowPtr pChild;
-
-    for (pChild = pWin->firstChild; pChild; pChild = pChild->nextSib) {
-        if (pChild->drawable.depth == depth)
-            RegionUnion(pReg, pReg, &pChild->borderClip);
-
-        if (pChild->firstChild)
-            miSegregateChildren(pChild, pReg, depth);
-    }
-}
-
 WindowPtr
 miSpriteTrace(SpritePtr pSprite, int x, int y)
 {
commit 150acef3af9bb43cb60cbcc558ef3ad4a710e624
Author: Adam Jackson <ajax at redhat.com>
Date:   Mon May 19 13:46:12 2014 -0400

    kdrive: Remove some dead bits of the man page
    
    Reviewed-by: Keith Packard <keithp at keithp.com>
    Signed-off-by: Adam Jackson <ajax at redhat.com>

diff --git a/hw/kdrive/Xkdrive.man b/hw/kdrive/Xkdrive.man
index b37f9f1..c3e2089 100644
--- a/hw/kdrive/Xkdrive.man
+++ b/hw/kdrive/Xkdrive.man
@@ -4,10 +4,6 @@
 .SH NAME
 Xkdrive \- tiny X server
 .SH SYNOPSIS
-.B Xvesa
-.RI [ :display ]
-.RI [ option ...]
-
 .B Xfbdev
 .RI [ :display ]
 .RI [ option ...]
@@ -24,9 +20,6 @@ Xserver(1)), all the
 .B Xkdrive
 servers accept the following options:
 .TP 8
-.B -card \fIpcmcia\fP
-use pcmcia card as additional screen.
-.TP 8
 .B -dumb
 disable hardware acceleration.
 .TP 8
commit 71ef49062ee33ac49033fbcd67bab88120882668
Author: Adam Jackson <ajax at redhat.com>
Date:   Fri Feb 28 14:05:25 2014 -0500

    dix: Make some LBX-era code more obvious
    
    isItTimeToYield in the conditional effectively didn't do anything here.
    Take it out, and remove the comment since LBX proxies aren't a thing for
    us anymore.
    
    Reviewed-by: Keith Packard <keithp at keithp.com>
    Signed-off-by: Adam Jackson <ajax at redhat.com>

diff --git a/dix/dispatch.c b/dix/dispatch.c
index 4f830f7..f7a08f8 100644
--- a/dix/dispatch.c
+++ b/dix/dispatch.c
@@ -3188,13 +3188,11 @@ ProcKillClient(ClientPtr client)
     rc = dixLookupClient(&killclient, stuff->id, client, DixDestroyAccess);
     if (rc == Success) {
         CloseDownClient(killclient);
-        /* if an LBX proxy gets killed, isItTimeToYield will be set */
-        if (isItTimeToYield || (client == killclient)) {
+        if (client == killclient) {
             /* force yield and return Success, so that Dispatch()
              * doesn't try to touch client
              */
             isItTimeToYield = TRUE;
-            return Success;
         }
         return Success;
     }
commit a317e0a974c1597d55fe05a38b4a495c4e4e8d71
Author: Adam Jackson <ajax at redhat.com>
Date:   Fri May 2 11:50:17 2014 -0400

    bsd: Remove some reference arm code behind #if 0
    
    git history is reference enough, thanks.
    
    Reviewed-by: Alex Deucher <alexander.deucher at amd.com>
    Signed-off-by: Adam Jackson <ajax at redhat.com>

diff --git a/hw/xfree86/os-support/bsd/arm_video.c b/hw/xfree86/os-support/bsd/arm_video.c
index 6a977c2..e295c92 100644
--- a/hw/xfree86/os-support/bsd/arm_video.c
+++ b/hw/xfree86/os-support/bsd/arm_video.c
@@ -487,142 +487,3 @@ xf86DisableIO()
 }
 
 #endif                          /* USE_ARC_MMAP */
-
-#if 0
-/*
- * XXX This is here for reference.  It needs to be handled differently for the
- * ND.
- */
-#if defined(USE_ARC_MMAP) || defined(__arm32__)
-
-#ifdef USE_ARM32_MMAP
-#define	DEV_MEM_IOBASE	0x43000000
-#endif
-
-static Bool ScreenEnabled[MAXSCREENS];
-static Bool ExtendedEnabled = FALSE;
-static Bool InitDone = FALSE;
-
-Bool
-xf86EnableIOPorts(ScreenNum)
-int ScreenNum;
-{
-    int i;
-    int fd;
-    void *base;
-
-#ifdef __arm32__
-    struct memAccess *memInfoP;
-    int *Size;
-#endif
-
-    ScreenEnabled[ScreenNum] = TRUE;
-
-    if (ExtendedEnabled)
-        return TRUE;
-
-#ifdef USE_ARC_MMAP
-    if ((fd = open("/dev/ttyC0", O_RDWR)) >= 0) {
-        /* Try to map a page at the pccons I/O space */
-        base = (void *) mmap((caddr_t) 0, 65536, PROT_READ | PROT_WRITE,
-                             MAP_FLAGS, fd, (off_t) 0x0000);
-
-        if (base != (void *) -1) {
-            IOPortBase = base;
-        }
-        else {
-            xf86Msg(X_ERROR,
-                    "EnableIOPorts: failed to mmap %s (%s)\n",
-                    "/dev/ttyC0", strerror(errno));
-        }
-    }
-    else {
-        xf86Msg(X_ERROR, "EnableIOPorts: failed to open %s (%s)\n",
-                "/dev/ttyC0", strerror(errno));
-    }
-#endif
-
-#ifdef __arm32__
-    IOPortBase = (unsigned int) -1;
-
-    if ((memInfoP = checkMapInfo(TRUE, MMIO_REGION)) != NULL) {
-        /* 
-         * xf86MapInfoMap maps an offset from the start of video IO
-         * space (e.g. 0x3B0), but IOPortBase is expected to map to
-         * physical address 0x000, so subtract the start of video I/O
-         * space from the result.  This is safe for now becase we
-         * actually mmap the start of the page, then the start of video
-         * I/O space is added as an internal offset.
-         */
-        IOPortBase = (unsigned int) xf86MapInfoMap(memInfoP, (caddr_t) 0x0, 0L)
-            - memInfoP->memInfo.u.map_info_mmap.internal_offset;
-        ExtendedEnabled = TRUE;
-        return TRUE;
-    }
-#ifdef USE_ARM32_MMAP
-    checkDevMem(TRUE);
-
-    if (devMemFd >= 0 && useDevMem) {
-        base = (void *) mmap((caddr_t) 0, 0x400, PROT_READ | PROT_WRITE,
-                              MAP_FLAGS, devMemFd, (off_t) DEV_MEM_IOBASE);
-
-        if (base != (void *) -1)
-            IOPortBase = (unsigned int) base;
-    }
-
-    if (IOPortBase == (unsigned int) -1) {
-        xf86Msg(X_WARNING,
-                "xf86EnableIOPorts: failed to open mem device or map IO base. \n\
-Make sure you have the Aperture Driver installed, or a kernel built with the INSECURE option\n");
-        return FALSE;
-    }
-#else
-    /* We don't have the IOBASE, so we can't map the address */
-    xf86Msg(X_WARNING,
-            "xf86EnableIOPorts: failed to open mem device or map IO base. \n\
-Try building the server with USE_ARM32_MMAP defined\n");
-    return FALSE;
-#endif
-#endif
-
-    ExtendedEnabled = TRUE;
-
-    return TRUE;
-}
-
-void
-xf86DisableIOPorts(ScreenNum)
-int ScreenNum;
-{
-    int i;
-
-#ifdef __arm32__
-    struct memAccess *memInfoP;
-#endif
-
-    ScreenEnabled[ScreenNum] = FALSE;
-
-#ifdef __arm32__
-    if ((memInfoP = checkMapInfo(FALSE, MMIO_REGION)) != NULL) {
-        xf86MapInfoUnmap(memInfoP, 0);
-    }
-#endif
-
-#ifdef USE_ARM32_MMAP
-    if (!ExtendedEnabled)
-        return;
-
-    for (i = 0; i < MAXSCREENS; i++)
-        if (ScreenEnabled[i])
-            return;
-
-    munmap((caddr_t) IOPortBase, 0x400);
-    IOPortBase = (unsigned int) -1;
-    ExtendedEnabled = FALSE;
-#endif
-
-    return;
-}
-
-#endif                          /* USE_ARC_MMAP || USE_ARM32_MMAP */
-#endif
commit 8a60d1c3f4a62675cad005107f56413f946ecd77
Author: Keith Packard <keithp at keithp.com>
Date:   Mon Jul 28 11:10:15 2014 -0700

    glamor: Eliminate diagonal tearing in xv
    
    This uses a single large triangle and a scissor to draw the video
    instead of two triangles.
    
    Signed-off-by: Keith Packard <keithp at keithp.com>
    Reviewed-by: Alex Deucher <alexander.deucher at amd.com>

diff --git a/glamor/glamor_xv.c b/glamor/glamor_xv.c
index 68a06a4..3f3e064 100644
--- a/glamor/glamor_xv.c
+++ b/glamor/glamor_xv.c
@@ -336,6 +336,7 @@ glamor_xv_render(glamor_port_private *port_priv)
                           GL_FALSE, 2 * sizeof(float), vertices);
 
     glEnableVertexAttribArray(GLAMOR_VERTEX_POS);
+    glEnable(GL_SCISSOR_TEST);
     for (i = 0; i < nBox; i++) {
         float off_x = box[i].x1 - port_priv->drw_x;
         float off_y = box[i].y1 - port_priv->drw_y;
@@ -356,23 +357,25 @@ glamor_xv_render(glamor_port_private *port_priv)
 
         glamor_set_normalize_vcoords(pixmap_priv,
                                      dst_xscale, dst_yscale,
-                                     dstx,
+                                     dstx - dstw,
                                      dsty,
                                      dstx + dstw,
-                                     dsty + dsth,
+                                     dsty + dsth * 2,
                                      vertices);
 
         glamor_set_normalize_tcoords(src_pixmap_priv[0],
                                      src_xscale[0],
                                      src_yscale[0],
-                                     srcx,
+                                     srcx - srcw,
                                      srcy,
                                      srcx + srcw,
-                                     srcy + srch,
+                                     srcy + srch * 2,
                                      texcoords);
 
-        glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
+        glScissor(dstx, dsty, dstw, dsth);
+        glDrawArrays(GL_TRIANGLE_FAN, 0, 3);
     }
+    glDisable(GL_SCISSOR_TEST);
 
     glDisableVertexAttribArray(GLAMOR_VERTEX_POS);
     glDisableVertexAttribArray(GLAMOR_VERTEX_SOURCE);
commit 29eaa61cb210e0c67004bc567af0c15d48aad626
Author: Adam Jackson <ajax at redhat.com>
Date:   Tue Jul 22 11:05:32 2014 -0400

    mi: Remove semi-arbitrary arch awareness in packed coordinate macros
    
    The majority of arches end up on the right-shift path here.  I can't
    think of any arch where that'd be slower than a divide, and semantically
    it makes more sense to think of this as a shift operation anyway.
    
    Signed-off-by: Adam Jackson <ajax at redhat.com>
    Reviewed-by: Keith Packard <keithp at keithp.com>
    Signed-off-by: Keith Packard <keithp at keithp.com>

diff --git a/mi/micoord.h b/mi/micoord.h
index 481e418..c83bffd 100644
--- a/mi/micoord.h
+++ b/mi/micoord.h
@@ -32,27 +32,7 @@
 
 /* Macros which handle a coordinate in a single register */
 
-/*
- * Most compilers will convert divisions by 65536 into shifts, if signed
- * shifts exist.  If your machine does arithmetic shifts and your compiler
- * can't get it right, add to this line.
- */
-
-/*
- * mips compiler - what a joke - it CSEs the 65536 constant into a reg
- * forcing as to use div instead of shift.  Let's be explicit.
- */
-
-#if defined(mips) || \
-    defined(sparc) || defined(__sparc64__) || \
-    defined(__alpha) || defined(__alpha__) || \
-    defined(__i386__) || defined(__i386) || defined(__ia64__) || \
-    defined(__s390x__) || defined(__s390__) || \
-    defined(__amd64__) || defined(amd64) || defined(__amd64)
 #define GetHighWord(x) (((int) (x)) >> 16)
-#else
-#define GetHighWord(x) (((int) (x)) / 65536)
-#endif
 
 #if IMAGE_BYTE_ORDER == MSBFirst
 #define intToCoord(i,x,y)   (((x) = GetHighWord(i)), ((y) = (int) ((short) (i))))
commit 6ddd164508f81e9582b66061b385bd34ac1ccb7e
Author: Adam Jackson <ajax at redhat.com>
Date:   Tue Jul 22 10:59:13 2014 -0400

    xfree86: Unify the ppc/sparc mmio-swap-or-not conditionals
    
    Map SPARC_MMIO_IS_BE and PPC_MMIO_IS_BE to MMIO_IS_BE and use the same
    macros for both since they're identical.
    
    Reviewed-by: Julien Cristau <jcristau at debian.org>
    Signed-off-by: Adam Jackson <ajax at redhat.com>
    Signed-off-by: Keith Packard <keithp at keithp.com>

diff --git a/hw/xfree86/common/compiler.h b/hw/xfree86/common/compiler.h
index a94a388..5325129 100644
--- a/hw/xfree86/common/compiler.h
+++ b/hw/xfree86/common/compiler.h
@@ -1027,6 +1027,11 @@ inl(unsigned short port)
 #endif
 #endif                          /* __GNUC__ */
 
+#if !defined(MMIO_IS_BE) && \
+    (defined(SPARC_MMIO_IS_BE) || defined(PPC_MMIO_IS_BE))
+#define MMIO_IS_BE
+#endif
+
 #ifdef __alpha__
 /* entry points for Mmio memory access routines */
 extern _X_EXPORT int (*xf86ReadMmio8) (void *, unsigned long);
@@ -1071,17 +1076,17 @@ extern _X_EXPORT void xf86SlowBCopyToBus(unsigned char *, unsigned char *, int);
 #define MMIO_OUT16(base, offset, val) \
     (*xf86WriteMmio16)((CARD16)(val), base, offset)
 
-#elif defined(__powerpc__)
+#elif defined(__powerpc__) || defined(__sparc__)
  /* 
   * we provide byteswapping and no byteswapping functions here
   * with byteswapping as default, 
-  * drivers that don't need byteswapping should define PPC_MMIO_IS_BE 
+  * drivers that don't need byteswapping should define MMIO_IS_BE
   */
 #define MMIO_IN8(base, offset) xf86ReadMmio8(base, offset)
 #define MMIO_OUT8(base, offset, val) \
     xf86WriteMmio8(base, offset, (CARD8)(val))
 
-#if defined(PPC_MMIO_IS_BE)     /* No byteswapping */
+#if defined(MMIO_IS_BE)     /* No byteswapping */
 #define MMIO_IN16(base, offset) xf86ReadMmio16Be(base, offset)
 #define MMIO_IN32(base, offset) xf86ReadMmio32Be(base, offset)
 #define MMIO_OUT16(base, offset, val) \
@@ -1097,34 +1102,6 @@ extern _X_EXPORT void xf86SlowBCopyToBus(unsigned char *, unsigned char *, int);
      xf86WriteMmio32Le(base, offset, (CARD32)(val))
 #endif
 
-#elif defined(__sparc__)
- /*
-  * Like powerpc, we provide byteswapping and no byteswapping functions
-  * here with byteswapping as default, drivers that don't need byteswapping
-  * should define SPARC_MMIO_IS_BE (perhaps create a generic macro so that we
-  * do not need to use PPC_MMIO_IS_BE and the sparc one in all the same places
-  * of drivers?).
-  */
-#define MMIO_IN8(base, offset) xf86ReadMmio8(base, offset)
-#define MMIO_OUT8(base, offset, val) \
-    xf86WriteMmio8(base, offset, (CARD8)(val))
-
-#if defined(SPARC_MMIO_IS_BE)   /* No byteswapping */
-#define MMIO_IN16(base, offset) xf86ReadMmio16Be(base, offset)
-#define MMIO_IN32(base, offset) xf86ReadMmio32Be(base, offset)
-#define MMIO_OUT16(base, offset, val) \
-     xf86WriteMmio16Be(base, offset, (CARD16)(val))
-#define MMIO_OUT32(base, offset, val) \
-     xf86WriteMmio32Be(base, offset, (CARD32)(val))
-#else                           /* byteswapping is the default */
-#define MMIO_IN16(base, offset) xf86ReadMmio16Le(base, offset)
-#define MMIO_IN32(base, offset) xf86ReadMmio32Le(base, offset)
-#define MMIO_OUT16(base, offset, val) \
-     xf86WriteMmio16Le(base, offset, (CARD16)(val))
-#define MMIO_OUT32(base, offset, val) \
-     xf86WriteMmio32Le(base, offset, (CARD32)(val))
-#endif
-
 #elif defined(__nds32__)
  /*
   * we provide byteswapping and no byteswapping functions here
commit 8ffd1c066ab1e993d8964aef12a7c585329c677c
Author: Adam Jackson <ajax at redhat.com>
Date:   Tue Jul 22 10:59:12 2014 -0400

    xfree86: Clean up some silly __sparc macro usage
    
    The top of this file already defines __sparc__ if __sparc is defined.
    
    Reviewed-by: Julien Cristau <jcristau at debian.org>
    Signed-off-by: Adam Jackson <ajax at redhat.com>
    Signed-off-by: Keith Packard <keithp at keithp.com>

diff --git a/hw/xfree86/common/compiler.h b/hw/xfree86/common/compiler.h
index b1fd0d8..a94a388 100644
--- a/hw/xfree86/common/compiler.h
+++ b/hw/xfree86/common/compiler.h
@@ -97,7 +97,7 @@
 
 #if defined(DO_PROTOTYPES)
 #if !defined(__arm__)
-#if !defined(__sparc__) && !defined(__sparc) && !defined(__arm32__) && !defined(__nds32__) \
+#if !defined(__sparc__) && !defined(__arm32__) && !defined(__nds32__) \
       && !(defined(__alpha__) && defined(linux)) \
       && !(defined(__ia64__) && defined(linux)) \
       && !(defined(__mips64) && defined(linux)) \
@@ -1097,7 +1097,7 @@ extern _X_EXPORT void xf86SlowBCopyToBus(unsigned char *, unsigned char *, int);
      xf86WriteMmio32Le(base, offset, (CARD32)(val))
 #endif
 
-#elif defined(__sparc__) || defined(sparc) || defined(__sparc)
+#elif defined(__sparc__)
  /*
   * Like powerpc, we provide byteswapping and no byteswapping functions
   * here with byteswapping as default, drivers that don't need byteswapping
commit 1c1711b57f2c278c0df03bf9e7e9a1776a546968
Author: Adam Jackson <ajax at redhat.com>
Date:   Tue Jul 22 10:59:11 2014 -0400

    xfree86: Pull generic barrier() definition up to top level
    
    And remove the redundant redecl from the nds32 section.
    
    Reviewed-by: Julien Cristau <jcristau at debian.org>
    Signed-off-by: Adam Jackson <ajax at redhat.com>
    Signed-off-by: Keith Packard <keithp at keithp.com>

diff --git a/hw/xfree86/common/compiler.h b/hw/xfree86/common/compiler.h
index e408441..b1fd0d8 100644
--- a/hw/xfree86/common/compiler.h
+++ b/hw/xfree86/common/compiler.h
@@ -94,6 +94,7 @@
 #if !defined(__GNUC__) && !defined(__FUNCTION__)
 #define __FUNCTION__ __func__   /* C99 */
 #endif
+
 #if defined(DO_PROTOTYPES)
 #if !defined(__arm__)
 #if !defined(__sparc__) && !defined(__sparc) && !defined(__arm32__) && !defined(__nds32__) \
@@ -199,6 +200,10 @@ extern _X_EXPORT void xf86WriteMmio32Le (void *, unsigned long, unsigned int);
 #endif
 #endif                          /* __GNUC__ */
 
+#ifndef barrier
+#define barrier()
+#endif
+
 #ifndef mem_barrier
 #define mem_barrier()           /* NOP */
 #endif
@@ -790,8 +795,6 @@ xf_outl(unsigned short port, unsigned int val)
  * if there is unaligned port access.
  */
 
-#define barrier()               /* no barrier */
-
 #define PORT_SIZE long
 
 static __inline__ unsigned char
@@ -964,9 +967,6 @@ inl(unsigned PORT_SIZE port)
 
 #endif                          /* NDS32_MMIO_SWAP */
 
-#define mem_barrier()           /* XXX: nop for now */
-#define write_mem_barrier()     /* XXX: nop for now */
-
 #elif defined(__i386__) || defined(__ia64__)
 
 static __inline__ void
commit c73929bbfc14ba80397c53ca98d3b503c807ae78
Author: Adam Jackson <ajax at redhat.com>
Date:   Tue Jul 22 10:59:10 2014 -0400

    xfree86: Remove MMIO_ONB* and friends
    
    Non-barrier-emitting MMIO writes.  They appear to be utterly unused,
    burn it all down.
    
    Reviewed-by: Julien Cristau <jcristau at debian.org>
    Signed-off-by: Adam Jackson <ajax at redhat.com>
    Signed-off-by: Keith Packard <keithp at keithp.com>

diff --git a/hw/xfree86/common/compiler.h b/hw/xfree86/common/compiler.h
index 3430585..e408441 100644
--- a/hw/xfree86/common/compiler.h
+++ b/hw/xfree86/common/compiler.h
@@ -127,11 +127,6 @@ extern _X_EXPORT void xf86WriteMmio16Be (void *, unsigned long, unsigned int);
 extern _X_EXPORT void xf86WriteMmio16Le (void *, unsigned long, unsigned int);
 extern _X_EXPORT void xf86WriteMmio32Be (void *, unsigned long, unsigned int);
 extern _X_EXPORT void xf86WriteMmio32Le (void *, unsigned long, unsigned int);
-extern _X_EXPORT void xf86WriteMmio8NB    (void *, unsigned long, unsigned int);
-extern _X_EXPORT void xf86WriteMmio16BeNB (void *, unsigned long, unsigned int);
-extern _X_EXPORT void xf86WriteMmio16LeNB (void *, unsigned long, unsigned int);
-extern _X_EXPORT void xf86WriteMmio32BeNB (void *, unsigned long, unsigned int);
-extern _X_EXPORT void xf86WriteMmio32LeNB (void *, unsigned long, unsigned int);
 #endif                          /* _SUNPRO_C */
 #endif                          /* __sparc__,  __arm32__, __alpha__, __nds32__ */
 #endif                          /* __arm__ */
@@ -518,56 +513,6 @@ xf86WriteMmio32Le(__volatile__ void *base, const unsigned long offset,
     barrier();
 }
 
-static __inline__ void
-xf86WriteMmio8NB(__volatile__ void *base, const unsigned long offset,
-                 const unsigned int val)
-{
-    unsigned long addr = ((unsigned long) base) + offset;
-
-    __asm__ __volatile__("stba %0, [%1] %2":    /* No outputs */
-                         :"r"(val), "r"(addr), "i"(ASI_PL));
-}
-
-static __inline__ void
-xf86WriteMmio16BeNB(__volatile__ void *base, const unsigned long offset,
-                    const unsigned int val)
-{
-    unsigned long addr = ((unsigned long) base) + offset;
-
-    __asm__ __volatile__("sth %0, [%1]":        /* No outputs */
-                         :"r"(val), "r"(addr));
-}
-
-static __inline__ void
-xf86WriteMmio16LeNB(__volatile__ void *base, const unsigned long offset,
-                    const unsigned int val)
-{
-    unsigned long addr = ((unsigned long) base) + offset;
-
-    __asm__ __volatile__("stha %0, [%1] %2":    /* No outputs */
-                         :"r"(val), "r"(addr), "i"(ASI_PL));
-}
-
-static __inline__ void
-xf86WriteMmio32BeNB(__volatile__ void *base, const unsigned long offset,
-                    const unsigned int val)
-{
-    unsigned long addr = ((unsigned long) base) + offset;
-
-    __asm__ __volatile__("st %0, [%1]": /* No outputs */
-                         :"r"(val), "r"(addr));
-}
-
-static __inline__ void
-xf86WriteMmio32LeNB(__volatile__ void *base, const unsigned long offset,
-                    const unsigned int val)
-{
-    unsigned long addr = ((unsigned long) base) + offset;
-
-    __asm__ __volatile__("sta %0, [%1] %2":     /* No outputs */
-                         :"r"(val), "r"(addr), "i"(ASI_PL));
-}
-
 #elif defined(__mips__) || (defined(__arm32__) && !defined(__linux__))
 #if defined(__arm32__) || defined(__mips64)
 #define PORT_SIZE long
@@ -706,92 +651,57 @@ xf86ReadMmio32Le(__volatile__ void *base, const unsigned long offset)
 }
 
 static __inline__ void
-xf86WriteMmioNB8(__volatile__ void *base, const unsigned long offset,
-                 const unsigned char val)
+xf86WriteMmio8(__volatile__ void *base, const unsigned long offset,
+               const unsigned char val)
 {
     __asm__
         __volatile__("stbx %1,%2,%3\n\t":"=m"
                      (*((volatile unsigned char *) base + offset))
                      :"r"(val), "b"(base), "r"(offset));
+    eieio();
 }
 
 static __inline__ void
-xf86WriteMmioNB16Le(__volatile__ void *base, const unsigned long offset,
-                    const unsigned short val)
+xf86WriteMmio16Le(__volatile__ void *base, const unsigned long offset,
+                  const unsigned short val)
 {
     __asm__
         __volatile__("sthbrx %1,%2,%3\n\t":"=m"
                      (*((volatile unsigned char *) base + offset))
                      :"r"(val), "b"(base), "r"(offset));
+    eieio();
 }
 
 static __inline__ void
-xf86WriteMmioNB16Be(__volatile__ void *base, const unsigned long offset,
-                    const unsigned short val)
+xf86WriteMmio16Be(__volatile__ void *base, const unsigned long offset,
+                  const unsigned short val)
 {
     __asm__
         __volatile__("sthx %1,%2,%3\n\t":"=m"
                      (*((volatile unsigned char *) base + offset))
                      :"r"(val), "b"(base), "r"(offset));
+    eieio();
 }
 
 static __inline__ void
-xf86WriteMmioNB32Le(__volatile__ void *base, const unsigned long offset,
-                    const unsigned int val)
+xf86WriteMmio32Le(__volatile__ void *base, const unsigned long offset,
+                  const unsigned int val)
 {
     __asm__
         __volatile__("stwbrx %1,%2,%3\n\t":"=m"
                      (*((volatile unsigned char *) base + offset))
                      :"r"(val), "b"(base), "r"(offset));
+    eieio();
 }
 
 static __inline__ void
-xf86WriteMmioNB32Be(__volatile__ void *base, const unsigned long offset,
-                    const unsigned int val)
+xf86WriteMmio32Be(__volatile__ void *base, const unsigned long offset,
+                  const unsigned int val)
 {
     __asm__
         __volatile__("stwx %1,%2,%3\n\t":"=m"
                      (*((volatile unsigned char *) base + offset))
                      :"r"(val), "b"(base), "r"(offset));
-}
-
-static __inline__ void
-xf86WriteMmio8(__volatile__ void *base, const unsigned long offset,
-               const unsigned char val)
-{
-    xf86WriteMmioNB8(base, offset, val);
-    eieio();
-}
-
-static __inline__ void
-xf86WriteMmio16Le(__volatile__ void *base, const unsigned long offset,
-                  const unsigned short val)
-{
-    xf86WriteMmioNB16Le(base, offset, val);
-    eieio();
-}
-
-static __inline__ void
-xf86WriteMmio16Be(__volatile__ void *base, const unsigned long offset,
-                  const unsigned short val)
-{
-    xf86WriteMmioNB16Be(base, offset, val);
-    eieio();
-}
-
-static __inline__ void
-xf86WriteMmio32Le(__volatile__ void *base, const unsigned long offset,
-                  const unsigned int val)
-{
-    xf86WriteMmioNB32Le(base, offset, val);
-    eieio();
-}
-
-static __inline__ void
-xf86WriteMmio32Be(__volatile__ void *base, const unsigned long offset,
-                  const unsigned int val)
-{
-    xf86WriteMmioNB32Be(base, offset, val);
     eieio();
 }
 
@@ -898,13 +808,6 @@ xf86WriteMmio8(__volatile__ void *base, const unsigned long offset,
     barrier();
 }
 
-static __inline__ void
-xf86WriteMmio8NB(__volatile__ void *base, const unsigned long offset,
-                 const unsigned int val)
-{
-    *(volatile unsigned char *) ((unsigned char *) base + offset) = val;
-}
-
 static __inline__ unsigned short
 xf86ReadMmio16Swap(__volatile__ void *base, const unsigned long offset)
 {
@@ -943,23 +846,6 @@ xf86WriteMmio16(__volatile__ void *base, const unsigned long offset,
     barrier();
 }
 
-static __inline__ void
-xf86WriteMmio16SwapNB(__volatile__ void *base, const unsigned long offset,
-                      const unsigned int val)
-{
-    unsigned long addr = ((unsigned long) base) + offset;
-
-    __asm__ __volatile__("wsbh %0, %0;\n\t" "shi %0, [%1];\n\t":        /* No outputs */
-                         :"r"(val), "r"(addr));
-}
-
-static __inline__ void
-xf86WriteMmio16NB(__volatile__ void *base, const unsigned long offset,
-                  const unsigned int val)
-{
-    *(volatile unsigned short *) ((unsigned char *) base + offset) = val;
-}
-
 static __inline__ unsigned int
 xf86ReadMmio32Swap(__volatile__ void *base, const unsigned long offset)
 {
@@ -999,23 +885,6 @@ xf86WriteMmio32(__volatile__ void *base, const unsigned long offset,
     barrier();
 }
 
-static __inline__ void
-xf86WriteMmio32SwapNB(__volatile__ void *base, const unsigned long offset,
-                      const unsigned int val)
-{
-    unsigned long addr = ((unsigned long) base) + offset;
-
-    __asm__ __volatile__("wsbh %0, %0;\n\t" "rotri %0, %0, 16;\n\t" "swi %0, [%1];\n\t":        /* No outputs */
-                         :"r"(val), "r"(addr));
-}
-
-static __inline__ void
-xf86WriteMmio32NB(__volatile__ void *base, const unsigned long offset,
-                  const unsigned int val)
-{
-    *(volatile unsigned int *) ((unsigned char *) base + offset) = val;
-}
-
 #if defined(NDS32_MMIO_SWAP)
 static __inline__ void
 outb(unsigned PORT_SIZE port, unsigned char val)
@@ -1177,9 +1046,6 @@ xf86ReadMmio32(void *Base, unsigned long Offset)
 extern _X_EXPORT void (*xf86WriteMmio8) (int, void *, unsigned long);
 extern _X_EXPORT void (*xf86WriteMmio16) (int, void *, unsigned long);
 extern _X_EXPORT void (*xf86WriteMmio32) (int, void *, unsigned long);
-extern _X_EXPORT void (*xf86WriteMmioNB8) (int, void *, unsigned long);
-extern _X_EXPORT void (*xf86WriteMmioNB16) (int, void *, unsigned long);
-extern _X_EXPORT void (*xf86WriteMmioNB32) (int, void *, unsigned long);
 extern _X_EXPORT void xf86SlowBCopyFromBus(unsigned char *, unsigned char *,
                                            int);
 extern _X_EXPORT void xf86SlowBCopyToBus(unsigned char *, unsigned char *, int);
@@ -1199,17 +1065,11 @@ extern _X_EXPORT void xf86SlowBCopyToBus(unsigned char *, unsigned char *, int);
 	write_mem_barrier(); \
 	*(volatile CARD32 *)(void *)(((CARD8*)(base)) + (offset)) = (val); \
     } while (0)
-#define MMIO_ONB32(base, offset, val) \
-	*(volatile CARD32 *)(void *)(((CARD8*)(base)) + (offset)) = (val)
 
 #define MMIO_OUT8(base, offset, val) \
     (*xf86WriteMmio8)((CARD8)(val), base, offset)
 #define MMIO_OUT16(base, offset, val) \
     (*xf86WriteMmio16)((CARD16)(val), base, offset)
-#define MMIO_ONB8(base, offset, val) \
-    (*xf86WriteMmioNB8)((CARD8)(val), base, offset)
-#define MMIO_ONB16(base, offset, val) \
-    (*xf86WriteMmioNB16)((CARD16)(val), base, offset)
 
 #elif defined(__powerpc__)
  /* 
@@ -1220,8 +1080,6 @@ extern _X_EXPORT void xf86SlowBCopyToBus(unsigned char *, unsigned char *, int);
 #define MMIO_IN8(base, offset) xf86ReadMmio8(base, offset)
 #define MMIO_OUT8(base, offset, val) \
     xf86WriteMmio8(base, offset, (CARD8)(val))
-#define MMIO_ONB8(base, offset, val) \
-    xf86WriteMmioNB8(base, offset, (CARD8)(val))
 
 #if defined(PPC_MMIO_IS_BE)     /* No byteswapping */
 #define MMIO_IN16(base, offset) xf86ReadMmio16Be(base, offset)
@@ -1230,10 +1088,6 @@ extern _X_EXPORT void xf86SlowBCopyToBus(unsigned char *, unsigned char *, int);
     xf86WriteMmio16Be(base, offset, (CARD16)(val))
 #define MMIO_OUT32(base, offset, val) \
     xf86WriteMmio32Be(base, offset, (CARD32)(val))
-#define MMIO_ONB16(base, offset, val) \
-    xf86WriteMmioNB16Be(base, offset, (CARD16)(val))
-#define MMIO_ONB32(base, offset, val) \
-    xf86WriteMmioNB32Be(base, offset, (CARD32)(val))
 #else                           /* byteswapping is the default */
 #define MMIO_IN16(base, offset) xf86ReadMmio16Le(base, offset)
 #define MMIO_IN32(base, offset) xf86ReadMmio32Le(base, offset)
@@ -1241,10 +1095,6 @@ extern _X_EXPORT void xf86SlowBCopyToBus(unsigned char *, unsigned char *, int);
      xf86WriteMmio16Le(base, offset, (CARD16)(val))
 #define MMIO_OUT32(base, offset, val) \
      xf86WriteMmio32Le(base, offset, (CARD32)(val))
-#define MMIO_ONB16(base, offset, val) \
-     xf86WriteMmioNB16Le(base, offset, (CARD16)(val))
-#define MMIO_ONB32(base, offset, val) \
-     xf86WriteMmioNB32Le(base, offset, (CARD32)(val))
 #endif
 
 #elif defined(__sparc__) || defined(sparc) || defined(__sparc)
@@ -1258,8 +1108,6 @@ extern _X_EXPORT void xf86SlowBCopyToBus(unsigned char *, unsigned char *, int);
 #define MMIO_IN8(base, offset) xf86ReadMmio8(base, offset)
 #define MMIO_OUT8(base, offset, val) \
     xf86WriteMmio8(base, offset, (CARD8)(val))
-#define MMIO_ONB8(base, offset, val) \
-    xf86WriteMmio8NB(base, offset, (CARD8)(val))
 
 #if defined(SPARC_MMIO_IS_BE)   /* No byteswapping */
 #define MMIO_IN16(base, offset) xf86ReadMmio16Be(base, offset)
@@ -1268,10 +1116,6 @@ extern _X_EXPORT void xf86SlowBCopyToBus(unsigned char *, unsigned char *, int);
      xf86WriteMmio16Be(base, offset, (CARD16)(val))
 #define MMIO_OUT32(base, offset, val) \
      xf86WriteMmio32Be(base, offset, (CARD32)(val))
-#define MMIO_ONB16(base, offset, val) \
-     xf86WriteMmio16BeNB(base, offset, (CARD16)(val))
-#define MMIO_ONB32(base, offset, val) \
-     xf86WriteMmio32BeNB(base, offset, (CARD32)(val))
 #else                           /* byteswapping is the default */
 #define MMIO_IN16(base, offset) xf86ReadMmio16Le(base, offset)
 #define MMIO_IN32(base, offset) xf86ReadMmio32Le(base, offset)
@@ -1279,10 +1123,6 @@ extern _X_EXPORT void xf86SlowBCopyToBus(unsigned char *, unsigned char *, int);
      xf86WriteMmio16Le(base, offset, (CARD16)(val))
 #define MMIO_OUT32(base, offset, val) \
      xf86WriteMmio32Le(base, offset, (CARD32)(val))
-#define MMIO_ONB16(base, offset, val) \
-     xf86WriteMmio16LeNB(base, offset, (CARD16)(val))
-#define MMIO_ONB32(base, offset, val) \
-     xf86WriteMmio32LeNB(base, offset, (CARD32)(val))
 #endif
 
 #elif defined(__nds32__)
@@ -1295,8 +1135,6 @@ extern _X_EXPORT void xf86SlowBCopyToBus(unsigned char *, unsigned char *, int);
 #define MMIO_IN8(base, offset) xf86ReadMmio8(base, offset)
 #define MMIO_OUT8(base, offset, val) \
     xf86WriteMmio8(base, offset, (CARD8)(val))
-#define MMIO_ONB8(base, offset, val) \
-    xf86WriteMmioNB8(base, offset, (CARD8)(val))
 
 #if defined(NDS32_MMIO_SWAP)    /* byteswapping */
 #define MMIO_IN16(base, offset) xf86ReadMmio16Swap(base, offset)
@@ -1305,10 +1143,6 @@ extern _X_EXPORT void xf86SlowBCopyToBus(unsigned char *, unsigned char *, int);
     xf86WriteMmio16Swap(base, offset, (CARD16)(val))
 #define MMIO_OUT32(base, offset, val) \
     xf86WriteMmio32Swap(base, offset, (CARD32)(val))
-#define MMIO_ONB16(base, offset, val) \
-    xf86WriteMmioNB16Swap(base, offset, (CARD16)(val))
-#define MMIO_ONB32(base, offset, val) \
-    xf86WriteMmioNB32Swap(base, offset, (CARD32)(val))
 #else                           /* no byteswapping is the default */
 #define MMIO_IN16(base, offset) xf86ReadMmio16(base, offset)
 #define MMIO_IN32(base, offset) xf86ReadMmio32(base, offset)
@@ -1316,10 +1150,6 @@ extern _X_EXPORT void xf86SlowBCopyToBus(unsigned char *, unsigned char *, int);
      xf86WriteMmio16(base, offset, (CARD16)(val))
 #define MMIO_OUT32(base, offset, val) \
      xf86WriteMmio32(base, offset, (CARD32)(val))
-#define MMIO_ONB16(base, offset, val) \
-     xf86WriteMmioNB16(base, offset, (CARD16)(val))
-#define MMIO_ONB32(base, offset, val) \
-     xf86WriteMmioNB32(base, offset, (CARD32)(val))
 #endif
 
 #else                           /* !__alpha__ && !__powerpc__ && !__sparc__ */
@@ -1336,9 +1166,6 @@ extern _X_EXPORT void xf86SlowBCopyToBus(unsigned char *, unsigned char *, int);
 	*(volatile CARD16 *)(void *)(((CARD8*)(base)) + (offset)) = (val)
 #define MMIO_OUT32(base, offset, val) \
 	*(volatile CARD32 *)(void *)(((CARD8*)(base)) + (offset)) = (val)
-#define MMIO_ONB8(base, offset, val) MMIO_OUT8(base, offset, val)
-#define MMIO_ONB16(base, offset, val) MMIO_OUT16(base, offset, val)
-#define MMIO_ONB32(base, offset, val) MMIO_OUT32(base, offset, val)
 
 #endif                          /* __alpha__ */
 
diff --git a/hw/xfree86/os-support/bsd/alpha_video.c b/hw/xfree86/os-support/bsd/alpha_video.c
index 95bd059..f656f55 100644
--- a/hw/xfree86/os-support/bsd/alpha_video.c
+++ b/hw/xfree86/os-support/bsd/alpha_video.c
@@ -431,12 +431,6 @@ extern int readDense8(void *Base, register unsigned long Offset);
 extern int readDense16(void *Base, register unsigned long Offset);
 extern int readDense32(void *Base, register unsigned long Offset);
 extern void
- writeDenseNB8(int Value, void *Base, register unsigned long Offset);
-extern void
- writeDenseNB16(int Value, void *Base, register unsigned long Offset);
-extern void
- writeDenseNB32(int Value, void *Base, register unsigned long Offset);
-extern void
  writeDense8(int Value, void *Base, register unsigned long Offset);
 extern void
  writeDense16(int Value, void *Base, register unsigned long Offset);
@@ -666,12 +660,6 @@ void (*xf86WriteMmio16) (int Value, void *Base, unsigned long Offset)
     = writeDense16;
 void (*xf86WriteMmio32) (int Value, void *Base, unsigned long Offset)
     = writeDense32;
-void (*xf86WriteMmioNB8) (int Value, void *Base, unsigned long Offset)
-    = writeDenseNB8;
-void (*xf86WriteMmioNB16) (int Value, void *Base, unsigned long Offset)
-    = writeDenseNB16;
-void (*xf86WriteMmioNB32) (int Value, void *Base, unsigned long Offset)
-    = writeDenseNB32;
 int (*xf86ReadMmio8) (void *Base, unsigned long Offset)
     = readDense8;
 int (*xf86ReadMmio16) (void *Base, unsigned long Offset)
diff --git a/hw/xfree86/os-support/bsd/bsd_ev56.c b/hw/xfree86/os-support/bsd/bsd_ev56.c
index 320bb23..9588349 100644
--- a/hw/xfree86/os-support/bsd/bsd_ev56.c
+++ b/hw/xfree86/os-support/bsd/bsd_ev56.c
@@ -26,12 +26,6 @@ int readDense8(void *Base, register unsigned long Offset);
 int readDense16(void *Base, register unsigned long Offset);
 int readDense32(void *Base, register unsigned long Offset);
 void
- writeDenseNB8(int Value, void *Base, register unsigned long Offset);
-void
- writeDenseNB16(int Value, void *Base, register unsigned long Offset);
-void
- writeDenseNB32(int Value, void *Base, register unsigned long Offset);
-void
  writeDense8(int Value, void *Base, register unsigned long Offset);
 void
  writeDense16(int Value, void *Base, register unsigned long Offset);
@@ -60,24 +54,6 @@ readDense32(void *Base, register unsigned long Offset)
 }
 
 void
-writeDenseNB8(int Value, void *Base, register unsigned long Offset)
-{
-    alpha_stb((void *) ((unsigned long) Base + (Offset)), Value);
-}
-
-void
-writeDenseNB16(int Value, void *Base, register unsigned long Offset)
-{
-    alpha_stw((void *) ((unsigned long) Base + (Offset)), Value);
-}
-
-void
-writeDenseNB32(int Value, void *Base, register unsigned long Offset)
-{
-    *(volatile CARD32 *) ((unsigned long) Base + (Offset)) = Value;
-}
-
-void
 writeDense8(int Value, void *Base, register unsigned long Offset)
 {
     write_mem_barrier();
diff --git a/hw/xfree86/os-support/linux/lnx_ev56.c b/hw/xfree86/os-support/linux/lnx_ev56.c
index b695000..4e886b6 100644
--- a/hw/xfree86/os-support/linux/lnx_ev56.c
+++ b/hw/xfree86/os-support/linux/lnx_ev56.c
@@ -10,12 +10,6 @@ int readDense8(void *Base, register unsigned long Offset);
 int readDense16(void *Base, register unsigned long Offset);
 int readDense32(void *Base, register unsigned long Offset);
 void
- writeDenseNB8(int Value, void *Base, register unsigned long Offset);
-void
- writeDenseNB16(int Value, void *Base, register unsigned long Offset);
-void
- writeDenseNB32(int Value, void *Base, register unsigned long Offset);
-void
  writeDense8(int Value, void *Base, register unsigned long Offset);
 void
  writeDense16(int Value, void *Base, register unsigned long Offset);
@@ -44,24 +38,6 @@ readDense32(void *Base, register unsigned long Offset)
 }
 
 void
-writeDenseNB8(int Value, void *Base, register unsigned long Offset)
-{
-    *(volatile CARD8 *) ((unsigned long) Base + (Offset)) = Value;
-}
-
-void
-writeDenseNB16(int Value, void *Base, register unsigned long Offset)
-{
-    *(volatile CARD16 *) ((unsigned long) Base + (Offset)) = Value;
-}
-
-void
-writeDenseNB32(int Value, void *Base, register unsigned long Offset)
-{
-    *(volatile CARD32 *) ((unsigned long) Base + (Offset)) = Value;
-}
-
-void
 writeDense8(int Value, void *Base, register unsigned long Offset)
 {
     write_mem_barrier();
diff --git a/hw/xfree86/os-support/linux/lnx_video.c b/hw/xfree86/os-support/linux/lnx_video.c
index 652f963..ffffc81 100644
--- a/hw/xfree86/os-support/linux/lnx_video.c
+++ b/hw/xfree86/os-support/linux/lnx_video.c
@@ -571,12 +571,6 @@ extern int readDense8(void *Base, register unsigned long Offset);
 extern int readDense16(void *Base, register unsigned long Offset);
 extern int readDense32(void *Base, register unsigned long Offset);
 extern void
- writeDenseNB8(int Value, void *Base, register unsigned long Offset);
-extern void
- writeDenseNB16(int Value, void *Base, register unsigned long Offset);
-extern void
- writeDenseNB32(int Value, void *Base, register unsigned long Offset);
-extern void
  writeDense8(int Value, void *Base, register unsigned long Offset);
 extern void
  writeDense16(int Value, void *Base, register unsigned long Offset);
@@ -867,12 +861,6 @@ void (*xf86WriteMmio16) (int Value, void *Base, unsigned long Offset)
     = writeDense16;
 void (*xf86WriteMmio32) (int Value, void *Base, unsigned long Offset)
     = writeDense32;
-void (*xf86WriteMmioNB8) (int Value, void *Base, unsigned long Offset)
-    = writeDenseNB8;
-void (*xf86WriteMmioNB16) (int Value, void *Base, unsigned long Offset)
-    = writeDenseNB16;
-void (*xf86WriteMmioNB32) (int Value, void *Base, unsigned long Offset)
-    = writeDenseNB32;
 int (*xf86ReadMmio8) (void *Base, unsigned long Offset)
     = readDense8;
 int (*xf86ReadMmio16) (void *Base, unsigned long Offset)
commit 9b33e31d4160dc484ee569740f883f4d34e10653
Author: Adam Jackson <ajax at redhat.com>
Date:   Tue Jul 22 10:59:09 2014 -0400

    xfree86: Clean up powerpc barrier decls
    
    I think the externs are there for the non-gcc case?  And maybe there was
    some assembly code to implement that once?  Whatever, at this point on
    ppc the compiler is either gcc or willing to pretend.  The macros below
    the decls take care of the actual eieio so the externs can just go.
    
    Also remove a comment that maybe made sense once upon a time.
    
    Reviewed-by: Julien Cristau <jcristau at debian.org>
    Signed-off-by: Adam Jackson <ajax at redhat.com>
    Signed-off-by: Keith Packard <keithp at keithp.com>

diff --git a/hw/xfree86/common/compiler.h b/hw/xfree86/common/compiler.h
index 5fd0ea0..3430585 100644
--- a/hw/xfree86/common/compiler.h
+++ b/hw/xfree86/common/compiler.h
@@ -136,11 +136,6 @@ extern _X_EXPORT void xf86WriteMmio32LeNB (void *, unsigned long, unsigned int);
 #endif                          /* __sparc__,  __arm32__, __alpha__, __nds32__ */
 #endif                          /* __arm__ */
 
-#if defined(__powerpc__) && !defined(__OpenBSD__)
-extern void mem_barrier(void);
-extern void write_mem_barrier(void);
-#endif                          /* __powerpc__ && !__OpenBSD */
-
 #endif                          /* NO_INLINE || DO_PROTOTYPES */
 
 #ifdef __GNUC__
@@ -195,7 +190,7 @@ extern void write_mem_barrier(void);
 
 #elif defined __powerpc__
 
-#ifndef eieio                   /* We deal with arch-specific eieio() routines above... */
+#ifndef eieio
 #define eieio() __asm__ __volatile__ ("eieio" ::: "memory")
 #endif                          /* eieio */
 #define mem_barrier()	eieio()
commit b5141a1fab4d45c1af62db8dc712deb9776668a9
Author: Adam Jackson <ajax at redhat.com>
Date:   Tue Jul 22 10:59:08 2014 -0400

    xfree86: Simplify a bunch of OS and arch conditionals
    
    All of this is inside #ifdef __GNUC__, between that and configure.ac we
    can assume there's a unixy thing under us.  Given that there's no real
    reason to limit the arch paths to particular OSes, so let's not.
    
    The final #elif here, combined with the ones before it, effectively said
    "if not (alpha amd64 sparc* mips* ppc* arm* nds32 m68k sh hppa s390 m32r)",
    and as the comment above it hints, it's meant to cover i386 (and happens to
    also cover itanic).  Flip the conditional around to be sensible.
    
    Reviewed-by: Julien Cristau <jcristau at debian.org>
    Signed-off-by: Adam Jackson <ajax at redhat.com>
    Signed-off-by: Keith Packard <keithp at keithp.com>

diff --git a/hw/xfree86/common/compiler.h b/hw/xfree86/common/compiler.h
index 54da1fd..5fd0ea0 100644
--- a/hw/xfree86/common/compiler.h
+++ b/hw/xfree86/common/compiler.h
@@ -218,7 +218,7 @@ extern void write_mem_barrier(void);
 #endif
 
 #ifdef __GNUC__
-#if (defined(linux) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__)) && (defined(__alpha__))
+#if defined(__alpha__)
 
 #ifdef linux
 /* for Linux on Alpha, we use the LIBC _inx/_outx routines */
@@ -291,7 +291,7 @@ extern _X_EXPORT unsigned int inl(unsigned int port);
 #include <machine/pio.h>
 #endif                          /* __NetBSD__ */
 
-#elif (defined(linux) || defined(__FreeBSD__)) && defined(__amd64__)
+#elif defined(__amd64__)
 
 #include <inttypes.h>
 
@@ -340,7 +340,7 @@ inl(unsigned short port)
     return ret;
 }
 
-#elif (defined(linux) || defined(sun) || defined(__OpenBSD__) || defined(__FreeBSD__)) && defined(__sparc__)
+#elif defined(__sparc__)
 
 #ifndef ASI_PL
 #define ASI_PL 0x88
@@ -652,7 +652,7 @@ xf86WriteMmio32Be(__volatile__ void *base, const unsigned long offset,
 #endif                          /* !linux */
 #endif                          /* __mips__ */
 
-#elif (defined(linux) || defined(__OpenBSD__) || defined(__NetBSD__) || defined(__FreeBSD__)) && defined(__powerpc__)
+#elif defined(__powerpc__)
 
 #ifndef MAP_FAILED
 #define MAP_FAILED ((void *)-1)
@@ -1103,12 +1103,7 @@ inl(unsigned PORT_SIZE port)
 #define mem_barrier()           /* XXX: nop for now */
 #define write_mem_barrier()     /* XXX: nop for now */
 
-#else                           /* ix86 */
-
-#if !defined(__mc68000__) && !defined(__arm__) && \
-    !defined(__sh__) && !defined(__hppa__) && !defined(__s390__) && \
-    !defined(__m32r__) && !defined(__aarch64__) && !defined(__arc__) && \
-    !defined(__xtensa__)
+#elif defined(__i386__) || defined(__ia64__)
 
 static __inline__ void
 outb(unsigned short port, unsigned char val)
@@ -1155,9 +1150,7 @@ inl(unsigned short port)
     return ret;
 }
 
-#endif
-
-#endif                          /* ix86 */
+#endif                          /* arch madness */
 
 #else                           /* !GNUC */
 #if defined(__STDC__) && (__STDC__ == 1)
commit 6d3ba80f197b04b6e0814190cf5c678c786c14d6
Author: Adam Jackson <ajax at redhat.com>
Date:   Tue Jul 22 10:59:07 2014 -0400

    xfree86: Remove pre-2.6 Linux ppc support
    
    2.6.0 was December 2003, you've had plenty of time to get your head in
    the game.
    
    Reviewed-by: Julien Cristau <jcristau at debian.org>
    Signed-off-by: Adam Jackson <ajax at redhat.com>
    Signed-off-by: Keith Packard <keithp at keithp.com>

diff --git a/hw/xfree86/common/compiler.h b/hw/xfree86/common/compiler.h
index a5426e1..54da1fd 100644
--- a/hw/xfree86/common/compiler.h
+++ b/hw/xfree86/common/compiler.h
@@ -195,13 +195,6 @@ extern void write_mem_barrier(void);
 
 #elif defined __powerpc__
 
-#if defined(linux) && defined(__powerpc64__)
-#include <linux/version.h>
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 0)
-#include <asm/memory.h>
-#endif
-#endif                          /* defined(linux) && defined(__powerpc64__) */
-
 #ifndef eieio                   /* We deal with arch-specific eieio() routines above... */
 #define eieio() __asm__ __volatile__ ("eieio" ::: "memory")
 #endif                          /* eieio */
commit e242e82eba17414603c8806fffc9ecd235eebabb
Author: Adam Jackson <ajax at redhat.com>
Date:   Tue Jul 22 10:59:06 2014 -0400

    xfree86: Remove a useless !__SUNPRO_C guard
    
    You can't tell from context here, but this is all inside #ifdef
    __GNUC__, so this conditional can't do squat.
    
    Reviewed-by: Julien Cristau <jcristau at debian.org>
    Signed-off-by: Adam Jackson <ajax at redhat.com>
    Signed-off-by: Keith Packard <keithp at keithp.com>

diff --git a/hw/xfree86/common/compiler.h b/hw/xfree86/common/compiler.h
index 4ed6ca4..a5426e1 100644
--- a/hw/xfree86/common/compiler.h
+++ b/hw/xfree86/common/compiler.h
@@ -1112,7 +1112,6 @@ inl(unsigned PORT_SIZE port)
 
 #else                           /* ix86 */
 
-#if !defined(__SUNPRO_C)
 #if !defined(__mc68000__) && !defined(__arm__) && \
     !defined(__sh__) && !defined(__hppa__) && !defined(__s390__) && \
     !defined(__m32r__) && !defined(__aarch64__) && !defined(__arc__) && \
@@ -1164,7 +1163,6 @@ inl(unsigned short port)
 }
 
 #endif
-#endif                          /* __SUNPRO_C */
 
 #endif                          /* ix86 */
 
commit 93745a6c1afc830759219f8632ec565d83c7bc12
Author: Adam Jackson <ajax at redhat.com>
Date:   Tue Jul 22 10:59:05 2014 -0400

    xfree86: Undef GCCUSESGAS
    
    Can't be needed, we've never defined it in modular xserver.
    
    Reviewed-by: Julien Cristau <jcristau at debian.org>
    Signed-off-by: Adam Jackson <ajax at redhat.com>
    Signed-off-by: Keith Packard <keithp at keithp.com>

diff --git a/hw/xfree86/common/compiler.h b/hw/xfree86/common/compiler.h
index f691f9d..4ed6ca4 100644
--- a/hw/xfree86/common/compiler.h
+++ b/hw/xfree86/common/compiler.h
@@ -1117,59 +1117,6 @@ inl(unsigned PORT_SIZE port)
     !defined(__sh__) && !defined(__hppa__) && !defined(__s390__) && \
     !defined(__m32r__) && !defined(__aarch64__) && !defined(__arc__) && \
     !defined(__xtensa__)
-#ifdef GCCUSESGAS
-
-/*
- * If gcc uses gas rather than the native assembler, the syntax of these
- * inlines has to be different.		DHD
- */
-
-static __inline__ void
-outb(unsigned short port, unsigned char val)
-{
-    __asm__ __volatile__("outb %0,%1"::"a"(val), "d"(port));
-}
-
-static __inline__ void
-outw(unsigned short port, unsigned short val)
-{
-    __asm__ __volatile__("outw %0,%1"::"a"(val), "d"(port));
-}
-
-static __inline__ void
-outl(unsigned short port, unsigned int val)
-{
-    __asm__ __volatile__("outl %0,%1"::"a"(val), "d"(port));
-}
-
-static __inline__ unsigned int
-inb(unsigned short port)
-{
-    unsigned char ret;
-    __asm__ __volatile__("inb %1,%0":"=a"(ret):"d"(port));
-
-    return ret;
-}
-
-static __inline__ unsigned int
-inw(unsigned short port)
-{
-    unsigned short ret;
-    __asm__ __volatile__("inw %1,%0":"=a"(ret):"d"(port));
-
-    return ret;
-}
-
-static __inline__ unsigned int
-inl(unsigned short port)
-{
-    unsigned int ret;
-    __asm__ __volatile__("inl %1,%0":"=a"(ret):"d"(port));
-
-    return ret;
-}
-
-#else                           /* GCCUSESGAS */
 
 static __inline__ void
 outb(unsigned short port, unsigned char val)
@@ -1216,7 +1163,6 @@ inl(unsigned short port)
     return ret;
 }
 
-#endif                          /* GCCUSESGAS */
 #endif
 #endif                          /* __SUNPRO_C */
 
commit b1d9bc8d1d828b0dedda46da98628b47915e6a04
Author: Adam Jackson <ajax at redhat.com>
Date:   Tue Jul 22 10:59:04 2014 -0400

    xfree86: Remove an unlikely bit of #pragma
    
    __USLC__ appears to mean the SCO OpenServer compiler, which configure.ac
    doesn't think is an OS the xfree86 ddx supports.  The conditionals
    surrounding these pragmas effectively mean "if not gcc and not Sun C",
    and probably arbitrary pragmas aren't supported by arbitrary compilers.
    
    Reviewed-by: Julien Cristau <jcristau at debian.org>
    Signed-off-by: Adam Jackson <ajax at redhat.com>
    Signed-off-by: Keith Packard <keithp at keithp.com>

diff --git a/hw/xfree86/common/compiler.h b/hw/xfree86/common/compiler.h
index 0b2f98a..f691f9d 100644
--- a/hw/xfree86/common/compiler.h
+++ b/hw/xfree86/common/compiler.h
@@ -1231,14 +1231,6 @@ inl(unsigned short port)
 #if !defined(__SUNPRO_C)
 #include <sys/inline.h>
 #endif
-#if  !defined(__SUNPRO_C) || defined(__USLC__)
-#pragma asm partial_optimization outl
-#pragma asm partial_optimization outw
-#pragma asm partial_optimization outb
-#pragma asm partial_optimization inl
-#pragma asm partial_optimization inw
-#pragma asm partial_optimization inb
-#endif
 #endif                          /* __GNUC__ */
 
 #ifdef __alpha__
commit f7f9ccef1dc251a1b95ca698ac39bd0a47f0c8fa
Author: Adam Jackson <ajax at redhat.com>
Date:   Tue Jul 22 10:59:03 2014 -0400

    xfree86: Undef __HIGHC__
    
    MetaWare High C++ compiler?  xfree86 cvs history shows this being added
    in a commit whose text is, classically, "updates".  metaware.com
    redirects to a 404 on synopsys.com, which to me indicates it's not super
    important to them, and their order form won't even tell you how much the
    thing costs.  At any rate if this is worth worrying about it's worth
    letting autoconf worry about for us.
    
    Reviewed-by: Julien Cristau <jcristau at debian.org>
    Signed-off-by: Adam Jackson <ajax at redhat.com>
    Signed-off-by: Keith Packard <keithp at keithp.com>

diff --git a/hw/xfree86/common/compiler.h b/hw/xfree86/common/compiler.h
index 2794f44..0b2f98a 100644
--- a/hw/xfree86/common/compiler.h
+++ b/hw/xfree86/common/compiler.h
@@ -79,8 +79,6 @@
 #ifndef __inline__
 #if defined(__GNUC__)
     /* gcc has __inline__ */
-#elif defined(__HIGHC__)
-#define __inline__ _Inline
 #else
 #define __inline__ /**/
 #endif
@@ -88,8 +86,6 @@
 #ifndef __inline
 #if defined(__GNUC__)
     /* gcc has __inline */
-#elif defined(__HIGHC__)
-#define __inline _Inline
 #else
 #define __inline /**/
 #endif
@@ -1235,8 +1231,7 @@ inl(unsigned short port)
 #if !defined(__SUNPRO_C)
 #include <sys/inline.h>
 #endif
-#if !defined(__HIGHC__) && !defined(__SUNPRO_C) || \
-	defined(__USLC__)
+#if  !defined(__SUNPRO_C) || defined(__USLC__)
 #pragma asm partial_optimization outl
 #pragma asm partial_optimization outw
 #pragma asm partial_optimization outb
commit 80446086b9cfcc5e23a400d7fa38ec773fae68fc
Author: Adam Jackson <ajax at redhat.com>
Date:   Tue Jul 22 10:59:02 2014 -0400

    xfree86: Undef FAKEIT
    
    I guess this is meant to stub out all I/O port calls?  Whatever, it's
    not been defined by the buildsystem at least as far back as monolith
    6.8.2.
    
    Reviewed-by: Julien Cristau <jcristau at debian.org>
    Signed-off-by: Adam Jackson <ajax at redhat.com>
    Signed-off-by: Keith Packard <keithp at keithp.com>

diff --git a/hw/xfree86/common/compiler.h b/hw/xfree86/common/compiler.h
index c786868..2794f44 100644
--- a/hw/xfree86/common/compiler.h
+++ b/hw/xfree86/common/compiler.h
@@ -1117,7 +1117,7 @@ inl(unsigned PORT_SIZE port)
 #else                           /* ix86 */
 
 #if !defined(__SUNPRO_C)
-#if !defined(FAKEIT) && !defined(__mc68000__) && !defined(__arm__) && \
+#if !defined(__mc68000__) && !defined(__arm__) && \
     !defined(__sh__) && !defined(__hppa__) && !defined(__s390__) && \
     !defined(__m32r__) && !defined(__aarch64__) && !defined(__arc__) && \
     !defined(__xtensa__)
@@ -1221,43 +1221,7 @@ inl(unsigned short port)
 }
 
 #endif                          /* GCCUSESGAS */
-
-#else                           /* !defined(FAKEIT) && !defined(__mc68000__)  && !defined(__arm__) && !defined(__sh__) && !defined(__hppa__) && !defined(__m32r__) && !defined(__arc__) */
-
-static __inline__ void
-outb(unsigned short port, unsigned char val)
-{
-}
-
-static __inline__ void
-outw(unsigned short port, unsigned short val)
-{
-}
-
-static __inline__ void
-outl(unsigned short port, unsigned int val)
-{
-}
-
-static __inline__ unsigned int
-inb(unsigned short port)
-{
-    return 0;
-}
-
-static __inline__ unsigned int
-inw(unsigned short port)
-{
-    return 0;
-}
-
-static __inline__ unsigned int
-inl(unsigned short port)
-{
-    return 0;
-}
-
-#endif                          /* FAKEIT */
+#endif
 #endif                          /* __SUNPRO_C */
 
 #endif                          /* ix86 */
commit 8002b1a8cb18ecc6526e8ebfd769767f8991ebd6
Author: Adam Jackson <ajax at redhat.com>
Date:   Tue Jul 22 10:59:01 2014 -0400

    xfree86: Remove a few random ppc decls
    
    Whatever these are, they're not something grep can find, they must not
    be used.
    
    Reviewed-by: Julien Cristau <jcristau at debian.org>
    Signed-off-by: Adam Jackson <ajax at redhat.com>
    Signed-off-by: Keith Packard <keithp at keithp.com>

diff --git a/hw/xfree86/common/compiler.h b/hw/xfree86/common/compiler.h
index 5cc8eb0..c786868 100644
--- a/hw/xfree86/common/compiler.h
+++ b/hw/xfree86/common/compiler.h
@@ -143,10 +143,6 @@ extern _X_EXPORT void xf86WriteMmio32LeNB (void *, unsigned long, unsigned int);
 #if defined(__powerpc__) && !defined(__OpenBSD__)
 extern void mem_barrier(void);
 extern void write_mem_barrier(void);
-extern void stl_brx(unsigned long, volatile unsigned char *, int);
-extern void stw_brx(unsigned short, volatile unsigned char *, int);
-extern unsigned long ldl_brx(volatile unsigned char *, int);
-extern unsigned short ldw_brx(volatile unsigned char *, int);
 #endif                          /* __powerpc__ && !__OpenBSD */
 
 #endif                          /* NO_INLINE || DO_PROTOTYPES */
commit 5f5af5d6692b625f6231c8bca3ac801f2ac75717
Author: Adam Jackson <ajax at redhat.com>
Date:   Tue Jul 22 10:59:00 2014 -0400

    xfree86: Remove remaining unused unaligned accessors
    
    Reviewed-by: Julien Cristau <jcristau at debian.org>
    Signed-off-by: Adam Jackson <ajax at redhat.com>
    Signed-off-by: Keith Packard <keithp at keithp.com>

diff --git a/hw/xfree86/common/compiler.h b/hw/xfree86/common/compiler.h
index 06879b1..5cc8eb0 100644
--- a/hw/xfree86/common/compiler.h
+++ b/hw/xfree86/common/compiler.h
@@ -141,10 +141,6 @@ extern _X_EXPORT void xf86WriteMmio32LeNB (void *, unsigned long, unsigned int);
 #endif                          /* __arm__ */
 
 #if defined(__powerpc__) && !defined(__OpenBSD__)
-extern unsigned long ldl_u(unsigned int *);
-extern unsigned long ldw_u(unsigned short *);
-extern void stl_u(unsigned long, unsigned int *);
-extern void stw_u(unsigned long, unsigned short *);
 extern void mem_barrier(void);
 extern void write_mem_barrier(void);
 extern void stl_brx(unsigned long, volatile unsigned char *, int);
@@ -901,8 +897,7 @@ xf_outl(unsigned short port, unsigned int val)
 
 /*
  * Assume all port access are aligned.  We need to revise this implementation
- * if there is unaligned port access.  For ldl_u, ldw_u, stl_u and
- * stw_u, they are assumed unaligned.
+ * if there is unaligned port access.
  */
 
 #define barrier()               /* no barrier */
@@ -1078,28 +1073,6 @@ inl(unsigned PORT_SIZE port)
     return xf86ReadMmio32Swap(IOPortBase, port);
 }
 
-static __inline__ unsigned long
-ldl_u(unsigned int *p)
-{
-    unsigned long addr = (unsigned long) p;
-    unsigned int ret;
-
-    __asm__ __volatile__("lmw.bi %0, [%1], %0, 0;\n\t"
-                         "wsbh %0, %0;\n\t" "rotri %0, %0, 16;\n\t":"=r"(ret)
-                         :"r"(addr));
-
-    return ret;
-}
-
-static __inline__ void
-stl_u(unsigned long val, unsigned int *p)
-{
-    unsigned long addr = (unsigned long) p;
-
-    __asm__ __volatile__("wsbh %0, %0;\n\t" "rotri %0, %0, 16;\n\t" "smw.bi %0, [%1], %0, 0;\n\t":      /* No outputs */
-                         :"r"(val), "r"(addr));
-}
-
 #else                           /* !NDS32_MMIO_SWAP */
 static __inline__ void
 outb(unsigned PORT_SIZE port, unsigned char val)
@@ -1140,40 +1113,8 @@ inl(unsigned PORT_SIZE port)
     return *(volatile unsigned int *) (((unsigned PORT_SIZE) (port)));
 }
 
-static __inline__ unsigned long
-ldl_u(unsigned int *p)
-{
-    unsigned long addr = (unsigned long) p;
-    unsigned int ret;
-
-    __asm__ __volatile__("lmw.bi %0, [%1], %0, 0;\n\t":"=r"(ret)
-                         :"r"(addr));
-
-    return ret;
-}
-
-static __inline__ void
-stl_u(unsigned long val, unsigned int *p)
-{
-    unsigned long addr = (unsigned long) p;
-
-    __asm__ __volatile__("smw.bi %0, [%1], %0, 0;\n\t": /* No outputs */
-                         :"r"(val), "r"(addr));
-}
 #endif                          /* NDS32_MMIO_SWAP */
 
-#if (((X_BYTE_ORDER == X_BIG_ENDIAN) && !defined(NDS32_MMIO_SWAP)) || ((X_BYTE_ORDER != X_BIG_ENDIAN) && defined(NDS32_MMIO_SWAP)))
-#define ldw_u(p)	((*(unsigned char *)(p)) << 8 | \
-			(*((unsigned char *)(p)+1)))
-#define stw_u(v,p)	(*(unsigned char *)(p)) = ((v) >> 8); \
-				(*((unsigned char *)(p)+1)) = (v)
-#else
-#define ldw_u(p)	((*(unsigned char *)(p)) | \
-			(*((unsigned char *)(p)+1)<<8))
-#define stw_u(v,p)	(*(unsigned char *)(p)) = (v); \
-				(*((unsigned char *)(p)+1)) = ((v) >> 8)
-#endif
-
 #define mem_barrier()           /* XXX: nop for now */
 #define write_mem_barrier()     /* XXX: nop for now */
 
commit d28b788e11182d134bce5a414359841b37b62ac0
Author: Adam Jackson <ajax at redhat.com>
Date:   Tue Jul 22 10:58:59 2014 -0400

    xfree86: Move generic unaligned helpers into int10 code
    
    This is the only place they're actually used (well, aside from some XAA
    code in the s3 driver, but one s3 and 2 XAA).
    
    Reviewed-by: Julien Cristau <jcristau at debian.org>
    Signed-off-by: Adam Jackson <ajax at redhat.com>
    Signed-off-by: Keith Packard <keithp at keithp.com>

diff --git a/hw/xfree86/common/compiler.h b/hw/xfree86/common/compiler.h
index fc09cd2..06879b1 100644
--- a/hw/xfree86/common/compiler.h
+++ b/hw/xfree86/common/compiler.h
@@ -236,42 +236,6 @@ extern unsigned short ldw_brx(volatile unsigned char *, int);
 #define write_mem_barrier()     /* NOP */
 #endif
 
-#include <string.h>             /* needed for memmove */
-
-static __inline__ uint32_t
-ldl_u(uint32_t * p)
-{
-    uint32_t ret;
-
-    memmove(&ret, p, sizeof(*p));
-    return ret;
-}
-
-static __inline__ uint16_t
-ldw_u(uint16_t * p)
-{
-    uint16_t ret;
-
-    memmove(&ret, p, sizeof(*p));
-    return ret;
-}
-
-static __inline__ void
-stl_u(uint32_t val, uint32_t * p)
-{
-    uint32_t tmp = val;
-
-    memmove(p, &tmp, sizeof(*p));
-}
-
-static __inline__ void
-stw_u(uint16_t val, uint16_t * p)
-{
-    uint16_t tmp = val;
-
-    memmove(p, &tmp, sizeof(*p));
-}
-
 #ifdef __GNUC__
 #if (defined(linux) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__)) && (defined(__alpha__))
 
diff --git a/hw/xfree86/int10/generic.c b/hw/xfree86/int10/generic.c
index abbd36f..73a1e5e 100644
--- a/hw/xfree86/int10/generic.c
+++ b/hw/xfree86/int10/generic.c
@@ -20,6 +20,42 @@
 
 #define ALLOC_ENTRIES(x) ((V_RAM / x) - 1)
 
+#include <string.h>             /* needed for memmove */
+
+static __inline__ uint32_t
+ldl_u(uint32_t * p)
+{
+    uint32_t ret;
+
+    memmove(&ret, p, sizeof(*p));
+    return ret;
+}
+
+static __inline__ uint16_t
+ldw_u(uint16_t * p)
+{
+    uint16_t ret;
+
+    memmove(&ret, p, sizeof(*p));
+    return ret;
+}
+
+static __inline__ void
+stl_u(uint32_t val, uint32_t * p)
+{
+    uint32_t tmp = val;
+
+    memmove(p, &tmp, sizeof(*p));
+}
+
+static __inline__ void
+stw_u(uint16_t val, uint16_t * p)
+{
+    uint16_t tmp = val;
+
+    memmove(p, &tmp, sizeof(*p));
+}
+
 static uint8_t read_b(xf86Int10InfoPtr pInt, int addr);
 static uint16_t read_w(xf86Int10InfoPtr pInt, int addr);
 static uint32_t read_l(xf86Int10InfoPtr pInt, int addr);
commit 956a8d5c92a66ddd8d00e63a95b17cfd376fe424
Author: Adam Jackson <ajax at redhat.com>
Date:   Tue Jul 22 10:58:58 2014 -0400

    xfree86: Remove unused unaligned int64 helpers
    
    Reviewed-by: Julien Cristau <jcristau at debian.org>
    Signed-off-by: Adam Jackson <ajax at redhat.com>
    Signed-off-by: Keith Packard <keithp at keithp.com>

diff --git a/hw/xfree86/common/compiler.h b/hw/xfree86/common/compiler.h
index 54ebb73..fc09cd2 100644
--- a/hw/xfree86/common/compiler.h
+++ b/hw/xfree86/common/compiler.h
@@ -141,10 +141,8 @@ extern _X_EXPORT void xf86WriteMmio32LeNB (void *, unsigned long, unsigned int);
 #endif                          /* __arm__ */
 
 #if defined(__powerpc__) && !defined(__OpenBSD__)
-extern unsigned long ldq_u(unsigned long *);
 extern unsigned long ldl_u(unsigned int *);
 extern unsigned long ldw_u(unsigned short *);
-extern void stq_u(unsigned long, unsigned long *);
 extern void stl_u(unsigned long, unsigned int *);
 extern void stw_u(unsigned long, unsigned short *);
 extern void mem_barrier(void);
@@ -240,15 +238,6 @@ extern unsigned short ldw_brx(volatile unsigned char *, int);
 
 #include <string.h>             /* needed for memmove */
 
-static __inline__ uint64_t
-ldq_u(uint64_t * p)
-{
-    uint64_t ret;
-
-    memmove(&ret, p, sizeof(*p));
-    return ret;
-}
-
 static __inline__ uint32_t
 ldl_u(uint32_t * p)
 {
@@ -268,14 +257,6 @@ ldw_u(uint16_t * p)
 }
 
 static __inline__ void
-stq_u(uint64_t val, uint64_t * p)
-{
-    uint64_t tmp = val;
-
-    memmove(p, &tmp, sizeof(*p));
-}
-
-static __inline__ void
 stl_u(uint32_t val, uint32_t * p)
 {
     uint32_t tmp = val;
@@ -956,7 +937,7 @@ xf_outl(unsigned short port, unsigned int val)
 
 /*
  * Assume all port access are aligned.  We need to revise this implementation
- * if there is unaligned port access.  For ldq_u, ldl_u, ldw_u, stq_u, stl_u and
+ * if there is unaligned port access.  For ldl_u, ldw_u, stl_u and
  * stw_u, they are assumed unaligned.
  */
 
@@ -1134,19 +1115,6 @@ inl(unsigned PORT_SIZE port)
 }
 
 static __inline__ unsigned long
-ldq_u(unsigned long *p)
-{
-    unsigned long addr = (unsigned long) p;
-    unsigned int ret;
-
-    __asm__ __volatile__("lmw.bi %0, [%1], %0, 0;\n\t"
-                         "wsbh %0, %0;\n\t" "rotri %0, %0, 16;\n\t":"=r"(ret)
-                         :"r"(addr));
-
-    return ret;
-}
-
-static __inline__ unsigned long
 ldl_u(unsigned int *p)
 {
     unsigned long addr = (unsigned long) p;
@@ -1160,15 +1128,6 @@ ldl_u(unsigned int *p)
 }
 
 static __inline__ void
-stq_u(unsigned long val, unsigned long *p)
-{
-    unsigned long addr = (unsigned long) p;
-
-    __asm__ __volatile__("wsbh %0, %0;\n\t" "rotri %0, %0, 16;\n\t" "smw.bi %0, [%1], %0, 0;\n\t":      /* No outputs */
-                         :"r"(val), "r"(addr));
-}
-
-static __inline__ void
 stl_u(unsigned long val, unsigned int *p)
 {
     unsigned long addr = (unsigned long) p;
@@ -1218,18 +1177,6 @@ inl(unsigned PORT_SIZE port)
 }
 
 static __inline__ unsigned long
-ldq_u(unsigned long *p)
-{
-    unsigned long addr = (unsigned long) p;
-    unsigned int ret;
-
-    __asm__ __volatile__("lmw.bi %0, [%1], %0, 0;\n\t":"=r"(ret)
-                         :"r"(addr));
-
-    return ret;
-}
-
-static __inline__ unsigned long
 ldl_u(unsigned int *p)
 {
     unsigned long addr = (unsigned long) p;
@@ -1242,15 +1189,6 @@ ldl_u(unsigned int *p)
 }
 
 static __inline__ void
-stq_u(unsigned long val, unsigned long *p)
-{
-    unsigned long addr = (unsigned long) p;
-
-    __asm__ __volatile__("smw.bi %0, [%1], %0, 0;\n\t": /* No outputs */
-                         :"r"(val), "r"(addr));
-}
-
-static __inline__ void
 stl_u(unsigned long val, unsigned int *p)
 {
     unsigned long addr = (unsigned long) p;
commit da2b2671863655776d60102ddc7af61470d14022
Author: Adam Jackson <ajax at redhat.com>
Date:   Tue Jul 22 10:58:57 2014 -0400

    xfree86: Unspecialize gcc variants of unaligned memory access
    
    Yes yes, very clever, memmove works fine on gcc too, let's just do the
    portable thing since none of this is performance code.
    
    Reviewed-by: Julien Cristau <jcristau at debian.org>
    Signed-off-by: Adam Jackson <ajax at redhat.com>
    Signed-off-by: Keith Packard <keithp at keithp.com>

diff --git a/hw/xfree86/common/compiler.h b/hw/xfree86/common/compiler.h
index 556fa7f..54ebb73 100644
--- a/hw/xfree86/common/compiler.h
+++ b/hw/xfree86/common/compiler.h
@@ -238,73 +238,6 @@ extern unsigned short ldw_brx(volatile unsigned char *, int);
 #define write_mem_barrier()     /* NOP */
 #endif
 
-#ifdef __GNUC__
-
-/* Define some packed structures to use with unaligned accesses */
-
-struct __una_u64 {
-    uint64_t x __attribute__ ((packed));
-};
-struct __una_u32 {
-    uint32_t x __attribute__ ((packed));
-};
-struct __una_u16 {
-    uint16_t x __attribute__ ((packed));
-};
-
-/* Elemental unaligned loads */
-
-static __inline__ uint64_t
-ldq_u(uint64_t * p)
-{
-    const struct __una_u64 *ptr = (const struct __una_u64 *) p;
-
-    return ptr->x;
-}
-
-static __inline__ uint32_t
-ldl_u(uint32_t * p)
-{
-    const struct __una_u32 *ptr = (const struct __una_u32 *) p;
-
-    return ptr->x;
-}
-
-static __inline__ uint16_t
-ldw_u(uint16_t * p)
-{
-    const struct __una_u16 *ptr = (const struct __una_u16 *) p;
-
-    return ptr->x;
-}
-
-/* Elemental unaligned stores */
-
-static __inline__ void
-stq_u(uint64_t val, uint64_t * p)
-{
-    struct __una_u64 *ptr = (struct __una_u64 *) p;
-
-    ptr->x = val;
-}
-
-static __inline__ void
-stl_u(uint32_t val, uint32_t * p)
-{
-    struct __una_u32 *ptr = (struct __una_u32 *) p;
-
-    ptr->x = val;
-}
-
-static __inline__ void
-stw_u(uint16_t val, uint16_t * p)
-{
-    struct __una_u16 *ptr = (struct __una_u16 *) p;
-
-    ptr->x = val;
-}
-#else                           /* !__GNUC__ */
-
 #include <string.h>             /* needed for memmove */
 
 static __inline__ uint64_t
@@ -358,8 +291,6 @@ stw_u(uint16_t val, uint16_t * p)
     memmove(p, &tmp, sizeof(*p));
 }
 
-#endif                          /* __GNUC__ */
-
 #ifdef __GNUC__
 #if (defined(linux) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__)) && (defined(__alpha__))
 
commit e03c902e03dea7a6a98ad5fb00580b9404b67c4d
Author: Adam Jackson <ajax at redhat.com>
Date:   Tue Jul 22 10:58:56 2014 -0400

    xfree86: Undefine NO_INLINE
    
    Nothing in the server defines this, nor do any drivers.
    
    Reviewed-by: Julien Cristau <jcristau at debian.org>
    Signed-off-by: Adam Jackson <ajax at redhat.com>
    Signed-off-by: Keith Packard <keithp at keithp.com>

diff --git a/hw/xfree86/common/compiler.h b/hw/xfree86/common/compiler.h
index 7dc4fab..556fa7f 100644
--- a/hw/xfree86/common/compiler.h
+++ b/hw/xfree86/common/compiler.h
@@ -98,7 +98,7 @@
 #if !defined(__GNUC__) && !defined(__FUNCTION__)
 #define __FUNCTION__ __func__   /* C99 */
 #endif
-#if defined(NO_INLINE) || defined(DO_PROTOTYPES)
+#if defined(DO_PROTOTYPES)
 #if !defined(__arm__)
 #if !defined(__sparc__) && !defined(__sparc) && !defined(__arm32__) && !defined(__nds32__) \
       && !(defined(__alpha__) && defined(linux)) \
@@ -157,7 +157,6 @@ extern unsigned short ldw_brx(volatile unsigned char *, int);
 
 #endif                          /* NO_INLINE || DO_PROTOTYPES */
 
-#ifndef NO_INLINE
 #ifdef __GNUC__
 #ifdef __i386__
 
@@ -230,7 +229,6 @@ extern unsigned short ldw_brx(volatile unsigned char *, int);
 #define write_mem_barrier()     /* XXX: nop for now */
 #endif
 #endif                          /* __GNUC__ */
-#endif                          /* NO_INLINE */
 
 #ifndef mem_barrier
 #define mem_barrier()           /* NOP */
@@ -240,7 +238,6 @@ extern unsigned short ldw_brx(volatile unsigned char *, int);
 #define write_mem_barrier()     /* NOP */
 #endif
 
-#ifndef NO_INLINE
 #ifdef __GNUC__
 
 /* Define some packed structures to use with unaligned accesses */
@@ -362,9 +359,7 @@ stw_u(uint16_t val, uint16_t * p)
 }
 
 #endif                          /* __GNUC__ */
-#endif                          /* NO_INLINE */
 
-#ifndef NO_INLINE
 #ifdef __GNUC__
 #if (defined(linux) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__)) && (defined(__alpha__))
 
@@ -1517,8 +1512,6 @@ inl(unsigned short port)
 #endif
 #endif                          /* __GNUC__ */
 
-#endif                          /* NO_INLINE */
-
 #ifdef __alpha__
 /* entry points for Mmio memory access routines */
 extern _X_EXPORT int (*xf86ReadMmio8) (void *, unsigned long);
commit f63b8e44ab278dd65be93146790bf150717fc1c8
Author: Adam Jackson <ajax at redhat.com>
Date:   Tue Jul 22 10:58:55 2014 -0400

    xfree86: Remove MMIO_MOVE32
    
    Only used by mach64's XAA code, which isn't built if XAA isn't
    available, and it isn't.
    
    Reviewed-by: Julien Cristau <jcristau at debian.org>
    Signed-off-by: Adam Jackson <ajax at redhat.com>
    Signed-off-by: Keith Packard <keithp at keithp.com>

diff --git a/hw/xfree86/common/compiler.h b/hw/xfree86/common/compiler.h
index 50b3b3a..7dc4fab 100644
--- a/hw/xfree86/common/compiler.h
+++ b/hw/xfree86/common/compiler.h
@@ -1571,8 +1571,6 @@ extern _X_EXPORT void xf86SlowBCopyToBus(unsigned char *, unsigned char *, int);
     (*xf86WriteMmioNB8)((CARD8)(val), base, offset)
 #define MMIO_ONB16(base, offset, val) \
     (*xf86WriteMmioNB16)((CARD16)(val), base, offset)
-#define MMIO_MOVE32(base, offset, val) \
-    MMIO_OUT32(base, offset, val)
 
 #elif defined(__powerpc__)
  /* 
@@ -1610,9 +1608,6 @@ extern _X_EXPORT void xf86SlowBCopyToBus(unsigned char *, unsigned char *, int);
      xf86WriteMmioNB32Le(base, offset, (CARD32)(val))
 #endif
 
-#define MMIO_MOVE32(base, offset, val) \
-       xf86WriteMmio32Be(base, offset, (CARD32)(val))
-
 #elif defined(__sparc__) || defined(sparc) || defined(__sparc)
  /*
   * Like powerpc, we provide byteswapping and no byteswapping functions
@@ -1651,9 +1646,6 @@ extern _X_EXPORT void xf86SlowBCopyToBus(unsigned char *, unsigned char *, int);
      xf86WriteMmio32LeNB(base, offset, (CARD32)(val))
 #endif
 
-#define MMIO_MOVE32(base, offset, val) \
-       xf86WriteMmio32Be(base, offset, (CARD32)(val))
-
 #elif defined(__nds32__)
  /*
   * we provide byteswapping and no byteswapping functions here
@@ -1691,9 +1683,6 @@ extern _X_EXPORT void xf86SlowBCopyToBus(unsigned char *, unsigned char *, int);
      xf86WriteMmioNB32(base, offset, (CARD32)(val))
 #endif
 
-#define MMIO_MOVE32(base, offset, val) \
-       xf86WriteMmio32(base, offset, (CARD32)(val))
-
 #else                           /* !__alpha__ && !__powerpc__ && !__sparc__ */
 
 #define MMIO_IN8(base, offset) \
@@ -1712,8 +1701,6 @@ extern _X_EXPORT void xf86SlowBCopyToBus(unsigned char *, unsigned char *, int);
 #define MMIO_ONB16(base, offset, val) MMIO_OUT16(base, offset, val)
 #define MMIO_ONB32(base, offset, val) MMIO_OUT32(base, offset, val)
 
-#define MMIO_MOVE32(base, offset, val) MMIO_OUT32(base, offset, val)
-
 #endif                          /* __alpha__ */
 
 /*
commit 1100935650cc0032709d095d6d5a5f136bec99b9
Author: Adam Jackson <ajax at redhat.com>
Date:   Tue Jul 22 10:58:54 2014 -0400

    xfree86: Remove nds32_flush_icache
    
    I guess this might have been needed for elfloader, except we didn't
    support nds32 back then, so I assume this was cargo-culted from
    ppc_flush_icache, which is also dead now.
    
    Reviewed-by: Julien Cristau <jcristau at debian.org>
    Signed-off-by: Adam Jackson <ajax at redhat.com>
    Signed-off-by: Keith Packard <keithp at keithp.com>

diff --git a/hw/xfree86/common/compiler.h b/hw/xfree86/common/compiler.h
index 1bd8def..50b3b3a 100644
--- a/hw/xfree86/common/compiler.h
+++ b/hw/xfree86/common/compiler.h
@@ -1694,23 +1694,6 @@ extern _X_EXPORT void xf86SlowBCopyToBus(unsigned char *, unsigned char *, int);
 #define MMIO_MOVE32(base, offset, val) \
        xf86WriteMmio32(base, offset, (CARD32)(val))
 
-#ifdef N1213_HC                 /* for NDS32 N1213 hardcore */
-static __inline__ void
-nds32_flush_icache(char *addr)
-{
-    __asm__ volatile ("isync %0;"
-                      "msync;"
-                      "isb;"
-                      "cctl %0,L1I_VA_INVAL;" "isb;"::"r" (addr):"memory");
-}
-#else
-static __inline__ void
-nds32_flush_icache(char *addr)
-{
-    __asm__ volatile ("isync %0;" "isb;"::"r" (addr):"memory");
-}
-#endif
-
 #else                           /* !__alpha__ && !__powerpc__ && !__sparc__ */
 
 #define MMIO_IN8(base, offset) \
commit eb76228080da6fb28c34c903a9854aebe157d2c7
Author: Adam Jackson <ajax at redhat.com>
Date:   Tue Jul 22 10:58:53 2014 -0400

    xfree86: Remove #include "compiler.h" from places that don't need it
    
    Reviewed-by: Julien Cristau <jcristau at debian.org>
    Signed-off-by: Adam Jackson <ajax at redhat.com>
    Signed-off-by: Keith Packard <keithp at keithp.com>

diff --git a/hw/xfree86/common/xf86Cursor.c b/hw/xfree86/common/xf86Cursor.c
index 7d0776e..c6abf12 100644
--- a/hw/xfree86/common/xf86Cursor.c
+++ b/hw/xfree86/common/xf86Cursor.c
@@ -37,8 +37,6 @@
 #include "scrnintstr.h"
 #include "globals.h"
 
-#include "compiler.h"
-
 #include "xf86.h"
 #include "xf86Priv.h"
 #include "xf86_OSproc.h"
diff --git a/hw/xfree86/common/xf86Events.c b/hw/xfree86/common/xf86Events.c
index 35a673d..16b3e28 100644
--- a/hw/xfree86/common/xf86Events.c
+++ b/hw/xfree86/common/xf86Events.c
@@ -58,7 +58,6 @@
 #include <X11/Xproto.h>
 #include <X11/Xatom.h>
 #include "misc.h"
-#include "compiler.h"
 #include "xf86.h"
 #include "xf86Priv.h"
 #define XF86_OS_PRIVS
diff --git a/hw/xfree86/common/xf86Init.c b/hw/xfree86/common/xf86Init.c
index 5a45004..b197c1c 100644
--- a/hw/xfree86/common/xf86Init.c
+++ b/hw/xfree86/common/xf86Init.c
@@ -56,8 +56,6 @@
 #include "dbus-core.h"
 #include "systemd-logind.h"
 
-#include "compiler.h"
-
 #include "loaderProcs.h"
 #ifdef XFreeXDGA
 #include "dgaproc.h"
diff --git a/hw/xfree86/loader/loader.c b/hw/xfree86/loader/loader.c
index 64c69bb..cc41dcb 100644
--- a/hw/xfree86/loader/loader.c
+++ b/hw/xfree86/loader/loader.c
@@ -65,7 +65,6 @@
 #include "loaderProcs.h"
 #include "xf86.h"
 #include "xf86Priv.h"
-#include "compiler.h"
 
 #ifdef HAVE_DLFCN_H
 
diff --git a/hw/xfree86/os-support/xf86_OSlib.h b/hw/xfree86/os-support/xf86_OSlib.h
index eb0a338..9120bd7 100644
--- a/hw/xfree86/os-support/xf86_OSlib.h
+++ b/hw/xfree86/os-support/xf86_OSlib.h
@@ -364,8 +364,4 @@ struct pcvtid {
 #define XF86_OS_PRIVS
 #include "xf86_OSproc.h"
 
-#ifndef NO_COMPILER_H
-#include "compiler.h"
-#endif
-
 #endif                          /* _XF86_OSLIB_H */
diff --git a/hw/xfree86/ramdac/xf86RamDacCmap.c b/hw/xfree86/ramdac/xf86RamDacCmap.c
index fa7a866..2a0f755 100644
--- a/hw/xfree86/ramdac/xf86RamDacCmap.c
+++ b/hw/xfree86/ramdac/xf86RamDacCmap.c
@@ -35,7 +35,6 @@
 #include "micmap.h"
 
 #include "xf86.h"
-#include "compiler.h"
 #include "colormapst.h"
 #include "xf86RamDacPriv.h"
 
diff --git a/hw/xfree86/vgahw/vgaCmap.c b/hw/xfree86/vgahw/vgaCmap.c
index 6e028a7..bf61225 100644
--- a/hw/xfree86/vgahw/vgaCmap.c
+++ b/hw/xfree86/vgahw/vgaCmap.c
@@ -28,7 +28,6 @@
 #include <X11/X.h>
 #include <X11/Xproto.h>
 #include "windowstr.h"
-#include "compiler.h"
 #include "mipointer.h"
 #include "micmap.h"
 
commit 4afedf545b673282f2e214c0e2c759c9be9b9a2a
Author: Ross Burton <ross.burton at intel.com>
Date:   Wed Jul 9 11:33:23 2014 +0100

    configure.ac: add option for xshmfence
    
    xshmfence is usable outside of DRI3, and is currently autodetected which isn't
    good for distributions where deterministic builds are desired.
    
    Signed-off-by: Ross Burton <ross.burton at intel.com>
    Reviewed-by: Matt Turner <mattst88 at gmail.com>
    Signed-off-by: Keith Packard <keithp at keithp.com>

diff --git a/configure.ac b/configure.ac
index 0479fd5..f3d9654 100644
--- a/configure.ac
+++ b/configure.ac
@@ -649,6 +649,7 @@ AC_ARG_ENABLE(kdrive-kbd,     AS_HELP_STRING([--enable-kdrive-kbd], [Build kbd d
 AC_ARG_ENABLE(kdrive-mouse,   AS_HELP_STRING([--enable-kdrive-mouse], [Build mouse driver for kdrive (default: auto)]), [KDRIVE_MOUSE=$enableval], [KDRIVE_MOUSE=auto])
 AC_ARG_ENABLE(kdrive-evdev,   AS_HELP_STRING([--enable-kdrive-evdev], [Build evdev driver for kdrive (default: auto)]), [KDRIVE_EVDEV=$enableval], [KDRIVE_EVDEV=auto])
 AC_ARG_ENABLE(libunwind,      AS_HELP_STRING([--enable-libunwind], [Use libunwind for backtracing (default: auto)]), [LIBUNWIND="$enableval"], [LIBUNWIND="auto"])
+AC_ARG_ENABLE(xshmfence,      AS_HELP_STRING([--disable-xshmfence], [Disable xshmfence (default: auto)]), [XSHMFENCE="$enableval"], [XSHMFENCE="auto"])
 
 
 dnl chown/chmod to be setuid root as part of build
@@ -788,7 +789,7 @@ DMXPROTO="dmxproto >= 2.2.99.1"
 VIDMODEPROTO="xf86vidmodeproto >= 2.2.99.1"
 WINDOWSWMPROTO="windowswmproto"
 APPLEWMPROTO="applewmproto >= 1.4"
-XSHMFENCE="xshmfence >= 1.1"
+LIBXSHMFENCE="xshmfence >= 1.1"
 
 dnl Required modules
 XPROTO="xproto >= 7.0.26"
@@ -1236,20 +1237,23 @@ esac
 
 AM_CONDITIONAL(BUSFAULT, test x"$BUSFAULT" = xyes)
 
-PKG_CHECK_MODULES([XSHMFENCE], $XSHMFENCE,
-		  [HAVE_XSHMFENCE=yes], [HAVE_XSHMFENCE=no])
 
-AM_CONDITIONAL(XSHMFENCE, test "x$HAVE_XSHMFENCE" = xyes)
+PKG_CHECK_MODULES([XSHMFENCE], $LIBXSHMFENCE, [HAVE_XSHMFENCE=yes], [HAVE_XSHMFENCE=no])
+if test "x$XSHMFENCE" = "xauto"; then
+    XSHMFENCE="$HAVE_XSHMFENCE"
+fi
 
-case x"$HAVE_XSHMFENCE" in
-	xyes)
-		AC_DEFINE(HAVE_XSHMFENCE, 1, [Have X Shared Memory Fence library])
-		REQUIRED_LIBS="$REQUIRED_LIBS xshmfence"
-		;;
-esac
+if test "x$XSHMFENCE" = "xyes"; then
+    if test "x$HAVE_XSHMFENCE" != "xyes"; then
+        AC_MSG_ERROR([xshmfence requested but not installed.])
+    fi
+    AC_DEFINE(HAVE_XSHMFENCE, 1, [Have xshmfence support])
+    REQUIRED_LIBS="$REQUIRED_LIBS $LIBXSHMFENCE"
+fi
 
+AM_CONDITIONAL(XSHMFENCE, [test "x$XSHMFENCE" = xyes])
 
-case "$DRI3,$HAVE_XSHMFENCE" in
+case "$DRI3,$XSHMFENCE" in
 	yes,yes | auto,yes)
 		;;
 	yes,no)


More information about the Xquartz-changes mailing list