xserver: Branch 'mpx' - 53 commits

Peter Hutterer whot at kemper.freedesktop.org
Thu Jan 10 19:10:11 PST 2008


 GL/glx/Makefile.am                        |    3 
 GL/glx/indirect_size_get.c                |    6 
 Xext/mbuf.c                               |   40 +--
 Xext/xace.c                               |    5 
 Xext/xcalibrate.c                         |   47 +++
 Xext/xselinux.c                           |  172 +++++++-------
 Xext/xselinux.h                           |   26 --
 Xext/xvdisp.c                             |   46 ++-
 config/dbus-core.c                        |    5 
 config/hal.c                              |   11 
 configure.ac                              |   10 
 dix/devices.c                             |    3 
 dix/dispatch.c                            |    2 
 dix/dixutils.c                            |    2 
 dix/privates.c                            |    2 
 exa/exa_accel.c                           |    8 
 hw/dmx/glxProxy/Makefile.am               |    1 
 hw/kdrive/ephyr/ephyr.c                   |    1 
 hw/kdrive/src/kdrive.h                    |    5 
 hw/kdrive/src/kinput.c                    |   12 
 hw/xfree86/common/xf86DPMS.c              |    5 
 hw/xfree86/common/xf86Mode.c              |   35 ++
 hw/xfree86/ddc/edid.h                     |   65 ++++-
 hw/xfree86/ddc/interpret_edid.c           |   80 ++++++
 hw/xfree86/ddc/print_edid.c               |  367 ++++++++++++++++++------------
 hw/xfree86/dixmods/extmod/modinit.h       |    2 
 hw/xfree86/dixmods/extmod/xf86misc.c      |   33 +-
 hw/xfree86/doc/man/xorg.conf.man.pre      |   18 +
 hw/xfree86/dummylib/Makefile.am           |    2 
 hw/xfree86/dummylib/dixprivates.c         |   19 +
 hw/xfree86/dummylib/xf86getpagesize.c     |   21 -
 hw/xfree86/modes/xf86Crtc.c               |    9 
 hw/xfree86/modes/xf86Crtc.h               |    4 
 hw/xfree86/modes/xf86EdidModes.c          |   36 ++
 hw/xfree86/modes/xf86Rotate.c             |    3 
 hw/xfree86/os-support/solaris/sun_mouse.c |    6 
 hw/xfree86/utils/ioport/ioport.c          |    1 
 hw/xquartz/Makefile.am                    |    5 
 hw/xquartz/X11Application.m               |    2 
 hw/xquartz/applewm.c                      |   15 -
 hw/xquartz/bundle/Info.plist              |    4 
 hw/xquartz/darwin.c                       |  126 +++-------
 hw/xquartz/darwin.h                       |   12 
 hw/xquartz/darwinEvents.c                 |    7 
 hw/xquartz/darwinEvents.h                 |    5 
 hw/xquartz/darwinKeyboard.c               |    6 
 hw/xquartz/darwinXinput.c                 |    9 
 hw/xquartz/quartzAudio.c                  |    2 
 hw/xquartz/quartzCocoa.m                  |    1 
 hw/xquartz/quartzForeground.c             |    2 
 hw/xquartz/quartzForeground.h             |    2 
 hw/xquartz/quartzPasteboard.h             |    4 
 hw/xquartz/quartzStartup.c                |    7 
 hw/xquartz/xpr/appledri.c                 |    1 
 hw/xquartz/xpr/xprScreen.c                |  172 ++++++++------
 mi/miinitext.c                            |    6 
 miext/rootless/accel/rlAccel.c            |    5 
 os/connection.c                           |    3 
 58 files changed, 942 insertions(+), 567 deletions(-)

New commits:
commit 38bf01bd1c925614a6e67a38aa3cefc7b8fe3bca
Merge: 4e85c7c... 0883e83...
Author: Peter Hutterer <peter at cs.unisa.edu.au>
Date:   Thu Jan 10 13:38:46 2008 +1030

    Merge branch 'master' into mpx

diff --cc dix/devices.c
index a784637,534a0b9..e78c1e7
--- a/dix/devices.c
+++ b/dix/devices.c
@@@ -587,25 -469,9 +587,26 @@@ InitAndStartDevices(WindowPtr root
  
      for (dev = inputInfo.off_devices; dev; dev = dev->next) {
          DebugF("(dix) initialising device %d\n", dev->id);
- 	ActivateDevice(dev);
+         if (!dev->inited)
+             ActivateDevice(dev);
      }
 +
 +    if (!inputInfo.keyboard) { /* In theory, this cannot happen */
 +	ErrorF("[dix] No core keyboard\n");
 +	return BadImplementation;
 +    }
 +    if (!inputInfo.pointer) { /* In theory, this cannot happen */
 +	ErrorF("[dix] No core pointer\n");
 +	return BadImplementation;
 +    }
 +
 +    /* Now enable all devices */
 +    if (inputInfo.pointer->inited && inputInfo.pointer->startup)
 +        EnableDevice(inputInfo.pointer);
 +    if (inputInfo.keyboard->inited && inputInfo.keyboard->startup)
 +        EnableDevice(inputInfo.keyboard);
 +
 +    /* enable real devices */
      for (dev = inputInfo.off_devices; dev; dev = next)
      {
          DebugF("(dix) enabling device %d\n", dev->id);
commit 0883e838e25227f0af84d2a90979175724166d16
Author: Peter Harris <peter.harris at hummingbird.com>
Date:   Wed Jan 9 14:52:33 2008 -0500

    xf86misc.c: Avoid use of swapped values

diff --git a/hw/xfree86/dixmods/extmod/xf86misc.c b/hw/xfree86/dixmods/extmod/xf86misc.c
index 66278a2..8f44346 100644
--- a/hw/xfree86/dixmods/extmod/xf86misc.c
+++ b/hw/xfree86/dixmods/extmod/xf86misc.c
@@ -250,6 +250,7 @@ ProcXF86MiscGetMouseSettings(client)
     char *devname;
     pointer mouse;
     register int n;
+    int devnamelen;
 
     DEBUG_P("XF86MiscGetMouseSettings");
 
@@ -269,7 +270,7 @@ ProcXF86MiscGetMouseSettings(client)
     rep.emulate3timeout = MiscExtGetMouseValue(mouse, MISC_MSE_EM3TIMEOUT);
     rep.chordmiddle =	  MiscExtGetMouseValue(mouse, MISC_MSE_CHORDMIDDLE);
     rep.flags =		  MiscExtGetMouseValue(mouse, MISC_MSE_FLAGS);
-    rep.devnamelen = (devname? strlen(devname): 0);
+    devnamelen = rep.devnamelen = (devname? strlen(devname): 0);
     rep.length = (sizeof(xXF86MiscGetMouseSettingsReply) -
 		  sizeof(xGenericReply) + ((rep.devnamelen+3) & ~3)) >> 2;
     
@@ -289,8 +290,8 @@ ProcXF86MiscGetMouseSettings(client)
     WriteToClient(client, SIZEOF(xXF86MiscGetMouseSettingsReply), (char *)&rep);
     MiscExtDestroyStruct(mouse, MISC_POINTER);
     
-    if (rep.devnamelen)
-        WriteToClient(client, rep.devnamelen, devname);
+    if (devnamelen)
+        WriteToClient(client, devnamelen, devname);
     return (client->noClientException);
 }
 
@@ -508,6 +509,7 @@ ProcXF86MiscGetFilePaths(client)
     const char *modulepath;
     const char *logfile;
     register int n;
+    int configlen, modulelen, loglen;
 
     DEBUG_P("XF86MiscGetFilePaths");
 
@@ -518,9 +520,9 @@ ProcXF86MiscGetFilePaths(client)
     if (!MiscExtGetFilePaths(&configfile, &modulepath, &logfile))
 	return BadValue;
 
-    rep.configlen = (configfile? strlen(configfile): 0);
-    rep.modulelen = (modulepath? strlen(modulepath): 0);
-    rep.loglen = (logfile? strlen(logfile): 0);
+    configlen = rep.configlen = (configfile? strlen(configfile): 0);
+    modulelen = rep.modulelen = (modulepath? strlen(modulepath): 0);
+    loglen = rep.loglen = (logfile? strlen(logfile): 0);
     rep.length = (SIZEOF(xXF86MiscGetFilePathsReply) - SIZEOF(xGenericReply) +
 		  ((rep.configlen + 3) & ~3) +
 		  ((rep.modulelen + 3) & ~3) +
@@ -535,12 +537,12 @@ ProcXF86MiscGetFilePaths(client)
     }
     WriteToClient(client, SIZEOF(xXF86MiscGetFilePathsReply), (char *)&rep);
     
-    if (rep.configlen)
-        WriteToClient(client, rep.configlen, (char *)configfile);
-    if (rep.modulelen)
-        WriteToClient(client, rep.modulelen, (char *)modulepath);
-    if (rep.loglen)
-        WriteToClient(client, rep.loglen, (char *)logfile);
+    if (configlen)
+        WriteToClient(client, configlen, (char *)configfile);
+    if (modulelen)
+        WriteToClient(client, modulelen, (char *)modulepath);
+    if (loglen)
+        WriteToClient(client, loglen, (char *)logfile);
 
     return (client->noClientException);
 }
@@ -553,6 +555,7 @@ ProcXF86MiscPassMessage(client)
     char *msgtype, *msgval, *retstr;
     int retval, size;
     register int n;
+    int mesglen;
 
     REQUEST(xXF86MiscPassMessageReq);
 
@@ -589,7 +592,7 @@ ProcXF86MiscPassMessage(client)
 
     rep.type = X_Reply;
     rep.sequenceNumber = client->sequence;
-    rep.mesglen = (retstr? strlen(retstr): 0);
+    mesglen = rep.mesglen = (retstr? strlen(retstr): 0);
     rep.length = (SIZEOF(xXF86MiscPassMessageReply) - SIZEOF(xGenericReply) +
 		  ((rep.mesglen + 3) & ~3)) >> 2;
     rep.status = 0;
@@ -601,8 +604,8 @@ ProcXF86MiscPassMessage(client)
     }
     WriteToClient(client, SIZEOF(xXF86MiscPassMessageReply), (char *)&rep);
     
-    if (rep.mesglen)
-        WriteToClient(client, rep.mesglen, (char *)retstr);
+    if (mesglen)
+        WriteToClient(client, mesglen, (char *)retstr);
 
     xfree(msgtype);
     xfree(msgval);
commit 59a63d72a1407a8aaf9878eeff7ee7a66f65a42b
Author: Alan Coopersmith <alan.coopersmith at sun.com>
Date:   Wed Jan 9 18:42:58 2008 -0800

    Fix reference to old versions of XFree86 to not say "Xorg 4.2 or earlier"

diff --git a/hw/xfree86/doc/man/xorg.conf.man.pre b/hw/xfree86/doc/man/xorg.conf.man.pre
index 7eaf5d5..1369a16 100644
--- a/hw/xfree86/doc/man/xorg.conf.man.pre
+++ b/hw/xfree86/doc/man/xorg.conf.man.pre
@@ -2029,7 +2029,7 @@ These both specify that the upper left corner's coordinates are
 The
 .B Absolute
 keyword is optional.
-Some older versions of __xservername__ (4.2 and earlier) don't recognise the
+Some older versions of XFree86 (4.2 and earlier) don't recognise the
 .B Absolute
 keyword, so it's safest to just specify the coordinates without it.
 .TP 4
commit e070c2cbef0d6fbbafce8d417e8b29231c2fdc50
Author: Peter Hutterer <peter at cs.unisa.edu.au>
Date:   Fri Dec 7 20:18:49 2007 +1030

    mi: change infamous "Tossed event ..." error for something more explanatory.
    
    Few whitespace errors fixed.
    Two ErrorF's prefixed with [mi].
    (cherry picked from commit 117458d2db49efd3f04432ff45871b44c7d4ad57)

diff --git a/mi/mieq.c b/mi/mieq.c
index c2f687a..aaa247d 100644
--- a/mi/mieq.c
+++ b/mi/mieq.c
@@ -122,7 +122,7 @@ mieqEnqueue(DeviceIntPtr pDev, xEvent *e)
      * motion event they need to be attached to.  Sigh. */
     if (e->u.u.type == DeviceValuator) {
         if (laste->nevents > 6) {
-            ErrorF("mieqEnqueue: more than six valuator events; dropping.\n");
+            ErrorF("[mi] mieqEnqueue: more than six valuator events; dropping.\n");
             return;
         }
         if (oldtail == miEventQueue.head ||
@@ -133,7 +133,7 @@ mieqEnqueue(DeviceIntPtr pDev, xEvent *e)
               lastkbp->type == ProximityOut) ||
             ((lastkbp->deviceid & DEVICE_BITS) !=
              (v->deviceid & DEVICE_BITS))) {
-            ErrorF("mieqEnequeue: out-of-order valuator event; dropping.\n");
+            ErrorF("[mi] mieqEnequeue: out-of-order valuator event; dropping.\n");
             return;
         }
         memcpy(&(laste->event[laste->nevents++]), e, sizeof(xEvent));
@@ -145,12 +145,13 @@ mieqEnqueue(DeviceIntPtr pDev, xEvent *e)
 	oldtail = (oldtail - 1) % QUEUE_SIZE;
     }
     else {
-    	newtail = (oldtail + 1) % QUEUE_SIZE;
-    	/* Toss events which come in late.  Usually this means your server's
+	newtail = (oldtail + 1) % QUEUE_SIZE;
+	/* Toss events which come in late.  Usually this means your server's
          * stuck in an infinite loop somewhere, but SIGIO is still getting
          * handled. */
-    	if (newtail == miEventQueue.head) {
-            ErrorF("tossed event which came in late\n");
+	if (newtail == miEventQueue.head) {
+            ErrorF("[mi] EQ overflowing. The server is probably stuck "
+                   "in an infinite loop.\n");
 	    return;
         }
 	miEventQueue.tail = newtail;
commit c31aead0fe9fe424120ce221cd9f76cb6d29a5b5
Author: Richard Purdie <rpurdie at openedhand.com>
Date:   Tue Jan 8 12:12:06 2008 +0100

    [Kdrive] make XCalibrate 'orientation aware'

diff --git a/Xext/xcalibrate.c b/Xext/xcalibrate.c
index 97ef3dc..3fe2bdc 100644
--- a/Xext/xcalibrate.c
+++ b/Xext/xcalibrate.c
@@ -164,7 +164,6 @@ ProcXCalibrateSetRawMode (ClientPtr client)
   return (client->noClientException);
 }
 
-
 static int
 SProcXCalibrateSetRawMode (ClientPtr client)
 {
@@ -178,6 +177,47 @@ SProcXCalibrateSetRawMode (ClientPtr client)
   return ProcXCalibrateSetRawMode(client);
 }
 
+static int
+ProcXCalibrateScreenToCoord (ClientPtr client)
+{
+  REQUEST(xXCalibrateScreenToCoordReq);
+  xXCalibrateScreenToCoordReply rep;
+
+  REQUEST_SIZE_MATCH (xXCalibrateScreenToCoordReq);
+
+  memset (&rep, 0, sizeof (rep));
+  rep.type = X_Reply;
+  rep.sequenceNumber = client->sequence;
+  rep.x = stuff->x;
+  rep.y = stuff->y;
+
+  KdScreenToPointerCoords(&rep.x, &rep.y);
+
+  if (client->swapped)
+    {
+      int n;
+
+      swaps (&rep.x, n);
+      swaps (&rep.y, n);
+    }
+  WriteToClient(client, sizeof (rep), (char *) &rep);
+  return (client->noClientException);
+}
+
+static int
+SProcXCalibrateScreenToCoord (ClientPtr client)
+{
+  REQUEST(xXCalibrateScreenToCoordReq);
+  int n;
+
+  REQUEST_SIZE_MATCH (xXCalibrateScreenToCoordReq);
+
+  swaps(&stuff->x, n);
+  swaps(&stuff->y, n);
+
+  return ProcXCalibrateScreenToCoord(client);
+}
+
 static void
 XCalibrateResetProc (ExtensionEntry *extEntry) 
 { 
@@ -192,6 +232,9 @@ ProcXCalibrateDispatch (ClientPtr client)
         return ProcXCalibrateQueryVersion(client);
     case X_XCalibrateRawMode:
         return ProcXCalibrateSetRawMode(client);
+    case X_XCalibrateScreenToCoord:
+        return ProcXCalibrateScreenToCoord(client);
+
     default: break;
     }
 
@@ -211,6 +254,8 @@ SProcXCalibrateDispatch (ClientPtr client)
         return SProcXCalibrateQueryVersion(client);
     case X_XCalibrateRawMode:
         return SProcXCalibrateSetRawMode(client);
+    case X_XCalibrateScreenToCoord:
+        return SProcXCalibrateScreenToCoord(client);
 
     default: break;
     }
diff --git a/hw/kdrive/src/kdrive.h b/hw/kdrive/src/kdrive.h
index 8722ba3..4e04b59 100644
--- a/hw/kdrive/src/kdrive.h
+++ b/hw/kdrive/src/kdrive.h
@@ -832,7 +832,10 @@ KdSetPointerMatrix (KdPointerMatrix *pointer);
 
 void
 KdComputePointerMatrix (KdPointerMatrix *pointer, Rotation randr, int width, int height);
-    
+
+void
+KdScreenToPointerCoords (int *x, int *y);
+
 void
 KdBlockHandler (int		screen,
 		pointer		blockData,
diff --git a/hw/kdrive/src/kinput.c b/hw/kdrive/src/kinput.c
index 6c247c1..df73942 100644
--- a/hw/kdrive/src/kinput.c
+++ b/hw/kdrive/src/kinput.c
@@ -631,6 +631,18 @@ KdComputePointerMatrix (KdPointerMatrix *m, Rotation randr, int width,
     }
 }
 
+void
+KdScreenToPointerCoords (int *x, int *y)
+{
+    int	(*m)[3] = kdPointerMatrix.matrix;
+    int div = m[0][1] * m[1][0] - m[1][1] * m[0][0];
+    int sx = *x;
+    int sy = *y;
+
+    *x = (m[0][1] * sy - m[0][1] * m[1][2] + m[1][1] * m[0][2] - m[1][1] * sx) / div;
+    *y = (m[1][0] * sx + m[0][0] * m[1][2] - m[1][0] * m[0][2] - m[0][0] * sy) / div;
+}
+
 static void
 KdKbdCtrl (DeviceIntPtr pDevice, KeybdCtrl *ctrl)
 {
commit 30375cd6d1439a3390b41714fe116aecc94743ca
Author: David Nusinow <dnusinow at debian.org>
Date:   Mon Jan 7 20:57:30 2008 -0500

    Don't log DPMS enabling as being from xorg.conf if it's not

diff --git a/hw/xfree86/common/xf86DPMS.c b/hw/xfree86/common/xf86DPMS.c
index a23d81d..4fb901a 100644
--- a/hw/xfree86/common/xf86DPMS.c
+++ b/hw/xfree86/common/xf86DPMS.c
@@ -60,6 +60,7 @@ xf86DPMSInit(ScreenPtr pScreen, DPMSSetProcPtr set, int flags)
     ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
     DPMSPtr pDPMS;
     pointer DPMSOpt;
+    MessageType enabled_from = X_INFO;
 
     DPMSKey = &DPMSKey;
 
@@ -78,6 +79,7 @@ xf86DPMSInit(ScreenPtr pScreen, DPMSSetProcPtr set, int flags)
 	    = xf86SetBoolOption(pScrn->options, "dpms", FALSE))
 	    && !DPMSDisabledSwitch)
 	    DPMSEnabled = TRUE;
+            enabled_from = X_CONFIG;
 	xf86MarkOptionUsed(DPMSOpt);
     } else if (DPMSEnabledSwitch) {
 	if (!DPMSDisabledSwitch)
@@ -88,7 +90,7 @@ xf86DPMSInit(ScreenPtr pScreen, DPMSSetProcPtr set, int flags)
 	pDPMS->Enabled = defaultDPMSEnabled;
     }
     if (pDPMS->Enabled)
-	xf86DrvMsg(pScreen->myNum, X_CONFIG, "DPMS enabled\n");
+	xf86DrvMsg(pScreen->myNum, enabled_from, "DPMS enabled\n");
     pDPMS->CloseScreen = pScreen->CloseScreen;
     pScreen->CloseScreen = DPMSClose;
     DPMSCount++;
commit 981bb9f1e33e4564d1b59c00c808cc43a2e9497b
Author: Peter Hutterer <peter at cs.unisa.edu.au>
Date:   Tue Dec 18 13:57:07 2007 +1030

    dix: set the correct number of valuators in valuator events.
    
    (first_valuator + num_valuators) must never be larger than the number of axes,
    otherwise DIX freaks out. And from looking at libXI, anything larger than 6 is
    wrong too.
    (cherry picked from commit 9f6ae61ad12cc2813d04405458e1ca5aed8a539e)

diff --git a/dix/getevents.c b/dix/getevents.c
index 40fc7f2..12cb950 100644
--- a/dix/getevents.c
+++ b/dix/getevents.c
@@ -346,7 +346,7 @@ getValuatorEvents(xEvent *events, DeviceIntPtr pDev, int first_valuator,
     for (i = first_valuator; i < final_valuator; i += 6, xv++, events++) {
         xv->type = DeviceValuator;
         xv->first_valuator = i;
-        xv->num_valuators = num_valuators;
+        xv->num_valuators = ((num_valuators - i) > 6) ? 6 : (num_valuators - i);
         xv->deviceid = pDev->id;
         switch (final_valuator - i) {
         case 6:
commit 260505e3c5a18044e97d31ea3bcc0955e46335c8
Author: David Nusinow <dnusinow at debian.org>
Date:   Sun Jan 6 16:37:13 2008 -0500

    Log enabling of DPMS even when it's not set in xorg.conf

diff --git a/hw/xfree86/common/xf86DPMS.c b/hw/xfree86/common/xf86DPMS.c
index 43efb8e..a23d81d 100644
--- a/hw/xfree86/common/xf86DPMS.c
+++ b/hw/xfree86/common/xf86DPMS.c
@@ -79,7 +79,6 @@ xf86DPMSInit(ScreenPtr pScreen, DPMSSetProcPtr set, int flags)
 	    && !DPMSDisabledSwitch)
 	    DPMSEnabled = TRUE;
 	xf86MarkOptionUsed(DPMSOpt);
-	xf86DrvMsg(pScreen->myNum, X_CONFIG, "DPMS enabled\n");
     } else if (DPMSEnabledSwitch) {
 	if (!DPMSDisabledSwitch)
 	    DPMSEnabled = TRUE;
@@ -88,6 +87,8 @@ xf86DPMSInit(ScreenPtr pScreen, DPMSSetProcPtr set, int flags)
     else {
 	pDPMS->Enabled = defaultDPMSEnabled;
     }
+    if (pDPMS->Enabled)
+	xf86DrvMsg(pScreen->myNum, X_CONFIG, "DPMS enabled\n");
     pDPMS->CloseScreen = pScreen->CloseScreen;
     pScreen->CloseScreen = DPMSClose;
     DPMSCount++;
commit 7e7622165940934e56ae96ae785a8f88eec1a5cf
Author: Julien Cristau <jcristau at debian.org>
Date:   Sun Jan 6 18:23:09 2008 +0100

    Fix the name of the XFree86-Misc extension in the xorg.conf manpage.

diff --git a/hw/xfree86/doc/man/xorg.conf.man.pre b/hw/xfree86/doc/man/xorg.conf.man.pre
index 9a08111..7eaf5d5 100644
--- a/hw/xfree86/doc/man/xorg.conf.man.pre
+++ b/hw/xfree86/doc/man/xorg.conf.man.pre
@@ -493,7 +493,7 @@ extension) to connect from another host.
 Default: off.
 .TP 7
 .BI "Option \*qDisableModInDev\*q  \*q" boolean \*q
-This disables the parts of the __xservername__\-Misc extension that can be used to
+This disables the parts of the XFree86\-Misc extension that can be used to
 modify the input device settings dynamically.
 Default: that functionality is enabled.
 .TP 7
commit 59df687835c68eda147de47edfe9bc415c0efb4f
Author: Julien Cristau <jcristau at debian.org>
Date:   Sun Jan 6 16:57:45 2008 +0100

    Document the AllowEmptyInput, AutoAddDevices and AutoEnableDevices flags
    
    Add documentation for the new AllowEmptyInput, AutoAddDevices and
    AutoEnableDevices server flags in the xorg.conf manpage.

diff --git a/hw/xfree86/doc/man/xorg.conf.man.pre b/hw/xfree86/doc/man/xorg.conf.man.pre
index 77439a5..9a08111 100644
--- a/hw/xfree86/doc/man/xorg.conf.man.pre
+++ b/hw/xfree86/doc/man/xorg.conf.man.pre
@@ -704,6 +704,20 @@ default.
 .BI "Option \*qIgnoreABI\*q \*q" boolean \*q
 Allow modules built for a different, potentially incompatible version of
 the X server to load. Disabled by default.
+.TP 7
+.BI "Option \*qAllowEmptyInput\*q \*q" boolean \*q
+If enabled, don't add the standard keyboard and mouse drivers, if there are no
+input devices in the config file.  Disabled by default.
+.TP 7
+.BI "Option \*qAutoAddDevices\*q \*q" boolean \*q
+If this option is disabled, then no devices will be added from HAL events.
+Enabled by default.
+.TP 7
+.BI "Option \*qAutoEnableDevices\*q \*q" boolean \*q
+If this option is disabled, then the devices will be added (and the
+DevicePresenceNotify event sent), but not enabled, thus leaving policy up
+to the client.
+Enabled by default.
 .SH "MODULE SECTION"
 The
 .B Module
commit 7d226d6a251cb90765be2b50a1973986c5b7605b
Author: Jeremy Huddleston <jeremy at yuffie.local>
Date:   Sat Jan 5 03:14:07 2008 -0800

    XQuartz: Cleanup for strict-prototyping
    Also fixed DarwinEQEnqueue to match changes to the callback
    And also use dpmsstubs.c rather than copying the code into darwin.c
    (cherry picked from commit 4c5c30a4beb7a427b00b18097f548876ad3c11d7)

diff --git a/hw/xquartz/Makefile.am b/hw/xquartz/Makefile.am
index 9ac6e0a..99d23eb 100644
--- a/hw/xquartz/Makefile.am
+++ b/hw/xquartz/Makefile.am
@@ -19,6 +19,7 @@ DIST_SUBDIRS = xpr bundle
 libXquartz_la_SOURCES = \
 	$(top_srcdir)/fb/fbcmap_mi.c \
 	$(top_srcdir)/mi/miinitext.c \
+	$(top_srcdir)/Xext/dpmsstubs.c \
 	X11Application.m \
 	X11Controller.m \
 	applewm.c \
diff --git a/hw/xquartz/X11Application.m b/hw/xquartz/X11Application.m
index 56db2c4..72537bb 100644
--- a/hw/xquartz/X11Application.m
+++ b/hw/xquartz/X11Application.m
@@ -855,7 +855,7 @@ static void send_nsevent (NSEventType type, NSEvent *e) {
     NSWindow *window;
     int pointer_x, pointer_y, ev_button, ev_type; 
     //    int num_events=0, i=0, state;
-    xEvent xe;
+    // xEvent xe;
 	
     /* convert location to global top-left coordinates */
     location = [e locationInWindow];
diff --git a/hw/xquartz/applewm.c b/hw/xquartz/applewm.c
index 72dca28..c460ec6 100644
--- a/hw/xquartz/applewm.c
+++ b/hw/xquartz/applewm.c
@@ -264,8 +264,7 @@ WMFreeEvents (data, id)
 }
 
 static int
-ProcAppleWMSelectInput (client)
-    register ClientPtr  client;
+ProcAppleWMSelectInput (register ClientPtr client)
 {
     REQUEST(xAppleWMSelectInputReq);
     WMEventPtr      pEvent, pNewEvent, *pHead;
@@ -479,13 +478,11 @@ ProcAppleWMSetFrontProcess(
 }
 
 static int
-ProcAppleWMSetWindowLevel(
-    register ClientPtr client
-)
+ProcAppleWMSetWindowLevel(register ClientPtr client)
 {
     REQUEST(xAppleWMSetWindowLevelReq);
     WindowPtr pWin;
-    int errno;
+    int err;
 
     REQUEST_SIZE_MATCH(xAppleWMSetWindowLevelReq);
 
@@ -497,9 +494,9 @@ ProcAppleWMSetWindowLevel(
         return BadValue;
     }
 
-     errno = appleWMProcs->SetWindowLevel(pWin, stuff->level);
-     if (errno != Success) {
-        return errno;
+     err = appleWMProcs->SetWindowLevel(pWin, stuff->level);
+     if (err != Success) {
+        return err;
     }
 
     return (client->noClientException);
diff --git a/hw/xquartz/darwin.c b/hw/xquartz/darwin.c
index 3ad9e14..20bcee5 100644
--- a/hw/xquartz/darwin.c
+++ b/hw/xquartz/darwin.c
@@ -879,24 +879,6 @@ void AbortDDX( void )
     ddxGiveUp();
 }
 
-
-/*
- * DPMS extension stubs
- */
-Bool DPMSSupported(void)
-{
-    return FALSE;
-}
-
-void DPMSSet(int level)
-{
-}
-
-int DPMSGet(int *level)
-{
-    return -1;
-}
-
 #include "mivalidate.h" // for union _Validate used by windowstr.h
 #include "windowstr.h"  // for struct _Window
 #include "scrnintstr.h" // for struct _Screen
diff --git a/hw/xquartz/darwinEvents.c b/hw/xquartz/darwinEvents.c
index 1760792..827fd81 100644
--- a/hw/xquartz/darwinEvents.c
+++ b/hw/xquartz/darwinEvents.c
@@ -45,6 +45,7 @@ in this Software without prior written authorization from The Open Group.
 #include "darwin.h"
 #include "quartz.h"
 #include "darwinKeyboard.h"
+#include "darwinEvents.h"
 
 #include <sys/types.h>
 #include <sys/uio.h>
@@ -213,9 +214,8 @@ Bool DarwinEQInit(DevicePtr pKbd, DevicePtr pPtr) {
  * 
  * This should be deprecated in favor of miEQEnqueue -- BB
  */
-void DarwinEQEnqueue(const xEvent *e) {
+void DarwinEQEnqueue(const xEventPtr e) {
     HWEventQueueType oldtail, newtail;
-    char byte = 0;
 
     oldtail = darwinEventQueue.tail;
 
@@ -253,7 +253,7 @@ void DarwinEQEnqueue(const xEvent *e) {
  * DarwinEQPointerPost
  *  Post a pointer event. Used by the mipointer.c routines.
  */
-void DarwinEQPointerPost(xEvent *e) {
+void DarwinEQPointerPost(DeviceIntPtr pdev, xEventPtr e) {
     (*darwinEventQueue.pPtr->processInputProc)
             (e, (DeviceIntPtr)darwinEventQueue.pPtr, 1);
 }
@@ -274,7 +274,6 @@ void ProcessInputEvents(void) {
     EventRec *e;
     int     x, y;
     xEvent  xe;
-    static int  old_flags = 0;  // last known modifier state
     // button number and modifier mask of currently pressed fake button
     input_check_flag=0;
 
diff --git a/hw/xquartz/darwinEvents.h b/hw/xquartz/darwinEvents.h
index d6cab2e..82cc26b 100644
--- a/hw/xquartz/darwinEvents.h
+++ b/hw/xquartz/darwinEvents.h
@@ -28,12 +28,13 @@
 #define _DARWIN_EVENTS_H
 
 Bool DarwinEQInit(DevicePtr pKbd, DevicePtr pPtr);
-void DarwinEQEnqueue(const xEvent *e);
-void DarwinEQPointerPost(xEvent *e);
+void DarwinEQEnqueue(const xEventPtr e);
+void DarwinEQPointerPost(DeviceIntPtr pDev, xEventPtr e);
 void DarwinEQSwitchScreen(ScreenPtr pScreen, Bool fromDIX);
 void DarwinPokeEQ(void);
 void DarwinSendPointerEvents(int ev_type, int ev_button, int pointer_x, int pointer_y);
 void DarwinSendKeyboardEvents(int ev_type, int keycode);
 void DarwinSendScrollEvents(float count, int pointer_x, int pointer_y);
+void DarwinUpdateModKeys(int flags);
 
 #endif  /* _DARWIN_EVENTS_H */
diff --git a/hw/xquartz/darwinKeyboard.c b/hw/xquartz/darwinKeyboard.c
index f1b90b7..b368fe9 100644
--- a/hw/xquartz/darwinKeyboard.c
+++ b/hw/xquartz/darwinKeyboard.c
@@ -330,7 +330,7 @@ static void parse_next_char_code(DataStream *s, KeySym *k) {
  * DarwinReadKeymapFile
  *      Read the appropriate keymapping from a keymapping file.
  */
-Bool DarwinReadKeymapFile(NXKeyMapping *keyMap) {
+static Bool DarwinReadKeymapFile(NXKeyMapping *keyMap) {
     struct stat         st;
     NXEventSystemDevice info[20];
     int                 interface = 0, handler_id = 0;
@@ -439,7 +439,7 @@ Bool DarwinReadKeymapFile(NXKeyMapping *keyMap) {
 /*
  * DarwinParseNXKeyMapping
  */
-Bool DarwinParseNXKeyMapping(darwinKeyboardInfo  *info) {
+static Bool DarwinParseNXKeyMapping(darwinKeyboardInfo  *info) {
     KeySym              *k;
     int                 i;
     short               numMods, numKeys, numPadKeys = 0;
@@ -933,7 +933,7 @@ int DarwinModifierNXMaskToNXKey(int mask) {
     return -1;
 }
 
-const char *DarwinModifierNXMaskTostring(int mask) {
+static const char *DarwinModifierNXMaskTostring(int mask) {
     switch (mask) {
         case NX_ALPHASHIFTMASK:      return "NX_ALPHASHIFTMASK";
         case NX_SHIFTMASK:           return "NX_SHIFTMASK";
diff --git a/hw/xquartz/darwinXinput.c b/hw/xquartz/darwinXinput.c
index ee456a4..e62ec0a 100644
--- a/hw/xquartz/darwinXinput.c
+++ b/hw/xquartz/darwinXinput.c
@@ -63,6 +63,7 @@ SOFTWARE.
 #include <X11/extensions/XI.h>
 #include <X11/extensions/XIproto.h>
 #include "XIstubs.h"
+#include "chgkbd.h"
 
 /***********************************************************************
  *
@@ -88,16 +89,12 @@ SOFTWARE.
  *
  */
 
-int
-ChangeKeyboardDevice (old_dev, new_dev)
-    DeviceIntPtr	old_dev;
-    DeviceIntPtr	new_dev;
-    {
+int ChangeKeyboardDevice (DeviceIntPtr old_dev, DeviceIntPtr new_dev) {
     /***********************************************************************
      DeleteFocusClassDeviceStruct(old_dev);	 * defined in xchgptr.c *
     **********************************************************************/
     return BadMatch;
-    }
+}
 
 
 /***********************************************************************
diff --git a/hw/xquartz/quartzAudio.c b/hw/xquartz/quartzAudio.c
index 86bb200..5dee32f 100644
--- a/hw/xquartz/quartzAudio.c
+++ b/hw/xquartz/quartzAudio.c
@@ -50,7 +50,7 @@
 #include <X11/extensions/XI.h>
 #include <assert.h>
 
-void NSBeep();
+void NSBeep(void);
 
 typedef struct QuartzAudioRec {
     double frequency;
diff --git a/hw/xquartz/quartzCocoa.m b/hw/xquartz/quartzCocoa.m
index 0086c5c..53e3f08 100644
--- a/hw/xquartz/quartzCocoa.m
+++ b/hw/xquartz/quartzCocoa.m
@@ -37,6 +37,7 @@
 #endif
 
 #include "quartzCommon.h"
+#include "quartzPasteboard.h"
 
 #define BOOL xBOOL
 #include "darwin.h"
diff --git a/hw/xquartz/quartzForeground.c b/hw/xquartz/quartzForeground.c
index bfea642..0e724de 100644
--- a/hw/xquartz/quartzForeground.c
+++ b/hw/xquartz/quartzForeground.c
@@ -32,6 +32,8 @@
 #include <ApplicationServices/ApplicationServices.h>
 #include <stdio.h>
 
+#include "quartzForeground.h"
+
 int QuartzMoveToForeground() {
    ProcessSerialNumber psn = { 0, kCurrentProcess };
    OSStatus returnCode = TransformProcessType(& psn, kProcessTransformToForegroundApplication);
diff --git a/hw/xquartz/quartzForeground.h b/hw/xquartz/quartzForeground.h
index 4fc21c7..b5422ff 100644
--- a/hw/xquartz/quartzForeground.h
+++ b/hw/xquartz/quartzForeground.h
@@ -32,6 +32,6 @@
 #ifndef _QUARTZ_FOREGROUND_H_
 #define _QUARTZ_FOREGROUND_H_
 
-int QuartzMoveToForeground();
+int QuartzMoveToForeground(void);
 
 #endif /* _QUARTZ_FOREGROUND_H_ */
diff --git a/hw/xquartz/quartzPasteboard.h b/hw/xquartz/quartzPasteboard.h
index afcb6e5..d6a8ee8 100644
--- a/hw/xquartz/quartzPasteboard.h
+++ b/hw/xquartz/quartzPasteboard.h
@@ -34,11 +34,11 @@
 #define _QUARTZPASTEBOARD_H
 
 // Aqua->X 
-void QuartzReadPasteboard();
+void QuartzReadPasteboard(void);
 char * QuartzReadCocoaPasteboard(void);	// caller must free string
 
 // X->Aqua
-void QuartzWritePasteboard();
+void QuartzWritePasteboard(void);
 void QuartzWriteCocoaPasteboard(char *text);
 
 #endif	/* _QUARTZPASTEBOARD_H */
diff --git a/hw/xquartz/quartzStartup.c b/hw/xquartz/quartzStartup.c
index 1b2a226..e25e155 100644
--- a/hw/xquartz/quartzStartup.c
+++ b/hw/xquartz/quartzStartup.c
@@ -52,8 +52,11 @@
 char **envpGlobal;      // argcGlobal and argvGlobal
                         // are from dix/globals.c
 
+int main(int argc, char **argv, char **envp);
+void _InitHLTB(void);
+void DarwinHandleGUI(int argc, char **argv, char **envp);
+
 static void server_thread (void *arg) {
-  extern int main(int argc, char **argv, char **envp);
   exit (main (argcGlobal, argvGlobal, envpGlobal));
 }
 
@@ -103,8 +106,6 @@ void DarwinHandleGUI(int argc, char **argv, char **envp) {
        before the main thread when we're _not_ prebound, things fail,
        so initialize by hand. */
 
-    extern void _InitHLTB(void);
-    
     _InitHLTB();    
     X11ControllerMain(argc, (const char **)argv, server_thread, NULL);
     exit(0);
diff --git a/hw/xquartz/xpr/appledri.c b/hw/xquartz/xpr/appledri.c
index 95a4439..b4a4725 100644
--- a/hw/xquartz/xpr/appledri.c
+++ b/hw/xquartz/xpr/appledri.c
@@ -55,6 +55,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 #include "swaprep.h"
 #include "dri.h"
 #include "dristruct.h"
+#include "xpr.h"
 
 static int DRIErrorBase = 0;
 
commit 11967dce11cd953d123d53bb3389aa257c5158e8
Author: Jeremy Huddleston <jeremy at yuffie.local>
Date:   Fri Jan 4 22:54:26 2008 -0800

    XQuartz: Fixed copyright in About box for 2008.  Happy New Year!

diff --git a/hw/xquartz/Makefile.am b/hw/xquartz/Makefile.am
index 831ba49..9ac6e0a 100644
--- a/hw/xquartz/Makefile.am
+++ b/hw/xquartz/Makefile.am
@@ -1,7 +1,9 @@
 noinst_LTLIBRARIES = libXquartz.la
 AM_CFLAGS = $(XSERVER_CFLAGS) $(DIX_CFLAGS)
+AM_OBJCFLAGS = $(XSERVER_CFLAGS) $(DIX_CFLAGS)
 AM_CPPFLAGS = \
 	-DBUILD_DATE=\"$(BUILD_DATE)\" \
+	-DXSERVER_VERSION=\"$(VERSION)\" \
 	-DINXQUARTZ \
 	-DUSE_NEW_CLUT \
 	-DXFree86Server \
@@ -15,7 +17,7 @@ SUBDIRS = . xpr $(X11APP_SUBDIRS)
 DIST_SUBDIRS = xpr bundle
 
 libXquartz_la_SOURCES = \
-	$(top_srcdir)/fb/fbcmap.c \
+	$(top_srcdir)/fb/fbcmap_mi.c \
 	$(top_srcdir)/mi/miinitext.c \
 	X11Application.m \
 	X11Controller.m \
diff --git a/hw/xquartz/bundle/Info.plist b/hw/xquartz/bundle/Info.plist
index fce8c96..5babdfe 100644
--- a/hw/xquartz/bundle/Info.plist
+++ b/hw/xquartz/bundle/Info.plist
@@ -25,9 +25,9 @@
 	<key>CSResourcesFileMapped</key>
 		<true/>
 	<key>NSHumanReadableCopyright</key>
-		<string>Copyright © 2003-2007, Apple Inc.
+		<string>Copyright © 2003-2008, Apple Inc.
 Copyright © 2003, XFree86 Project, Inc.
-Copyright © 2003-2007, X.org Project, Inc.
+Copyright © 2003-2008, X.org Project, Inc.
 </string>
 	<key>NSMainNibFile</key>
 		<string>main</string>
commit aca75f389e2b08096c3cacec03b12a58075cf12c
Author: Jeremy Huddleston <jeremy at yuffie.local>
Date:   Fri Jan 4 12:23:09 2008 -0800

    XQuartz: Flush the debug log for easier debugging
    Also cleaned up formatting in xpr's eventHandler
    (cherry picked from commit 16861d6d4239c7f3918332ef07752f1e211afb23)

diff --git a/hw/xquartz/darwin.h b/hw/xquartz/darwin.h
index 1925424..c5e2ed8 100644
--- a/hw/xquartz/darwin.h
+++ b/hw/xquartz/darwin.h
@@ -124,7 +124,7 @@ enum {
 #ifdef ENABLE_DEBUG_LOG
 extern FILE *debug_log_fp;
 #define DEBUG_LOG_NAME "x11-debug.txt"
-#define DEBUG_LOG(msg, args...) if (debug_log_fp) fprintf(debug_log_fp, "%s:%d: " msg, __FUNCTION__, __LINE__, ##args )
+#define DEBUG_LOG(msg, args...) if (debug_log_fp) fprintf(debug_log_fp, "%s:%s:%d " msg, __FILE__, __FUNCTION__, __LINE__, ##args ); fflush(debug_log_fp);
 #else
 #define DEBUG_LOG(msg, args...) 
 #endif
diff --git a/hw/xquartz/xpr/xprScreen.c b/hw/xquartz/xpr/xprScreen.c
index 29179e5..e4e1fda 100644
--- a/hw/xquartz/xpr/xprScreen.c
+++ b/hw/xquartz/xpr/xprScreen.c
@@ -62,53 +62,52 @@ static const char *xprOpenGLBundle = "glxCGL.bundle";
  * eventHandler
  *  Callback handler for Xplugin events.
  */
-static void
-eventHandler(unsigned int type, const void *arg,
-             unsigned int arg_size, void *data)
-{
+static void eventHandler(unsigned int type, const void *arg,
+                         unsigned int arg_size, void *data) {
     switch (type) {
-    case XP_EVENT_DISPLAY_CHANGED:
-      DEBUG_LOG("XP_EVENT_DISPLAY_CHANGED\n");
-      QuartzMessageServerThread(kXDarwinDisplayChanged, 0);
-      break;
-
-    case XP_EVENT_WINDOW_STATE_CHANGED:
-      DEBUG_LOG("XP_EVENT_WINDOW_STATE_CHANGED\n");
-      if (arg_size >= sizeof(xp_window_state_event)) {
-	const xp_window_state_event *ws_arg = arg;
-	
-	QuartzMessageServerThread(kXDarwinWindowState, 2,
-				  ws_arg->id, ws_arg->state);
-      }
-      break;
-
-    case XP_EVENT_WINDOW_MOVED:
-      DEBUG_LOG("XP_EVENT_WINDOW_MOVED\n");
-      if (arg_size == sizeof(xp_window_id))  {
-	xp_window_id id = * (xp_window_id *) arg;
-	WindowPtr pWin = xprGetXWindow(id);
-	QuartzMessageServerThread(kXDarwinWindowMoved, 1, pWin);
-      }
-      break;
-      
-    case XP_EVENT_SURFACE_DESTROYED:
-      DEBUG_LOG("XP_EVENT_SURFACE_DESTROYED\n");
-    case XP_EVENT_SURFACE_CHANGED:
-      DEBUG_LOG("XP_EVENT_SURFACE_CHANGED\n");
-        if (arg_size == sizeof(xp_surface_id)) {
-	  int kind;
-	  
-	  if (type == XP_EVENT_SURFACE_DESTROYED)
-	    kind = AppleDRISurfaceNotifyDestroyed;
-	  else
-	    kind = AppleDRISurfaceNotifyChanged;
-	  
-	  DRISurfaceNotify(*(xp_surface_id *) arg, kind);
-        }
-        break;
-    default:
-      ErrorF("Unknown XP_EVENT type (%d) in xprScreen:eventHandler\n",
-	     type);
+        case XP_EVENT_DISPLAY_CHANGED:
+            DEBUG_LOG("XP_EVENT_DISPLAY_CHANGED\n");
+            QuartzMessageServerThread(kXDarwinDisplayChanged, 0);
+            break;
+            
+        case XP_EVENT_WINDOW_STATE_CHANGED:
+            if (arg_size >= sizeof(xp_window_state_event)) {
+                const xp_window_state_event *ws_arg = arg;
+                
+                DEBUG_LOG("XP_EVENT_WINDOW_STATE_CHANGED: id=%d, state=%d\n", ws_arg->id, ws_arg->state);
+                QuartzMessageServerThread(kXDarwinWindowState, 2,
+                                          ws_arg->id, ws_arg->state);
+            } else {
+                DEBUG_LOG("XP_EVENT_WINDOW_STATE_CHANGED: ignored\n");
+            }
+            break;
+            
+        case XP_EVENT_WINDOW_MOVED:
+            DEBUG_LOG("XP_EVENT_WINDOW_MOVED\n");
+            if (arg_size == sizeof(xp_window_id))  {
+                xp_window_id id = * (xp_window_id *) arg;
+                WindowPtr pWin = xprGetXWindow(id);
+                QuartzMessageServerThread(kXDarwinWindowMoved, 1, pWin);
+            }
+            break;
+            
+        case XP_EVENT_SURFACE_DESTROYED:
+            DEBUG_LOG("XP_EVENT_SURFACE_DESTROYED\n");
+        case XP_EVENT_SURFACE_CHANGED:
+            DEBUG_LOG("XP_EVENT_SURFACE_CHANGED\n");
+            if (arg_size == sizeof(xp_surface_id)) {
+                int kind;
+                
+                if (type == XP_EVENT_SURFACE_DESTROYED)
+                    kind = AppleDRISurfaceNotifyDestroyed;
+                else
+                    kind = AppleDRISurfaceNotifyChanged;
+                
+                DRISurfaceNotify(*(xp_surface_id *) arg, kind);
+            }
+            break;
+        default:
+            ErrorF("Unknown XP_EVENT type (%d) in xprScreen:eventHandler\n", type);
     }
 }
 
commit 57468a696e1259c1e1c185fc60230e1d195defb7
Author: Alan Hourihane <alanh at tungstengraphics.com>
Date:   Fri Jan 4 12:37:55 2008 +0000

    Fix Line drawing with CapNotLast set in PolySegment.

diff --git a/exa/exa_accel.c b/exa/exa_accel.c
index ae951ed..c2bfdee 100644
--- a/exa/exa_accel.c
+++ b/exa/exa_accel.c
@@ -739,6 +739,14 @@ exaPolySegment (DrawablePtr pDrawable, GCPtr pGC, int nseg,
 	    prect[i].y = pSeg[i].y2;
 	    prect[i].height = pSeg[i].y1 - pSeg[i].y2 + 1;
 	}
+
+	/* don't paint last pixel */
+	if (pGC->capStyle == CapNotLast) {
+	    if (prect[i].width == 1)
+		prect[i].height--;
+	    else
+		prect[i].width--;
+	}
     }
     pGC->ops->PolyFillRect(pDrawable, pGC, nseg, prect);
     xfree(prect);
commit 39cb782f28be4efb2621fd8c614f2367eb834412
Author: Eamon Walsh <ewalsh at tycho.nsa.gov>
Date:   Thu Jan 3 23:16:06 2008 -0500

    XACE: DeleteCallbackList zeroes out its argument so don't do it twice.

diff --git a/Xext/xace.c b/Xext/xace.c
index 6a7df31..e85a517 100644
--- a/Xext/xace.c
+++ b/Xext/xace.c
@@ -262,10 +262,7 @@ XaceResetProc(ExtensionEntry *extEntry)
     int i;
 
     for (i=0; i<XACE_NUM_HOOKS; i++)
-    {
 	DeleteCallbackList(&XaceHooks[i]);
-	XaceHooks[i] = NULL;
-    }
 } /* XaceResetProc */
 
 
commit 7f376f23db463a65176de632ca6094acb55db951
Author: Eamon Walsh <ewalsh at tycho.nsa.gov>
Date:   Thu Jan 3 23:08:49 2008 -0500

    devPrivates rework: Free callback lists after use.

diff --git a/dix/privates.c b/dix/privates.c
index e04da41..47a0e1a 100644
--- a/dix/privates.c
+++ b/dix/privates.c
@@ -232,6 +232,8 @@ dixResetPrivates(void)
     /* reset internal structures */
     while (items) {
 	next = items->next;
+	DeleteCallbackList(&items->initfuncs);
+	DeleteCallbackList(&items->deletefuncs);
 	xfree(items);
 	items = next;
     }
commit de18703d2a25999e391d11b4c82ee018fb87372d
Author: Eamon Walsh <ewalsh at tycho.nsa.gov>
Date:   Thu Jan 3 23:07:24 2008 -0500

    dix: Fix bug+leak in callback manager DeleteCallbackList function.

diff --git a/dix/dixutils.c b/dix/dixutils.c
index 786f4e3..dd485d5 100644
--- a/dix/dixutils.c
+++ b/dix/dixutils.c
@@ -800,7 +800,7 @@ _DeleteCallbackList(
 
     for (i = 0; i < numCallbackListsToCleanup; i++)
     {
-	if ((listsToCleanup[i] = pcbl) != 0)
+	if (listsToCleanup[i] == pcbl)
 	{
 	    listsToCleanup[i] = NULL;
 	    break;
commit 20eb26f9d149993ae360a2cbd1b536b68c9f4069
Author: Alex Deucher <alex at samba.(none)>
Date:   Thu Jan 3 22:53:36 2008 -0500

    Fix potential crasher in xf86CrtcRotate()
    
    xf86CrtcRotate() is called by randr 1.2 drivers via xf86CrtcSetMode() or xf86SetDesiredModes()
    during ScreenInit() at which point pScrn->pScreen is not set. If a user specifies a rotation
    in their config file pScrn->pScreen is dereferenced and boom.

diff --git a/hw/xfree86/modes/xf86Rotate.c b/hw/xfree86/modes/xf86Rotate.c
index 380478f..c129d9b 100644
--- a/hw/xfree86/modes/xf86Rotate.c
+++ b/hw/xfree86/modes/xf86Rotate.c
@@ -494,7 +494,8 @@ xf86CrtcRotate (xf86CrtcPtr crtc, DisplayModePtr mode, Rotation rotation)
 {
     ScrnInfoPtr		pScrn = crtc->scrn;
     xf86CrtcConfigPtr   xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
-    ScreenPtr		pScreen = pScrn->pScreen;
+    /* if this is called during ScreenInit() we don't have pScrn->pScreen yet */
+    ScreenPtr		pScreen = screenInfo.screens[pScrn->scrnIndex];
     PictTransform	crtc_to_fb, fb_to_crtc;
     
     PictureTransformIdentity (&crtc_to_fb);
commit cd0603c2dc5ee000ebce66056bc1a72f99bfb617
Author: Eamon Walsh <ewalsh at tycho.nsa.gov>
Date:   Thu Jan 3 21:41:02 2008 -0500

    Bug #13765: Heap corruption in XC-SECURITY extension code.

diff --git a/Xext/xace.c b/Xext/xace.c
index 9f8a8cc..6a7df31 100644
--- a/Xext/xace.c
+++ b/Xext/xace.c
@@ -448,7 +448,7 @@ XaceCensorImage(client, pVisibleRegion, widthBytesLine, pDraw, x, y, w, h,
 
 	/* convert region to list-of-rectangles for PolyFillRect */
 
-	pRects = (xRectangle *)xalloc(nRects * sizeof(xRectangle *));
+	pRects = (xRectangle *)xalloc(nRects * sizeof(xRectangle));
 	if (!pRects)
 	{
 	    failed = TRUE;
commit e46d559739e020dc7f6fcbdc6d1fb39c57aab4b1
Author: Jeremy Huddleston <jeremy at yuffie.local>
Date:   Sat Dec 22 15:09:12 2007 -0800

    XQuartz: Cleaned up color map configuration.
    8 bit color still doesn't work, but the -depth command line argument now works properly.
    (cherry picked from commit 6765949c27c053d22882f54337cfd09203aa5383)

diff --git a/hw/xquartz/darwin.c b/hw/xquartz/darwin.c
index 4630734..3ad9e14 100644
--- a/hw/xquartz/darwin.c
+++ b/hw/xquartz/darwin.c
@@ -78,7 +78,7 @@
 #include "darwinEvents.h"
 #include "darwinKeyboard.h"
 #include "quartz.h"
-#include "darwinClut8.h"
+//#include "darwinClut8.h"
 
 #ifdef ENABLE_DEBUG_LOG
 FILE *debug_log_fp = NULL;
@@ -176,17 +176,10 @@ static Bool DarwinSaveScreen(ScreenPtr pScreen, int on)
  *  This is a callback from dix during AddScreen() from InitOutput().
  *  Initialize the screen and communicate information about it back to dix.
  */
-static Bool DarwinAddScreen(
-    int         index,
-    ScreenPtr   pScreen,
-    int         argc,
-    char        **argv )
-{
-    int         bitsPerRGB, i, dpi;
+static Bool DarwinAddScreen(int index, ScreenPtr pScreen, int argc, char **argv) {
+    int         dpi;
     static int  foundIndex = 0;
     Bool        ret;
-    VisualPtr   visual;
-    ColormapPtr pmap;
     DarwinFramebufferPtr dfb;
 
     // reset index of found screens for each server generation
@@ -204,28 +197,13 @@ static Bool DarwinAddScreen(
     if (! ret)
         return FALSE;
 
-    bitsPerRGB = dfb->bitsPerComponent;
-
     // reset the visual list
     miClearVisualTypes();
 
     // setup a single visual appropriate for our pixel type
-    if (dfb->colorType == TrueColor) {
-        if (!miSetVisualTypes( dfb->colorBitsPerPixel, TrueColorMask,
-                               bitsPerRGB, TrueColor )) {
-            return FALSE;
-        }
-    } else if (dfb->colorType == PseudoColor) {
-        if (!miSetVisualTypes( dfb->colorBitsPerPixel, PseudoColorMask,
-                               bitsPerRGB, PseudoColor )) {
-            return FALSE;
-        }
-    } else if (dfb->colorType == StaticColor) {
-        if (!miSetVisualTypes( dfb->colorBitsPerPixel, StaticColorMask,
-                               bitsPerRGB, StaticColor )) {
-            return FALSE;
-        }
-    } else {
+    if(!miSetVisualTypesAndMasks(dfb->depth, dfb->visuals, dfb->bitsPerRGB,
+                                 dfb->preferredCVC, dfb->redMask,
+                                 dfb->greenMask, dfb->blueMask)) {
         return FALSE;
     }
 
@@ -249,20 +227,28 @@ static Bool DarwinAddScreen(
         return FALSE;
     }
 
+//    ErrorF("Screen type: %d, %d=%d, %d=%d, %d=%d, %x=%x=%x, %x=%x=%x, %x=%x=%x\n", pScreen->visuals->class,
+//           pScreen->visuals->offsetRed, dfb->bitsPerRGB * 2,
+//           pScreen->visuals->offsetGreen, dfb->bitsPerRGB,
+//           pScreen->visuals->offsetBlue, 0,
+//           pScreen->visuals->redMask, dfb->redMask, ((1<<dfb->bitsPerRGB)-1) << pScreen->visuals->offsetRed,
+//           pScreen->visuals->greenMask, dfb->greenMask, ((1<<dfb->bitsPerRGB)-1) << pScreen->visuals->offsetGreen,
+//           pScreen->visuals->blueMask, dfb->blueMask, ((1<<dfb->bitsPerRGB)-1) << pScreen->visuals->offsetBlue);
+
     // set the RGB order correctly for TrueColor
-    if (dfb->bitsPerPixel > 8) {
-        for (i = 0, visual = pScreen->visuals;  // someday we may have more than 1
-            i < pScreen->numVisuals; i++, visual++) {
-            if (visual->class == TrueColor) {
-                visual->offsetRed = bitsPerRGB * 2;
-                visual->offsetGreen = bitsPerRGB;
-                visual->offsetBlue = 0;
-                visual->redMask = ((1<<bitsPerRGB)-1) << visual->offsetRed;
-                visual->greenMask = ((1<<bitsPerRGB)-1) << visual->offsetGreen;
-                visual->blueMask = ((1<<bitsPerRGB)-1) << visual->offsetBlue;
-            }
-        }
-    }
+//    if (dfb->bitsPerPixel > 8) {
+//        for (i = 0, visual = pScreen->visuals;  // someday we may have more than 1
+//            i < pScreen->numVisuals; i++, visual++) {
+//            if (visual->class == TrueColor) {
+//                visual->offsetRed = bitsPerRGB * 2;
+//                visual->offsetGreen = bitsPerRGB;
+//                visual->offsetBlue = 0;
+//                visual->redMask = ((1<<bitsPerRGB)-1) << visual->offsetRed;
+//                visual->greenMask = ((1<<bitsPerRGB)-1) << visual->offsetGreen;
+//                visual->blueMask = ((1<<bitsPerRGB)-1) << visual->offsetBlue;
+//            }
+//        }
+//    }
 
 #ifdef RENDER
     if (! fbPictureInit(pScreen, 0, 0)) {
@@ -292,17 +278,16 @@ static Bool DarwinAddScreen(
      * mode and we're using a fixed color map.  Essentially this translates
      * to Darwin/x86 in 8-bit mode.
      */
-    if( (dfb->colorBitsPerPixel == 8) &&
-                (dfb->colorType == StaticColor) )
-    {
-        pmap = miInstalledMaps[pScreen->myNum];
-        visual = pmap->pVisual;
-        for( i = 0; i < visual->ColormapEntries; i++ ) {
-            pmap->red[i].co.local.red   = darwinClut8[i].red;
-            pmap->red[i].co.local.green = darwinClut8[i].green;
-            pmap->red[i].co.local.blue  = darwinClut8[i].blue;
-        }
-    }
+//    if(dfb->depth == 8) {
+//        ColormapPtr map = RootlessGetColormap (pScreen);
+//        for( i = 0; i < map->pVisual->ColormapEntries; i++ ) {
+//            Entry *ent = map->red + i;
+//            ErrorF("Setting lo %d -> r: %04x g: %04x b: %04x\n", i, darwinClut8[i].red, darwinClut8[i].green, darwinClut8[i].blue);
+//            ent->co.local.red   = darwinClut8[i].red;
+//            ent->co.local.green = darwinClut8[i].green;
+//            ent->co.local.blue  = darwinClut8[i].blue;
+//        }
+//    }
 
     dixScreenOrigins[index].x = dfb->x;
     dixScreenOrigins[index].y = dfb->y;
@@ -793,24 +778,21 @@ int ddxProcessArgument( int argc, char *argv[], int i )
     }
 
     if ( !strcmp( argv[i], "-depth" ) ) {
-        int     bitDepth;
-
         if ( i == argc-1 ) {
             FatalError( "-depth must be followed by a number\n" );
         }
 #ifdef OLD_POWERBOOK_G3
         ErrorF( "Ignoring unsupported -depth option on old PowerBook G3\n");
 #else
-        bitDepth = atoi( argv[i+1] );
-        if (bitDepth == 8)
-            darwinDesiredDepth = 0;
-        else if (bitDepth == 15)
-            darwinDesiredDepth = 1;
-        else if (bitDepth == 24)
-            darwinDesiredDepth = 2;
-        else
+        darwinDesiredDepth = atoi( argv[i+1] );
+        if(darwinDesiredDepth != -1 &&
+           darwinDesiredDepth != 8 &&
+           darwinDesiredDepth != 15 &&
+           darwinDesiredDepth != 24) {
             FatalError( "Unsupported pixel depth. Use 8, 15, or 24 bits\n" );
-        ErrorF( "Attempting to use pixel depth of %i\n", bitDepth );
+        }
+
+        ErrorF( "Attempting to use pixel depth of %i\n", darwinDesiredDepth );
 #endif
         return 2;
     }
diff --git a/hw/xquartz/darwin.h b/hw/xquartz/darwin.h
index c569d66..1925424 100644
--- a/hw/xquartz/darwin.h
+++ b/hw/xquartz/darwin.h
@@ -40,10 +40,14 @@ typedef struct {
     int                 width;
     int                 height;
     int                 pitch;
-    int                 colorType;
+    int                 depth;
+    int                 visuals;
+    int                 bitsPerRGB;
     int                 bitsPerPixel;
-    int                 colorBitsPerPixel;
-    int                 bitsPerComponent;
+    int                 preferredCVC;
+    Pixel               redMask;
+    Pixel               greenMask;
+    Pixel               blueMask;
 } DarwinFramebufferRec, *DarwinFramebufferPtr;
 
 // From darwin.c
diff --git a/hw/xquartz/xpr/xprScreen.c b/hw/xquartz/xpr/xprScreen.c
index 068b7b1..29179e5 100644
--- a/hw/xquartz/xpr/xprScreen.c
+++ b/hw/xquartz/xpr/xprScreen.c
@@ -42,6 +42,7 @@
 #include "globals.h"
 #include "Xplugin.h"
 #include "applewmExt.h"
+#include "micmap.h"
 
 // From xprFrame.c
 WindowPtr xprGetXWindow(xp_window_id wid);
@@ -249,35 +250,59 @@ static Bool
 xprAddScreen(int index, ScreenPtr pScreen)
 {
     DarwinFramebufferPtr dfb = SCREEN_PRIV(pScreen);
-
-    /* If no specific depth chosen, look for the depth of the main display.
-       Else if 16bpp specified, use that. Else use 32bpp. */
-
-    dfb->colorType = TrueColor;
-    dfb->bitsPerComponent = 8;
-    dfb->bitsPerPixel = 32;
-    dfb->colorBitsPerPixel = 24;
-
-    if (darwinDesiredDepth == -1)
-    {
-        dfb->bitsPerComponent = CGDisplayBitsPerSample(kCGDirectMainDisplay);
-        dfb->bitsPerPixel = CGDisplayBitsPerPixel(kCGDirectMainDisplay);
-        dfb->colorBitsPerPixel =
-                CGDisplaySamplesPerPixel(kCGDirectMainDisplay) *
-                dfb->bitsPerComponent;
+    int depth = darwinDesiredDepth;
+    
+    if(depth == -1) {
+        depth = CGDisplaySamplesPerPixel(kCGDirectMainDisplay) * CGDisplayBitsPerSample(kCGDirectMainDisplay);
+        //dfb->depth = CGDisplaySamplesPerPixel(kCGDirectMainDisplay) * CGDisplayBitsPerSample(kCGDirectMainDisplay);
+        //dfb->bitsPerRGB = CGDisplayBitsPerSample(kCGDirectMainDisplay);
+        //dfb->bitsPerPixel = CGDisplayBitsPerPixel(kCGDirectMainDisplay);
     }
-    else if (darwinDesiredDepth == 15)
-    {
-        dfb->bitsPerComponent = 5;
-        dfb->bitsPerPixel = 16;
-        dfb->colorBitsPerPixel = 15;
-    }
-    else if (darwinDesiredDepth == 8)
-    {
-        dfb->colorType = PseudoColor;
-        dfb->bitsPerComponent = 8;
-        dfb->bitsPerPixel = 8;
-        dfb->colorBitsPerPixel = 8;
+    
+    switch(depth) {
+        case -8: // broken
+            FatalError("Unsupported color depth %d\n", darwinDesiredDepth);
+            dfb->visuals = (1 << StaticGray) | (1 << GrayScale);
+            dfb->preferredCVC = GrayScale;
+            dfb->depth = 8;
+            dfb->bitsPerRGB = 8;
+            dfb->bitsPerPixel = 8;
+            dfb->redMask = 0;
+            dfb->greenMask = 0;
+            dfb->blueMask = 0;
+            break;
+        case 8: // broken
+            dfb->visuals = PseudoColorMask;
+            dfb->preferredCVC = PseudoColor;
+            dfb->depth = 8;
+            dfb->bitsPerRGB = 8;
+            dfb->bitsPerPixel = 8;
+            dfb->redMask = 0;
+            dfb->greenMask = 0;
+            dfb->blueMask = 0;
+            break;
+        case 15:
+            dfb->visuals = LARGE_VISUALS;
+            dfb->preferredCVC = TrueColor;
+            dfb->depth = 15;
+            dfb->bitsPerRGB = 5;
+            dfb->bitsPerPixel = 16;
+            dfb->redMask   = 0x7c00;
+            dfb->greenMask = 0x03e0;
+            dfb->blueMask  = 0x001f;
+            break;
+        case 24:
+            dfb->visuals = LARGE_VISUALS;
+            dfb->preferredCVC = TrueColor;
+            dfb->depth = 24;
+            dfb->bitsPerRGB = 8;
+            dfb->bitsPerPixel = 32;
+            dfb->redMask   = 0x00ff0000;
+            dfb->greenMask = 0x0000ff00;
+            dfb->blueMask  = 0x000000ff;
+            break;
+        default:
+            FatalError("Unsupported color depth %d\n", darwinDesiredDepth);
     }
 
     if (noPseudoramiXExtension)
commit 17a9714a6789a389d52dbb40fd1eed1e24c04d64
Author: Eamon Walsh <ewalsh at tycho.nsa.gov>
Date:   Thu Jan 3 14:46:54 2008 -0500

    Bug #13794: Update MBE extension devPrivates to new interface.

diff --git a/Xext/mbuf.c b/Xext/mbuf.c
index 35c8c89..0b5b91e 100644
--- a/Xext/mbuf.c
+++ b/Xext/mbuf.c
@@ -61,8 +61,8 @@ in this Software without prior written authorization from The Open Group.
 
 static int		MultibufferEventBase;
 static int		MultibufferErrorBase;
-int			MultibufferScreenIndex = -1;
-int			MultibufferWindowIndex = -1;
+static DevPrivateKey MultibufferScreenPrivKey = &MultibufferScreenPrivKey;
+static DevPrivateKey MultibufferWindowPrivKey = &MultibufferWindowPrivKey;
 
 static void		PerformDisplayRequest (
 				MultibuffersPtr * /* ppMultibuffers */,
@@ -200,27 +200,16 @@ MultibufferExtensionInit()
     ScreenPtr		    pScreen;
     MultibufferScreenPtr    pMultibufferScreen;
 
-    /*
-     * allocate private pointers in windows and screens.  Allocating
-     * window privates may seem like an unnecessary expense, but every
-     * PositionWindow call must check to see if the window is
-     * multi-buffered; a resource lookup is too expensive.
-     */
-    MultibufferScreenIndex = AllocateScreenPrivateIndex ();
-    if (MultibufferScreenIndex < 0)
-	return;
-    MultibufferWindowIndex = AllocateWindowPrivateIndex ();
     for (i = 0; i < screenInfo.numScreens; i++)
     {
 	pScreen = screenInfo.screens[i];
-	if (!AllocateWindowPrivate (pScreen, MultibufferWindowIndex, 0) ||
-	    !(pMultibufferScreen = (MultibufferScreenPtr) xalloc (sizeof (MultibufferScreenRec))))
+	if (!(pMultibufferScreen = (MultibufferScreenPtr) xalloc (sizeof (MultibufferScreenRec))))
 	{
 	    for (j = 0; j < i; j++)
-		xfree (screenInfo.screens[j]->devPrivates[MultibufferScreenIndex].ptr);
+		xfree (dixLookupPrivate(&screenInfo.screens[j]->devPrivates, MultibufferScreenPrivKey));
 	    return;
 	}
-	pScreen->devPrivates[MultibufferScreenIndex].ptr = (pointer) pMultibufferScreen;
+	dixSetPrivate(&pScreen->devPrivates, MultibufferScreenPrivKey, pMultibufferScreen);
 	/*
  	 * wrap PositionWindow to resize the pixmap when the window
 	 * changes size
@@ -260,14 +249,11 @@ ExtensionEntry	*extEntry;
     ScreenPtr		    pScreen;
     MultibufferScreenPtr    pMultibufferScreen;
     
-    if (MultibufferScreenIndex < 0)
-	return;
     for (i = 0; i < screenInfo.numScreens; i++)
     {
 	pScreen = screenInfo.screens[i];
-	if (pScreen->devPrivates[MultibufferScreenIndex].ptr)
+	if ((pMultibufferScreen = (MultibufferScreenPtr)dixLookupPrivate(&pScreen->devPrivates, MultibufferScreenPrivKey)))
 	{
-	    pMultibufferScreen = (MultibufferScreenPtr) pScreen->devPrivates[MultibufferScreenIndex].ptr;
 	    pScreen->PositionWindow = pMultibufferScreen->PositionWindow;
 	    xfree (pMultibufferScreen);
 	}
@@ -427,7 +413,7 @@ CreateImageBuffers (pWin, nbuf, ids, action, hint)
     pMultibuffers->lastUpdate.milliseconds = 0;
     pMultibuffers->width = width;
     pMultibuffers->height = height;
-    pWin->devPrivates[MultibufferWindowIndex].ptr = (pointer) pMultibuffers;
+    dixSetPrivate(&pWin->devPrivates, MultibufferWindowPrivKey, pMultibuffers);
     if (pClearGC) FreeScratchGC(pClearGC);
     return Success;
 }
@@ -487,7 +473,7 @@ ProcCreateImageBuffers (client)
     rep.type = X_Reply;
     rep.length = 0;
     rep.sequenceNumber = client->sequence;
-    rep.numberBuffer = ((MultibuffersPtr) (pWin->devPrivates[MultibufferWindowIndex].ptr))->numMultibuffer;
+    rep.numberBuffer = ((MultibuffersPtr) (dixLookupPrivate(&pWin->devPrivates, MultibufferWindowPrivKey)))->numMultibuffer;
     if (client->swapped)
     {
     	swaps(&rep.sequenceNumber, n);
@@ -1236,7 +1222,7 @@ GetBufferPointer (pWin, i)
 {
     MultibuffersPtr pMultibuffers;
 
-    if (!(pMultibuffers = (MultibuffersPtr) pWin->devPrivates[MultibufferWindowIndex].ptr))
+    if (!(pMultibuffers = (MultibuffersPtr) dixLookupPrivate(&pWin->devPrivates, MultibufferWindowPrivKey)))
 	return NULL;
     return (DrawablePtr) pMultibuffers->buffers[i].pPixmap;
 }
@@ -1475,7 +1461,7 @@ DestroyImageBuffers (pWin)
 {
     FreeResourceByType (pWin->drawable.id, MultibuffersResType, FALSE);
     /* Zero out the window's pointer to the buffers so they won't be reused */
-    pWin->devPrivates[MultibufferWindowIndex].ptr = NULL;
+    dixSetPrivate(&pWin->devPrivates, MultibufferWindowPrivKey, NULL);
 }
 
 /*
@@ -1503,11 +1489,11 @@ MultibufferPositionWindow (pWin, x, y)
     Bool	    clear;
 
     pScreen = pWin->drawable.pScreen;
-    pMultibufferScreen = (MultibufferScreenPtr) pScreen->devPrivates[MultibufferScreenIndex].ptr;
+    pMultibufferScreen = (MultibufferScreenPtr) dixLookupPrivate(&pScreen->devPrivates, MultibufferScreenPrivKey);
     (*pMultibufferScreen->PositionWindow) (pWin, x, y);
 
     /* if this window is not multibuffered, we're done */
-    if (!(pMultibuffers = (MultibuffersPtr) pWin->devPrivates[MultibufferWindowIndex].ptr))
+    if (!(pMultibuffers = (MultibuffersPtr) dixLookupPrivate(&pWin->devPrivates, MultibufferWindowPrivKey)))
 	return TRUE;
 
     /* if new size is same as old, we're done */
@@ -1620,7 +1606,7 @@ MultibufferDrawableDelete (value, id)
     if (pDrawable->type == DRAWABLE_WINDOW)
     {
 	pWin = (WindowPtr) pDrawable;
-	pMultibuffers = (MultibuffersPtr) pWin->devPrivates[MultibufferWindowIndex].ptr;
+	pMultibuffers = (MultibuffersPtr) dixLookupPrivate(&pWin->devPrivates, MultibufferWindowPrivKey);
 	pPixmap = pMultibuffers->buffers[pMultibuffers->displayedMultibuffer].pPixmap;
     }
     else
commit ccf6636d2ca8acdaaeb8da34db507a10a082b0de
Author: Alan Coopersmith <alan.coopersmith at sun.com>
Date:   Wed Jan 2 19:28:33 2008 -0800

    Kill xf86getpagesize even harder (dummylib & ioport)

diff --git a/hw/xfree86/dummylib/Makefile.am b/hw/xfree86/dummylib/Makefile.am
index 2ab0a77..ad3f1ea 100644
--- a/hw/xfree86/dummylib/Makefile.am
+++ b/hw/xfree86/dummylib/Makefile.am
@@ -25,7 +25,6 @@ libdummy_nonserver_a_SOURCES = \
 	xf86drvmsgverb.c \
 	xf86errorf.c \
 	xf86errorfverb.c \
-	xf86getpagesize.c \
 	xf86getverb.c \
 	xf86info.c \
 	xf86msg.c \
diff --git a/hw/xfree86/dummylib/xf86getpagesize.c b/hw/xfree86/dummylib/xf86getpagesize.c
deleted file mode 100644
index 8859c76..0000000
--- a/hw/xfree86/dummylib/xf86getpagesize.c
+++ /dev/null
@@ -1,21 +0,0 @@
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include <X11/X.h>
-#include "os.h"
-#include "xf86.h"
-#include "xf86Priv.h"
-
-/*
- * Utility functions required by libxf86_os. 
- */
-
-int xf86getpagesize(void);
-
-_X_EXPORT int
-xf86getpagesize(void)
-{
-    return 4096;	/* not used */
-}
-
diff --git a/hw/xfree86/utils/ioport/ioport.c b/hw/xfree86/utils/ioport/ioport.c
index 3221364..7370434 100644
--- a/hw/xfree86/utils/ioport/ioport.c
+++ b/hw/xfree86/utils/ioport/ioport.c
@@ -489,4 +489,3 @@ main(argc, argv)
 	return (0);
 }
 
-#include "xf86getpagesize.c"
commit dfd682b582636a36345144bcf835e3ee46718d90
Author: Alan Coopersmith <alan.coopersmith at sun.com>
Date:   Wed Jan 2 19:27:22 2008 -0800

    X.Org bug 4947/Sun bug 6646626: Xv extension not byte-swapping properly
    
    X.Org Bugzilla #4947 <https://bugs.freedesktop.org/show_bug.cgi?id=4947>
    Sun bug 6646626 <http://bugs.opensolaris.org/bugdatabase/view_bug.do?bug_id=6646626>
    
    Don't use swapped data after swapping it.   When done swapping data,
    send the swapped data, not the address of the pointer to it, to the client.

diff --git a/Xext/xvdisp.c b/Xext/xvdisp.c
index 8096c8c..17ff1d7 100644
--- a/Xext/xvdisp.c
+++ b/Xext/xvdisp.c
@@ -67,7 +67,7 @@ SWriteQueryExtensionReply(
   swaps(&rep->version, n);
   swaps(&rep->revision, n);
   
-  (void)WriteToClient(client, sz_xvQueryExtensionReply, (char *)&rep);
+  (void)WriteToClient(client, sz_xvQueryExtensionReply, (char *)rep);
 
   return Success;
 }
@@ -83,7 +83,7 @@ SWriteQueryAdaptorsReply(
   swapl(&rep->length, n);
   swaps(&rep->num_adaptors, n);
   
-  (void)WriteToClient(client, sz_xvQueryAdaptorsReply, (char *)&rep);
+  (void)WriteToClient(client, sz_xvQueryAdaptorsReply, (char *)rep);
 
   return Success;
 }
@@ -99,7 +99,7 @@ SWriteQueryEncodingsReply(
   swapl(&rep->length, n);
   swaps(&rep->num_encodings, n);
   
-  (void)WriteToClient(client, sz_xvQueryEncodingsReply, (char *)&rep);
+  (void)WriteToClient(client, sz_xvQueryEncodingsReply, (char *)rep);
 
   return Success;
 }
@@ -204,7 +204,7 @@ SWriteGrabPortReply(
   swaps(&rep->sequenceNumber, n);
   swapl(&rep->length, n);
 
-  (void)WriteToClient(client, sz_xvGrabPortReply, (char *)&rep);
+  (void)WriteToClient(client, sz_xvGrabPortReply, (char *)rep);
 
   return Success;
 }
@@ -220,7 +220,7 @@ SWriteGetPortAttributeReply(
   swapl(&rep->length, n);
   swapl(&rep->value, n);
 
-  (void)WriteToClient(client, sz_xvGetPortAttributeReply, (char *)&rep);
+  (void)WriteToClient(client, sz_xvGetPortAttributeReply, (char *)rep);
 
   return Success;
 }
@@ -237,7 +237,7 @@ SWriteQueryBestSizeReply(
   swaps(&rep->actual_width, n);
   swaps(&rep->actual_height, n);
 
-  (void)WriteToClient(client, sz_xvQueryBestSizeReply, (char *)&rep);
+  (void)WriteToClient(client, sz_xvQueryBestSizeReply, (char *)rep);
 
   return Success;
 }
@@ -254,7 +254,7 @@ SWriteQueryPortAttributesReply(
   swapl(&rep->num_attributes, n);
   swapl(&rep->text_size, n);
 
-  (void)WriteToClient(client, sz_xvQueryPortAttributesReply, (char *)&rep);
+  (void)WriteToClient(client, sz_xvQueryPortAttributesReply, (char *)rep);
 
   return Success;
 }
@@ -273,7 +273,7 @@ SWriteQueryImageAttributesReply(
   swaps(&rep->width, n);
   swaps(&rep->height, n);
 
-  (void)WriteToClient(client, sz_xvQueryImageAttributesReply, (char *)&rep);
+  (void)WriteToClient(client, sz_xvQueryImageAttributesReply, (char *)rep);
 
   return Success;
 }
@@ -289,7 +289,7 @@ SWriteListImageFormatsReply(
   swapl(&rep->length, n);
   swapl(&rep->num_formats, n);
 
-  (void)WriteToClient(client, sz_xvListImageFormatsReply, (char *)&rep);
+  (void)WriteToClient(client, sz_xvListImageFormatsReply, (char *)rep);
 
   return Success;
 }
@@ -378,6 +378,7 @@ ProcXvQueryAdaptors(ClientPtr client)
   xvAdaptorInfo ainfo;
   xvQueryAdaptorsReply rep;
   int totalSize, na, nf, rc;
+  int nameSize;
   XvAdaptorPtr pa;
   XvFormatPtr pf;
   WindowPtr pWin;
@@ -439,12 +440,12 @@ ProcXvQueryAdaptors(ClientPtr client)
       ainfo.base_id = pa->base_id;
       ainfo.num_ports = pa->nPorts;
       ainfo.type = pa->type;
-      ainfo.name_size = strlen(pa->name);
+      ainfo.name_size = nameSize = strlen(pa->name);
       ainfo.num_formats = pa->nFormats;
 
       _WriteAdaptorInfo(client, &ainfo);
 
-      WriteToClient(client, ainfo.name_size, pa->name);
+      WriteToClient(client, nameSize, pa->name);
 
       nf = pa->nFormats;
       pf = pa->pFormats;
@@ -469,6 +470,7 @@ ProcXvQueryEncodings(ClientPtr client)
   xvEncodingInfo einfo;
   xvQueryEncodingsReply rep;
   int totalSize;
+  int nameSize;
   XvPortPtr pPort;
   int ne;
   XvEncodingPtr pe;
@@ -513,13 +515,13 @@ ProcXvQueryEncodings(ClientPtr client)
   while (ne--) 
     {
       einfo.encoding = pe->id;
-      einfo.name_size = strlen(pe->name);
+      einfo.name_size = nameSize = strlen(pe->name);
       einfo.width = pe->width;
       einfo.height = pe->height;
       einfo.rate.numerator = pe->rate.numerator;
       einfo.rate.denominator = pe->rate.denominator;
       _WriteEncodingInfo(client, &einfo);
-      WriteToClient(client, einfo.name_size, pe->name);
+      WriteToClient(client, nameSize, pe->name);
       pe++;
     }
 
@@ -984,18 +986,19 @@ ProcXvQueryPortAttributes(ClientPtr client)
   rep.text_size = 0;
 
   for(i = 0, pAtt = pPort->pAdaptor->pAttributes; 
-      i < rep.num_attributes; i++, pAtt++) 
+      i < pPort->pAdaptor->nAttributes; i++, pAtt++) 
   {    
       rep.text_size += (strlen(pAtt->name) + 1 + 3) & ~3L;
   }
 
-  rep.length = (rep.num_attributes * sz_xvAttributeInfo) + rep.text_size;
+  rep.length = (pPort->pAdaptor->nAttributes * sz_xvAttributeInfo)
+      + rep.text_size;
   rep.length >>= 2;
 
   _WriteQueryPortAttributesReply(client, &rep);
 
   for(i = 0, pAtt = pPort->pAdaptor->pAttributes; 
-      i < rep.num_attributes; i++, pAtt++) 
+      i < pPort->pAdaptor->nAttributes; i++, pAtt++) 
   {
       size = strlen(pAtt->name) + 1;  /* pass the NULL */
       Info.flags = pAtt->flags;
@@ -1211,6 +1214,7 @@ ProcXvQueryImageAttributes(ClientPtr client)
   XvPortPtr pPort;
   int *offsets;
   int *pitches;
+  int planeLength;
   REQUEST(xvQueryImageAttributesReq);
 
   REQUEST_SIZE_MATCH(xvQueryImageAttributesReq);
@@ -1250,7 +1254,7 @@ ProcXvQueryImageAttributes(ClientPtr client)
 
   rep.type = X_Reply;
   rep.sequenceNumber = client->sequence;
-  rep.length = num_planes << 1;
+  rep.length = planeLength = num_planes << 1;
   rep.num_planes = num_planes;
   rep.width = width;
   rep.height = height;
@@ -1258,8 +1262,8 @@ ProcXvQueryImageAttributes(ClientPtr client)
  
   _WriteQueryImageAttributesReply(client, &rep);
   if(client->swapped)
-    SwapLongs((CARD32*)offsets, rep.length);
-  WriteToClient(client, rep.length << 2, (char*)offsets);
+    SwapLongs((CARD32*)offsets, planeLength);
+  WriteToClient(client, planeLength << 2, (char*)offsets);
 
   xfree(offsets);
 
@@ -1287,13 +1291,13 @@ ProcXvListImageFormats(ClientPtr client)
   rep.type = X_Reply;
   rep.sequenceNumber = client->sequence;
   rep.num_formats = pPort->pAdaptor->nImages;
-  rep.length = rep.num_formats * sz_xvImageFormatInfo >> 2;
+  rep.length = pPort->pAdaptor->nImages * sz_xvImageFormatInfo >> 2;
 
   _WriteListImageFormatsReply(client, &rep);
 
   pImage = pPort->pAdaptor->pImages;
   
-  for(i = 0; i < rep.num_formats; i++, pImage++) {
+  for(i = 0; i < pPort->pAdaptor->nImages; i++, pImage++) {
      info.id = pImage->id; 	
      info.type = pImage->type; 	
      info.byte_order = pImage->byte_order; 
commit f6666dcc3b1ac60f850ea53c357a9ef61672a52a
Author: Alan Coopersmith <alan.coopersmith at sun.com>
Date:   Wed Jan 2 19:19:55 2008 -0800

    Add dixAllocatePrivate stub to dummylib for utils
    
    Normally not necessary, except when building non-optimized/debug causes
    the inline functions from private.h to appear in os-support/libxorgos.la

diff --git a/hw/xfree86/dummylib/Makefile.am b/hw/xfree86/dummylib/Makefile.am
index 3e70d25..2ab0a77 100644
--- a/hw/xfree86/dummylib/Makefile.am
+++ b/hw/xfree86/dummylib/Makefile.am
@@ -13,6 +13,7 @@ STRL_SRCS = $(top_srcdir)/os/strlcat.c $(top_srcdir)/os/strlcpy.c
 endif
 
 libdummy_nonserver_a_SOURCES = \
+	dixprivates.c \
 	fatalerror.c \
 	logvwrite.c \
 	$(STRL_SRCS) \
diff --git a/hw/xfree86/dummylib/dixprivates.c b/hw/xfree86/dummylib/dixprivates.c
new file mode 100644
index 0000000..40c173a
--- /dev/null
+++ b/hw/xfree86/dummylib/dixprivates.c
@@ -0,0 +1,19 @@
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include <X11/X.h>
+#include "os.h"
+#include "xf86.h"
+#include "xf86Priv.h"
+
+/*
+ * Utility functions required by libxf86_os. 
+ */
+
+_X_EXPORT pointer *
+dixAllocatePrivate(PrivateRec **privates, const DevPrivateKey key)
+{
+    return NULL;	/* not used */
+}
+
commit 73f422996016107d5f53492e4197bb05ed9c4bb9
Author: Alan Coopersmith <alan.coopersmith at sun.com>
Date:   Wed Jan 2 19:17:54 2008 -0800

    Fix names/types of new vuidMouse{Get,Set}ScreenPrivates macros

diff --git a/hw/xfree86/os-support/solaris/sun_mouse.c b/hw/xfree86/os-support/solaris/sun_mouse.c
index b1b7797..a5955ef 100644
--- a/hw/xfree86/os-support/solaris/sun_mouse.c
+++ b/hw/xfree86/os-support/solaris/sun_mouse.c
@@ -122,10 +122,10 @@ static void vuidMouseAdjustFrame(int index, int x, int y, int flags);
 
 static int vuidMouseGeneration = 0;
 static DevPrivateKey vuidMouseScreenKey = &vuidMouseScreenKey;
-#define vuidGetMouseScreenPrivate(s) ((VuidMsePtr) \
+#define vuidMouseGetScreenPrivate(s) ( \
     dixLookupPrivate(&(s)->devPrivates, vuidMouseScreenKey))
-#define vuidSetMouseScreenPrivate(s,p) \
-    dixSetPrivate(&(s)->devPrivates, vuidMouseScreenKey, p)
+#define vuidMouseSetScreenPrivate(s,p) \
+    dixSetPrivate(&(s)->devPrivates, vuidMouseScreenKey, (void *) p)
 #endif /* HAVE_ABSOLUTE_MOUSE_SCALING */
 
 static inline
commit 895073f6b41d9313cfe748232c492c5e9f76b443
Author: Alan Coopersmith <alan.coopersmith at sun.com>
Date:   Wed Jan 2 18:09:26 2008 -0800

    Restore include & typedef needed by dtrace
    
    996b621bec1bbc4fb21970c75eaec62053bc6ccb deleted a couple lines too many

diff --git a/dix/dispatch.c b/dix/dispatch.c
index 577e17c..004509c 100644
--- a/dix/dispatch.c
+++ b/dix/dispatch.c
@@ -149,6 +149,8 @@ int ProcInitialConnection();
 
 #ifdef XSERVER_DTRACE
 #include "registry.h"
+#include <sys/types.h>
+typedef const char *string;
 #include "Xserver-dtrace.h"
 #endif
 
commit 306fde4082044dfecbedd9af41e660bafb3ce438
Author: Brian <brian at i915.localnet.net>
Date:   Tue Jan 1 09:27:44 2008 -0700

    regenerated to add framebuffer object tokens (bug 13800)

diff --git a/GL/glx/indirect_size_get.c b/GL/glx/indirect_size_get.c
index 1a1b123..e7eaf97 100644
--- a/GL/glx/indirect_size_get.c
+++ b/GL/glx/indirect_size_get.c
@@ -613,6 +613,7 @@ __glGetBooleanv_size(GLenum e)
 /*      case GL_CLIENT_ACTIVE_TEXTURE_ARB:*/
     case GL_MAX_TEXTURE_UNITS:
 /*      case GL_MAX_TEXTURE_UNITS_ARB:*/
+    case GL_MAX_RENDERBUFFER_SIZE_EXT:
     case GL_TEXTURE_COMPRESSION_HINT:
 /*      case GL_TEXTURE_COMPRESSION_HINT_ARB:*/
     case GL_TEXTURE_RECTANGLE_ARB:
@@ -715,6 +716,10 @@ __glGetBooleanv_size(GLenum e)
     case GL_ACTIVE_STENCIL_FACE_EXT:
     case GL_TEXTURE_BINDING_1D_ARRAY_EXT:
     case GL_TEXTURE_BINDING_2D_ARRAY_EXT:
+    case GL_DRAW_FRAMEBUFFER_BINDING_EXT:
+    case GL_RENDERBUFFER_BINDING_EXT:
+    case GL_READ_FRAMEBUFFER_BINDING_EXT:
+    case GL_MAX_COLOR_ATTACHMENTS_EXT:
     case GL_RASTER_POSITION_UNCLIPPED_IBM:
         return 1;
     case GL_SMOOTH_POINT_SIZE_RANGE:
commit 5c362c2eb2cfdf1f6d667a3e64a0a7bc4942c950
Author: Brian <brian at i915.localnet.net>
Date:   Tue Jan 1 09:07:48 2008 -0700

    regenerated, adds GL_MAX_3D_TEXTURE_SIZE (see bug 13811)

diff --git a/GL/glx/indirect_size_get.c b/GL/glx/indirect_size_get.c
index f64fb7e..1a1b123 100644
--- a/GL/glx/indirect_size_get.c
+++ b/GL/glx/indirect_size_get.c
@@ -538,6 +538,7 @@ __glGetBooleanv_size(GLenum e)
     case GL_UNPACK_SKIP_IMAGES:
     case GL_UNPACK_IMAGE_HEIGHT:
     case GL_TEXTURE_3D:
+    case GL_MAX_3D_TEXTURE_SIZE:
     case GL_VERTEX_ARRAY:
     case GL_NORMAL_ARRAY:
     case GL_COLOR_ARRAY:
commit 85365ddf16e2b954d8249b380df53337420ed684
Author: Adam Jackson <ajax at redhat.com>
Date:   Fri Dec 28 17:35:54 2007 -0500

    EDID 1.4: If given a native pixel format, use it when inferring virtual.

diff --git a/hw/xfree86/common/xf86Mode.c b/hw/xfree86/common/xf86Mode.c
index 782f08b..fb899a1 100644
--- a/hw/xfree86/common/xf86Mode.c
+++ b/hw/xfree86/common/xf86Mode.c
@@ -1215,20 +1215,40 @@ inferVirtualSize(ScrnInfoPtr scrp, DisplayModePtr modes, int *vx, int *vy)
 {
     float aspect = 0.0;
     MonPtr mon = scrp->monitor;
+    xf86MonPtr DDC;
     int x = 0, y = 0;
     DisplayModePtr mode;
 
     if (!mon) return 0;
+    DDC = mon->DDC;
+
+    if (DDC && DDC->ver.revision >= 4) {
+	/* For 1.4, we might actually get native pixel format.  How novel. */
+	if (PREFERRED_TIMING_MODE(DDC->features.msc)) {
+		for (mode = modes; mode; mode = mode->next) {
+		    if (mode->type & (M_T_DRIVER | M_T_PREFERRED)) {
+			x = mode->HDisplay;
+			y = mode->VDisplay;
+			goto found;
+		    }
+		}
+	}
+	/*
+	 * Even if we don't, we might get aspect ratio from extra CVT info
+	 * or from the monitor size fields.  TODO.
+	 */
+    }
 
     /*
-     * technically this triggers if _either_ is zero, which is not what EDID
-     * says, but if only one is zero this is best effort.  also we don't
-     * know that all projectors are 4:3, but we certainly suspect it.
+     * Technically this triggers if either is zero.  That wasn't legal
+     * before EDID 1.4, but right now we'll get that wrong. TODO.
      */
-    if (!mon->widthmm || !mon->heightmm)
-	aspect = 4.0/3.0;
-    else
-	aspect = (float)mon->widthmm / (float)mon->heightmm;
+    if (!aspect) {
+	if (!mon->widthmm || !mon->heightmm)
+	    aspect = 4.0/3.0;
+	else
+	    aspect = (float)mon->widthmm / (float)mon->heightmm;
+    }
 
     /* find the largest M_T_DRIVER mode with that aspect ratio */
     for (mode = modes; mode; mode = mode->next) {
@@ -1252,6 +1272,7 @@ inferVirtualSize(ScrnInfoPtr scrp, DisplayModePtr modes, int *vx, int *vy)
 	return 0;
     }
 
+found:
     *vx = x;
     *vy = y;
 
commit 312b30cb03e439644ea10e08fa93268116333f0d
Author: Adam Jackson <ajax at redhat.com>
Date:   Fri Dec 28 17:18:30 2007 -0500

    EDID 1.4: First detailed mode is always preferred.
    
    ... so act like it in the modelist generator, not just the parser.

diff --git a/hw/xfree86/modes/xf86EdidModes.c b/hw/xfree86/modes/xf86EdidModes.c
index d8c6161..87a8127 100644
--- a/hw/xfree86/modes/xf86EdidModes.c
+++ b/hw/xfree86/modes/xf86EdidModes.c
@@ -534,6 +534,8 @@ xf86DDCGetModes(int scrnIndex, xf86MonPtr DDC)
     quirks = xf86DDCDetectQuirks(scrnIndex, DDC, TRUE);
 
     preferred = PREFERRED_TIMING_MODE(DDC->features.msc);
+    if (DDC->ver.revision >= 4)
+	preferred = TRUE;
     if (quirks & DDC_QUIRK_FIRST_DETAILED_PREFERRED)
 	preferred = TRUE;
     if (quirks & (DDC_QUIRK_PREFER_LARGE_60 | DDC_QUIRK_PREFER_LARGE_75))
commit 9dbb73033ae60e7ab85f1469a696e2a52f0cb0fe
Author: Colin Harrison <colin.harrison at virgin.net>
Date:   Sat Dec 29 00:02:16 2007 +0200

    Rootless: Fix lvalue error from devPrivates change
    
    Instead of trying to use an invalid expression as an lvalue, use the function
    call instead.

diff --git a/miext/rootless/accel/rlAccel.c b/miext/rootless/accel/rlAccel.c
index a144124..f3cb215 100644
--- a/miext/rootless/accel/rlAccel.c
+++ b/miext/rootless/accel/rlAccel.c
@@ -51,6 +51,9 @@ static DevPrivateKey rlAccelScreenPrivateKey = &rlAccelScreenPrivateKey;
 #define RLACCELREC(pScreen) ((rlAccelScreenRec *) \
     dixLookupPrivate(&(pScreen)->devPrivates, rlAccelScreenPrivateKey))
 
+#define SETRLACCELREC(pScreen, v) \
+    dixSetPrivate(&(pScreen)->devPrivates, rlAccelScreenPrivateKey, v)
+
 /* This is mostly identical to fbGCOps. */
 static GCOps rlAccelOps = {
     rlFillSpans,
@@ -132,7 +135,7 @@ RootlessAccelInit(ScreenPtr pScreen)
 
     s = xalloc(sizeof(rlAccelScreenRec));
     if (!s) return FALSE;
-    RLACCELREC(pScreen) = s;
+    SETRLACCELREC(pScreen, s);
 
     // Wrap the screen functions we need
     s->CreateGC = pScreen->CreateGC;
commit 36ff05771b0699aa80ad718e24097bc25cb4fb00
Author: Jurij Smakov <jurij at wooyd.org>
Date:   Fri Dec 28 23:59:53 2007 +0200

    GL: Add GLX compile flags lost in modular X server changes
    
    RISC chips that trap on unaligned loads and stores need to
    define __GLX_ALIGN64.  This used to get added to the cflags
    in the old *.cf files but it no longer does in the modular
    X server.
    
    Also, Alpha needs to pass -mieee to the compiler as well.
    
    This is a simple backport of a patch that debian, and probably other
    distributions, have been applying forever.  To the best of my
    knowledge the patch was written by Jurij Smakov.  See Debian bug
    number #388125.
    
    I just checked and this has been rotting for more than a year in
    freedesktop bugzilla as #8392.
    
    Signed-off-by: David S. Miller <davem at davemloft.net>

diff --git a/GL/glx/Makefile.am b/GL/glx/Makefile.am
index 8eda153..4cf56e8 100644
--- a/GL/glx/Makefile.am
+++ b/GL/glx/Makefile.am
@@ -14,7 +14,8 @@ AM_CFLAGS = \
 	-I at MESA_SOURCE@/src/mesa/glapi \
 	-I at MESA_SOURCE@/src/mesa/main \
 	-DXFree86Server \
-	@GLX_DEFINES@
+	@GLX_DEFINES@ \
+	@GLX_ARCH_DEFINES@
 
 # none yet
 #sdk_HEADERS =
diff --git a/configure.ac b/configure.ac
index 0b718c9..0742040 100644
--- a/configure.ac
+++ b/configure.ac
@@ -304,6 +304,7 @@ case $host_cpu in
 	        *freebsd*)	SYS_LIBS=-lio ;;
 		*netbsd*)	AC_DEFINE(USE_ALPHA_PIO, 1, [NetBSD PIO alpha IO]) ;;
 	esac
+	GLX_ARCH_DEFINES="-D__GLX_ALIGN64 -mieee"
 	;;
   arm*)
 	ARM_VIDEO=yes
@@ -333,6 +334,7 @@ case $host_cpu in
 	xorg_loader_sparcmuldiv="yes"
 	SPARC64_VIDEO=yes
 	BSD_ARCH_SOURCES="sparc64_video.c ioperm_noop.c"
+	GLX_ARCH_DEFINES="-D__GLX_ALIGN64"
 	;;
   x86_64*|amd64*)
   	use_x86_asm="yes"
@@ -347,8 +349,16 @@ case $host_cpu in
 				SYS_LIBS=-lamd64
 				;;
 	esac
+	GLX_ARCH_DEFINES="-D__GLX_ALIGN64"
+	;;
+  ia64*)
+  	GLX_ARCH_DEFINES="-D__GLX_ALIGN64"
+	;;
+  s390*)
+  	GLX_ARCH_DEFINES="-D__GLX_ALIGN64"
 	;;
 esac
+AC_SUBST(GLX_ARCH_DEFINES)
 
 dnl BSD *_video.c selection
 AM_CONDITIONAL(ALPHA_VIDEO, [test "x$ALPHA_VIDEO" = xyes])
diff --git a/hw/dmx/glxProxy/Makefile.am b/hw/dmx/glxProxy/Makefile.am
index 1fbc8d7..f995498 100644
--- a/hw/dmx/glxProxy/Makefile.am
+++ b/hw/dmx/glxProxy/Makefile.am
@@ -32,6 +32,7 @@ libglxproxy_a_SOURCES = compsize.c \
                         unpack.h
 
 AM_CFLAGS = \
+            @GLX_ARCH_DEFINES@ \
             $(DIX_CFLAGS) \
             -I$(top_srcdir)/hw/dmx \
             -I$(top_srcdir)/include \
commit bae459cfc4f17a5ec5f2810e9f913e3ad2d8b8d4
Author: Adam Jackson <ajax at redhat.com>
Date:   Fri Dec 28 16:50:18 2007 -0500

    Don't carp on EDID 1.4 blocks anymore.
    
    Also whine more loudly when we get something other than 1.x.

diff --git a/hw/xfree86/ddc/interpret_edid.c b/hw/xfree86/ddc/interpret_edid.c
index 045c12d..14b0fd7 100644
--- a/hw/xfree86/ddc/interpret_edid.c
+++ b/hw/xfree86/ddc/interpret_edid.c
@@ -369,13 +369,16 @@ get_detailed_timing_section(Uchar *c, struct detailed_timings *r)
   r->misc = MISC;
 }
 
-#define MAX_EDID_MINOR 3
+#define MAX_EDID_MINOR 4
 
 static Bool
 validate_version(int scrnIndex, struct edid_version *r)
 {
-    if (r->version != 1)
+    if (r->version != 1) {
+	xf86DrvMsg(scrnIndex, X_ERROR, "Unknown EDID version %d\n",
+		   r->version);
 	return FALSE;
+    }
 
     if (r->revision > MAX_EDID_MINOR)
 	xf86DrvMsg(scrnIndex, X_WARNING,
commit 70b2d6cfeb3bcb7b862a2ae29f6ef7cb84d69486
Author: Adam Jackson <ajax at redhat.com>
Date:   Fri Dec 28 16:39:00 2007 -0500

    Check the gamma value, not its address.

diff --git a/hw/xfree86/ddc/print_edid.c b/hw/xfree86/ddc/print_edid.c
index a55c465..d9f18fa 100644
--- a/hw/xfree86/ddc/print_edid.c
+++ b/hw/xfree86/ddc/print_edid.c
@@ -211,7 +211,7 @@ print_display(int scrnIndex, struct disp_features *disp,
 	xf86DrvMsg(scrnIndex, X_INFO, "Indeterminate output size\n");
     }
 
-    if (!gamma && v->revision >= 1.4)
+    if (!disp->gamma && v->revision >= 1.4)
 	xf86DrvMsg(scrnIndex, X_INFO, "Gamma defined in extension block\n");
     else
 	xf86DrvMsg(scrnIndex, X_INFO, "Gamma: %.2f\n", disp->gamma);
commit 592d814ee09e86e283116a7a1052762c8398e8e5
Author: Adam Jackson <ajax at redhat.com>
Date:   Fri Dec 28 16:37:23 2007 -0500

    EDID 1.4: Additional semantics for display feature bits.
    
    First mode is _always_ preferred in 1.4; the bit that used to mean this
    now means that the preferred mode is also the native pixel format.  The
    old "is GTF" bit now means "is continuous-frequency" instead.
    
    Section 3.6.4, Table 3.14: Feature Support, Notes 4 and 5.

diff --git a/hw/xfree86/ddc/print_edid.c b/hw/xfree86/ddc/print_edid.c
index 30cd175..a55c465 100644
--- a/hw/xfree86/ddc/print_edid.c
+++ b/hw/xfree86/ddc/print_edid.c
@@ -154,16 +154,27 @@ print_dpms_features(int scrnIndex, struct disp_features *c,
     if (STD_COLOR_SPACE(c->msc))
 	xf86DrvMsg(scrnIndex,X_INFO,
 		   "Default color space is primary color space\n"); 
-    if (PREFERRED_TIMING_MODE(c->msc))
-	xf86DrvMsg(scrnIndex,X_INFO,
+
+    if (PREFERRED_TIMING_MODE(c->msc) || v->revision >= 4) {
+	xf86DrvMsg(scrnIndex, X_INFO,
 		   "First detailed timing is preferred mode\n"); 
-    else if (v->version == 1 && v->revision >= 3)
+	if (v->revision >= 4)
+	    xf86DrvMsg(scrnIndex, X_INFO,
+		"Preferred mode is native pixel format and refresh rate\n");
+    } else if (v->revision == 3) {
 	xf86DrvMsg(scrnIndex,X_INFO,
 		   "First detailed timing not preferred "
 		   "mode in violation of standard!");
-    if (GFT_SUPPORTED(c->msc))
-	xf86DrvMsg(scrnIndex,X_INFO,
-		   "GTF timings supported\n"); 
+    }
+
+    if (v->revision >= 4) {
+	if (GFT_SUPPORTED(c->msc)) {
+	    xf86DrvMsg(scrnIndex, X_INFO, "Display is continuous-frequency\n");
+	}
+    } else {
+	if (GFT_SUPPORTED(c->msc))
+	    xf86DrvMsg(scrnIndex, X_INFO, "GTF timings supported\n"); 
+    }
 }
   
 static void 
commit 322d0103aee317500057c80d542d7270d69a5731
Author: Adam Jackson <ajax at redhat.com>
Date:   Fri Dec 28 16:28:44 2007 -0500

    EDID 1.4: Alternate color encodings for digital inputs.
    
    Section 3.6.4, Table 3.14: Feature support.

diff --git a/hw/xfree86/ddc/edid.h b/hw/xfree86/ddc/edid.h
index 198794e..2496e19 100644
--- a/hw/xfree86/ddc/edid.h
+++ b/hw/xfree86/ddc/edid.h
@@ -326,11 +326,15 @@
 #define DPMS_SUSPEND(x) (x & 0x02)
 #define DPMS_OFF(x) (x & 0x01)
 
-/* display type */
+/* display type, analog */
 #define DISP_MONO 0
 #define DISP_RGB 1
 #define DISP_MULTCOLOR 2
 
+/* display color encodings, digital */
+#define DISP_YCRCB444 0x01
+#define DISP_YCRCB422 0x02
+
 /* Msc stuff EDID Ver > 1.1 */
 #define STD_COLOR_SPACE(x) (x & 0x4)
 #define PREFERRED_TIMING_MODE(x) (x & 0x2)
diff --git a/hw/xfree86/ddc/print_edid.c b/hw/xfree86/ddc/print_edid.c
index 880ca07..30cd175 100644
--- a/hw/xfree86/ddc/print_edid.c
+++ b/hw/xfree86/ddc/print_edid.c
@@ -128,20 +128,29 @@ print_dpms_features(int scrnIndex, struct disp_features *c,
 	 if (DPMS_OFF(c->dpms)) xf86ErrorF(" Off");
      } else 
 	 xf86DrvMsg(scrnIndex,X_INFO,"No DPMS capabilities specified");
-    switch (c->display_type){
-    case DISP_MONO:
-	xf86ErrorF("; Monochorome/GrayScale Display\n");
-	break;
-    case DISP_RGB:
-	xf86ErrorF("; RGB/Color Display\n");
-	break;
-    case DISP_MULTCOLOR:
-	xf86ErrorF("; Non RGB Multicolor Display\n");
-	break;
-    default:
-	xf86ErrorF("\n");
-	break;
+    if (!c->input_type) { /* analog */
+	switch (c->display_type){
+	    case DISP_MONO:
+		xf86ErrorF("; Monochorome/GrayScale Display\n");
+		break;
+	    case DISP_RGB:
+		xf86ErrorF("; RGB/Color Display\n");
+		break;
+	    case DISP_MULTCOLOR:
+		xf86ErrorF("; Non RGB Multicolor Display\n");
+		break;
+	    default:
+		xf86ErrorF("\n");
+		break;
+	}
+    } else {
+	int enc = c->display_type;
+	xf86DrvMsg(scrnIndex, X_INFO, "\nSupported color encodings: "
+		   "RGB 4:4:4 %s%s\n",
+		   enc & DISP_YCRCB444 ? "YCrCb 4:4:4 " : "",
+		   enc & DISP_YCRCB422 ? "YCrCb 4:2:2" : "");
     }
+
     if (STD_COLOR_SPACE(c->msc))
 	xf86DrvMsg(scrnIndex,X_INFO,
 		   "Default color space is primary color space\n"); 
commit f1f43caf7e26a84dbacd4e5d7d47c8b4e4982836
Author: Adam Jackson <ajax at redhat.com>
Date:   Fri Dec 28 16:12:11 2007 -0500

    EDID 1.4: Allow for gamma definition in extension blocks.
    
    Section 3.6.3, Table 3.13: Display Transfer Characteristics (Gamma)

diff --git a/hw/xfree86/ddc/edid.h b/hw/xfree86/ddc/edid.h
index 25163a6..198794e 100644
--- a/hw/xfree86/ddc/edid.h
+++ b/hw/xfree86/ddc/edid.h
@@ -129,7 +129,7 @@
 #define BPC _BPC(GET(D_INPUT))
 #define _DIGITAL_INTERFACE(x) (x & 0x0F)
 #define DIGITAL_INTERFACE _DIGITAL_INTERFACE(GET(D_INPUT))
-#define _GAMMA(x) (x == 0xff ? 1.0 : ((x + 100.0)/100.0))
+#define _GAMMA(x) (x == 0xff ? 0.0 : ((x + 100.0)/100.0))
 #define GAMMA _GAMMA(GET(D_GAMMA))
 #define HSIZE_MAX GET(D_HSIZE)
 #define VSIZE_MAX GET(D_VSIZE)
diff --git a/hw/xfree86/ddc/print_edid.c b/hw/xfree86/ddc/print_edid.c
index 59d414f..880ca07 100644
--- a/hw/xfree86/ddc/print_edid.c
+++ b/hw/xfree86/ddc/print_edid.c
@@ -191,7 +191,11 @@ print_display(int scrnIndex, struct disp_features *disp,
 	xf86DrvMsg(scrnIndex, X_INFO, "Indeterminate output size\n");
     }
 
-    xf86DrvMsg(scrnIndex, X_INFO, "Gamma: %.2f\n", disp->gamma);
+    if (!gamma && v->revision >= 1.4)
+	xf86DrvMsg(scrnIndex, X_INFO, "Gamma defined in extension block\n");
+    else
+	xf86DrvMsg(scrnIndex, X_INFO, "Gamma: %.2f\n", disp->gamma);
+
     print_dpms_features(scrnIndex, disp, v);
     print_whitepoint(scrnIndex, disp);
 }
commit 861ee38817523a647e6be10d7e8fe26f66054217
Author: Adam Jackson <ajax at redhat.com>
Date:   Fri Dec 28 16:06:45 2007 -0500

    EDID 1.4: Additional aspect ratio semantics for screen size fields.
    
    Section 3.6.2, Table 3.12: Horizontal and Vertical Screen Size or
    Aspect Ratio.

diff --git a/hw/xfree86/ddc/print_edid.c b/hw/xfree86/ddc/print_edid.c
index 9bd7ebc..59d414f 100644
--- a/hw/xfree86/ddc/print_edid.c
+++ b/hw/xfree86/ddc/print_edid.c
@@ -172,21 +172,28 @@ print_whitepoint(int scrnIndex, struct disp_features *disp)
 
 static void
 print_display(int scrnIndex, struct disp_features *disp,
-	      struct edid_version *version)
+	      struct edid_version *v)
 {
-    print_input_features(scrnIndex, disp, version);
-    xf86DrvMsg(scrnIndex,X_INFO,"Max H-Image Size [cm]: ");
-    if (disp->hsize)
-	xf86ErrorF("horiz.: %i  ",disp->hsize);
-    else
-	xf86ErrorF("H-Size may change,  ");
-    if (disp->vsize)
-	xf86ErrorF("vert.: %i\n",disp->vsize);
-      else
-	xf86ErrorF("V-Size may change\n");
-    xf86DrvMsg(scrnIndex,X_INFO,"Gamma: %.2f\n", disp->gamma);
-    print_dpms_features(scrnIndex,disp,version);
-    print_whitepoint(scrnIndex,disp);
+    print_input_features(scrnIndex, disp, v);
+    if (disp->hsize && disp->vsize) {
+	xf86DrvMsg(scrnIndex, X_INFO, "Max Image Size [cm]: ");
+	xf86ErrorF("horiz.: %i  ", disp->hsize);
+	xf86ErrorF("vert.: %i\n", disp->vsize);
+    } else if (v->revision >= 4 && (disp->hsize || disp->vsize)) {
+	if (disp->hsize)
+	    xf86DrvMsg(scrnIndex, X_INFO, "Aspect ratio: %.2f (landscape)\n",
+		       (disp->hsize + 99) / 100.0);
+	if (disp->vsize)
+	    xf86DrvMsg(scrnIndex, X_INFO, "Aspect ratio: %.2f (portrait)\n",
+		       100.0 / (float)(disp->vsize + 99));
+
+    } else {
+	xf86DrvMsg(scrnIndex, X_INFO, "Indeterminate output size\n");
+    }
+
+    xf86DrvMsg(scrnIndex, X_INFO, "Gamma: %.2f\n", disp->gamma);
+    print_dpms_features(scrnIndex, disp, v);
+    print_whitepoint(scrnIndex, disp);
 }
 
 static void 
commit 14b5c8a447db0395fb14b2d404eafb1d8e4fb817
Author: Adam Jackson <ajax at redhat.com>
Date:   Fri Dec 28 15:52:42 2007 -0500

    EDID 1.4: Extended support for digital interfaces.
    
    Section 3.6.1, Table 3.11: Video Input Definition.

diff --git a/hw/xfree86/ddc/edid.h b/hw/xfree86/ddc/edid.h
index 6708eaa..25163a6 100644
--- a/hw/xfree86/ddc/edid.h
+++ b/hw/xfree86/ddc/edid.h
@@ -125,6 +125,10 @@
 #define SYNC _SYNC(GET(D_INPUT))
 #define _DFP(x) (x & 0x01)
 #define DFP _DFP(GET(D_INPUT))
+#define _BPC(x) ((x & 0x70) >> 4)
+#define BPC _BPC(GET(D_INPUT))
+#define _DIGITAL_INTERFACE(x) (x & 0x0F)
+#define DIGITAL_INTERFACE _DIGITAL_INTERFACE(GET(D_INPUT))
 #define _GAMMA(x) (x == 0xff ? 1.0 : ((x + 100.0)/100.0))
 #define GAMMA _GAMMA(GET(D_GAMMA))
 #define HSIZE_MAX GET(D_HSIZE)
@@ -364,6 +368,9 @@ struct disp_features {
   unsigned int input_setup:1;
   unsigned int input_sync:5;
   unsigned int input_dfp:1;
+  unsigned int input_bpc:3;
+  unsigned int input_interface:4;
+  /* 15 bit hole */
   int hsize;
   int vsize;
   float gamma;
diff --git a/hw/xfree86/ddc/interpret_edid.c b/hw/xfree86/ddc/interpret_edid.c
index 982a502..045c12d 100644
--- a/hw/xfree86/ddc/interpret_edid.c
+++ b/hw/xfree86/ddc/interpret_edid.c
@@ -148,8 +148,12 @@ get_display_section(Uchar *c, struct disp_features *r,
 	r->input_voltage = INPUT_VOLTAGE;
 	r->input_setup = SETUP;
 	r->input_sync = SYNC;
-    } else if (v->version > 1 || v->revision > 2)
+    } else if (v->revision == 2 || v->revision == 3) {
 	r->input_dfp = DFP;
+    } else if (v->revision >= 4) {
+	r->input_bpc = BPC;
+	r->input_interface = DIGITAL_INTERFACE;
+    }
     r->hsize = HSIZE_MAX;
     r->vsize = VSIZE_MAX;
     r->gamma = GAMMA;
diff --git a/hw/xfree86/ddc/print_edid.c b/hw/xfree86/ddc/print_edid.c
index 5aebc6e..9bd7ebc 100644
--- a/hw/xfree86/ddc/print_edid.c
+++ b/hw/xfree86/ddc/print_edid.c
@@ -1,8 +1,28 @@
-
-/* print_edid.c: print out all information retrieved from display device 
- * 
+/*
  * Copyright 1998 by Egbert Eich <Egbert.Eich at Physik.TU-Darmstadt.DE>
+ * Copyright 2007 Red Hat, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software")
+ * to deal in the software without restriction, including without limitation
+ * on the rights to use, copy, modify, merge, publish, distribute, sub
+ * license, and/or sell copies of the Software, and to permit persons to whom
+ * them Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTIBILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES, OR OTHER LIABILITY, WHETHER
+ * IN AN ACTION OF CONTRACT, TORT, OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * print_edid.c: print out all information retrieved from display device  
  */
+
 #ifdef HAVE_XORG_CONFIG_H
 #include <xorg-config.h>
 #endif
@@ -11,53 +31,9 @@
 #include "xf86.h"
 #include "xf86_OSproc.h"
 #include "xf86DDC.h"
+#include "edid.h"
   
-static void print_vendor(int scrnIndex, struct vendor *);
-static void print_version(int scrnIndex, struct edid_version *);
-static void print_display(int scrnIndex, struct disp_features *,
-			  struct edid_version *);
-static void print_established_timings(int scrnIndex,
-				      struct established_timings *);
-static void print_std_timings(int scrnIndex, struct std_timings *);
-static void print_detailed_monitor_section(int scrnIndex,
-					   struct detailed_monitor_section *);
-static void print_detailed_timings(int scrnIndex, struct detailed_timings *);
-
-static void print_input_features(int scrnIndex, struct disp_features *);
-static void print_dpms_features(int scrnIndex, struct disp_features *,
-				struct edid_version *v);
-static void print_whitepoint(int scrnIndex, struct disp_features *);
-static void print_number_sections(int scrnIndex, int);
-
 #define EDID_WIDTH	16
-
-xf86MonPtr
-xf86PrintEDID(xf86MonPtr m)
-{
-    CARD16 i, j;
-    char buf[EDID_WIDTH * 2 + 1];
-
-    if (!(m)) return NULL;
-
-    print_vendor(m->scrnIndex,&m->vendor);
-    print_version(m->scrnIndex,&m->ver);
-    print_display(m->scrnIndex,&m->features, &m->ver);
-    print_established_timings(m->scrnIndex,&m->timings1);
-    print_std_timings(m->scrnIndex,m->timings2);
-    print_detailed_monitor_section(m->scrnIndex,m->det_mon);
-    print_number_sections(m->scrnIndex,m->no_sections);
-
-    xf86DrvMsg(m->scrnIndex, X_INFO, "EDID (in hex):\n");
- 
-    for (i = 0; i < 128; i += j) {
-	for (j = 0; j < EDID_WIDTH; ++j) {
-	    sprintf(&buf[j * 2], "%02x", m->rawData[i + j]);
-	}
-	xf86DrvMsg(m->scrnIndex, X_INFO, "\t%s\n", buf);
-    }
-    
-    return m;
-}
   
 static void
 print_vendor(int scrnIndex, struct vendor *c)
@@ -66,7 +42,7 @@ print_vendor(int scrnIndex, struct vendor *c)
 	(char *)&c->name, c->prod_id, c->serial);
     xf86DrvMsg(scrnIndex, X_INFO, "Year: %u  Week: %u\n", c->year, c->week);
 }
-  
+
 static void
 print_version(int scrnIndex, struct edid_version *c)
 {
@@ -74,32 +50,38 @@ print_version(int scrnIndex, struct edid_version *c)
 	       c->revision);  
 }
   
-static void
-print_display(int scrnIndex, struct disp_features *disp,
-	      struct edid_version *version)
-{
-    print_input_features(scrnIndex,disp);
-    xf86DrvMsg(scrnIndex,X_INFO,"Max H-Image Size [cm]: ");
-    if (disp->hsize)
-	xf86ErrorF("horiz.: %i  ",disp->hsize);
-    else
-	xf86ErrorF("H-Size may change,  ");
-    if (disp->vsize)
-	xf86ErrorF("vert.: %i\n",disp->vsize);
-      else
-	xf86ErrorF("V-Size may change\n");
-    xf86DrvMsg(scrnIndex,X_INFO,"Gamma: %.2f\n", disp->gamma);
-    print_dpms_features(scrnIndex,disp,version);
-    print_whitepoint(scrnIndex,disp);
-}
-  
+static const char *digital_interfaces[] = {
+    "undefined",
+    "DVI",
+    "HDMI-a",
+    "HDMI-b",
+    "MDDI",
+    "DisplayPort",
+    "unknown"
+};
+
 static void 
-print_input_features(int scrnIndex, struct disp_features *c)
+print_input_features(int scrnIndex, struct disp_features *c,
+		     struct edid_version *v)
 {
     if (DIGITAL(c->input_type)) {
-	xf86DrvMsg(scrnIndex,X_INFO,"Digital Display Input\n");
-	if (DFP1(c->input_dfp))
-	    xf86DrvMsg(scrnIndex,X_INFO,"DFP 1.x compatible TMDS\n");
+	xf86DrvMsg(scrnIndex, X_INFO, "Digital Display Input\n");
+	if (v->revision == 2 || v->revision == 3) {
+	    if (DFP1(c->input_dfp))
+		xf86DrvMsg(scrnIndex, X_INFO, "DFP 1.x compatible TMDS\n");
+	} else if (v->revision >= 4) {
+	    int interface = c->input_interface;
+	    int bpc = c->input_bpc;
+	    if (interface > 6)
+		interface = 6; /* unknown */
+	    if (bpc == 0 || bpc == 7)
+		xf86DrvMsg(scrnIndex, X_INFO, "Undefined color depth\n");
+	    else
+		xf86DrvMsg(scrnIndex, X_INFO, "%d bits per channel\n",
+			   bpc * 2 + 4);
+	    xf86DrvMsg(scrnIndex, X_INFO, "Digital interface is %s\n",
+		       digital_interfaces[interface]);
+	}
     } else {
 	xf86DrvMsg(scrnIndex,X_INFO,"Analog Display Input,  ");
 	xf86ErrorF("Input Voltage Level: ");
@@ -187,7 +169,26 @@ print_whitepoint(int scrnIndex, struct disp_features *disp)
     xf86ErrorF("whiteX: %.3f whiteY: %.3f\n",
 	       disp->whitex,disp->whitey);
 }
-  
+
+static void
+print_display(int scrnIndex, struct disp_features *disp,
+	      struct edid_version *version)
+{
+    print_input_features(scrnIndex, disp, version);
+    xf86DrvMsg(scrnIndex,X_INFO,"Max H-Image Size [cm]: ");
+    if (disp->hsize)
+	xf86ErrorF("horiz.: %i  ",disp->hsize);
+    else
+	xf86ErrorF("H-Size may change,  ");
+    if (disp->vsize)
+	xf86ErrorF("vert.: %i\n",disp->vsize);
+      else
+	xf86ErrorF("V-Size may change\n");
+    xf86DrvMsg(scrnIndex,X_INFO,"Gamma: %.2f\n", disp->gamma);
+    print_dpms_features(scrnIndex,disp,version);
+    print_whitepoint(scrnIndex,disp);
+}
+
 static void 
 print_established_timings(int scrnIndex, struct established_timings *t)
 {
@@ -253,7 +254,50 @@ print_cvt_timings(int si, struct cvt_timings *t)
 	} else break;
     }
 }
-  
+
+static void
+print_detailed_timings(int scrnIndex, struct detailed_timings *t)
+{
+
+    if (t->clock > 15000000) {  /* sanity check */
+	xf86DrvMsg(scrnIndex,X_INFO,"Supported additional Video Mode:\n");
+	xf86DrvMsg(scrnIndex,X_INFO,"clock: %.1f MHz   ",t->clock/1000000.0);
+	xf86ErrorF("Image Size:  %i x %i mm\n",t->h_size,t->v_size); 
+	xf86DrvMsg(scrnIndex,X_INFO,
+		   "h_active: %i  h_sync: %i  h_sync_end %i h_blank_end %i ",
+		   t->h_active, t->h_sync_off + t->h_active,
+		   t->h_sync_off + t->h_sync_width + t->h_active,
+		   t->h_active + t->h_blanking);
+	xf86ErrorF("h_border: %i\n",t->h_border);
+	xf86DrvMsg(scrnIndex,X_INFO,
+		   "v_active: %i  v_sync: %i  v_sync_end %i v_blanking: %i ",
+		   t->v_active, t->v_sync_off + t->v_active,
+		   t->v_sync_off + t->v_sync_width + t->v_active,
+		   t->v_active + t->v_blanking);
+	xf86ErrorF("v_border: %i\n",t->v_border);
+	if (IS_STEREO(t->stereo)) {
+	    xf86DrvMsg(scrnIndex,X_INFO,"Stereo: ");
+	    if (IS_RIGHT_STEREO(t->stereo)) {
+		if (!t->stereo_1)
+		    xf86ErrorF("right channel on sync\n");
+		else
+		    xf86ErrorF("left channel on sync\n");
+	    } else if (IS_LEFT_STEREO(t->stereo)) {
+		if (!t->stereo_1)
+		    xf86ErrorF("right channel on even line\n");
+		else 
+		    xf86ErrorF("left channel on evel line\n");
+	    }
+	    if (IS_4WAY_STEREO(t->stereo)) {
+		if (!t->stereo_1)
+		    xf86ErrorF("4-way interleaved\n");
+		else
+		    xf86ErrorF("side-by-side interleaved");
+	    }
+	}
+    }
+}
+
 static void
 print_detailed_monitor_section(int scrnIndex,
 			       struct detailed_monitor_section *m)
@@ -334,49 +378,6 @@ print_detailed_monitor_section(int scrnIndex,
 }
   
 static void
-print_detailed_timings(int scrnIndex, struct detailed_timings *t)
-{
-
-    if (t->clock > 15000000) {  /* sanity check */
-	xf86DrvMsg(scrnIndex,X_INFO,"Supported additional Video Mode:\n");
-	xf86DrvMsg(scrnIndex,X_INFO,"clock: %.1f MHz   ",t->clock/1000000.0);
-	xf86ErrorF("Image Size:  %i x %i mm\n",t->h_size,t->v_size); 
-	xf86DrvMsg(scrnIndex,X_INFO,
-		   "h_active: %i  h_sync: %i  h_sync_end %i h_blank_end %i ",
-		   t->h_active, t->h_sync_off + t->h_active,
-		   t->h_sync_off + t->h_sync_width + t->h_active,
-		   t->h_active + t->h_blanking);
-	xf86ErrorF("h_border: %i\n",t->h_border);
-	xf86DrvMsg(scrnIndex,X_INFO,
-		   "v_active: %i  v_sync: %i  v_sync_end %i v_blanking: %i ",
-		   t->v_active, t->v_sync_off + t->v_active,
-		   t->v_sync_off + t->v_sync_width + t->v_active,
-		   t->v_active + t->v_blanking);
-	xf86ErrorF("v_border: %i\n",t->v_border);
-	if (IS_STEREO(t->stereo)) {
-	    xf86DrvMsg(scrnIndex,X_INFO,"Stereo: ");
-	    if (IS_RIGHT_STEREO(t->stereo)) {
-		if (!t->stereo_1)
-		    xf86ErrorF("right channel on sync\n");
-		else
-		    xf86ErrorF("left channel on sync\n");
-	    } else if (IS_LEFT_STEREO(t->stereo)) {
-		if (!t->stereo_1)
-		    xf86ErrorF("right channel on even line\n");
-		else 
-		    xf86ErrorF("left channel on evel line\n");
-	    }
-	    if (IS_4WAY_STEREO(t->stereo)) {
-		if (!t->stereo_1)
-		    xf86ErrorF("4-way interleaved\n");
-		else
-		    xf86ErrorF("side-by-side interleaved");
-	    }
-	}
-    }
-}
-
-static void
 print_number_sections(int scrnIndex, int num)
 {
     if (num)
@@ -384,3 +385,30 @@ print_number_sections(int scrnIndex, int num)
 		   num);
 }
 
+xf86MonPtr
+xf86PrintEDID(xf86MonPtr m)
+{
+    CARD16 i, j;
+    char buf[EDID_WIDTH * 2 + 1];
+
+    if (!(m)) return NULL;
+
+    print_vendor(m->scrnIndex,&m->vendor);
+    print_version(m->scrnIndex,&m->ver);
+    print_display(m->scrnIndex,&m->features, &m->ver);
+    print_established_timings(m->scrnIndex,&m->timings1);
+    print_std_timings(m->scrnIndex,m->timings2);
+    print_detailed_monitor_section(m->scrnIndex,m->det_mon);
+    print_number_sections(m->scrnIndex,m->no_sections);
+
+    xf86DrvMsg(m->scrnIndex, X_INFO, "EDID (in hex):\n");
+ 
+    for (i = 0; i < 128; i += j) {
+	for (j = 0; j < EDID_WIDTH; ++j) {
+	    sprintf(&buf[j * 2], "%02x", m->rawData[i + j]);
+	}
+	xf86DrvMsg(m->scrnIndex, X_INFO, "\t%s\n", buf);
+    }
+    
+    return m;
+}
commit a948216dccb5ee577a50a42035dc9bc49d0a00c6
Author: Adam Jackson <ajax at redhat.com>
Date:   Fri Dec 28 15:00:41 2007 -0500

    EDID 1.4: Decode CVT 3-byte codes and add them to the mode pool.
    
    Section 3.10.3.8: CVT 3 Byte Code Descriptor Definition.

diff --git a/hw/xfree86/ddc/edid.h b/hw/xfree86/ddc/edid.h
index 2e3e7df..6708eaa 100644
--- a/hw/xfree86/ddc/edid.h
+++ b/hw/xfree86/ddc/edid.h
@@ -449,17 +449,33 @@ struct whitePoints{
   float white_gamma;
 };
 
+struct cvt_timings {
+    int width;
+    int height;
+    int rate;
+    int rates;
+};
+
+/*
+ * Be careful when adding new sections; this structure can't grow, it's
+ * embedded in the middle of xf86Monitor which is ABI.  Sizes below are
+ * in bytes, for ILP32 systems.  If all else fails just copy the section
+ * literally like serial and friends.
+ */
 struct detailed_monitor_section {
   int type;
   union {
-    struct detailed_timings d_timings;
+    struct detailed_timings d_timings;	/* 56 */
     Uchar serial[13];
     Uchar ascii_data[13];
     Uchar name[13];
-    struct monitor_ranges ranges;
-    struct std_timings std_t[5];
-    struct whitePoints wp[2];
-  } section;
+    struct monitor_ranges ranges;	/* 40 */
+    struct std_timings std_t[5];	/* 80 */
+    struct whitePoints wp[2];		/* 32 */
+    /* color management data */
+    struct cvt_timings cvt[4];		/* 64 */
+    /* established timings III */
+  } section;				/* max: 80 */
 };
 
 typedef struct {
diff --git a/hw/xfree86/ddc/interpret_edid.c b/hw/xfree86/ddc/interpret_edid.c
index ecec2b0..982a502 100644
--- a/hw/xfree86/ddc/interpret_edid.c
+++ b/hw/xfree86/ddc/interpret_edid.c
@@ -175,6 +175,34 @@ get_established_timing_section(Uchar *c, struct established_timings *r)
 }
 
 static void
+get_cvt_timing_section(Uchar *c, struct cvt_timings *r)
+{
+    int i;
+
+    for (i = 0; i < 4; i++) {
+	if (c[0] && c[1] && c[2]) {
+	    r[i].height = (c[0] + ((c[1] & 0xF0) << 8) + 1) * 2;
+	    switch (c[1] & 0xc0) {
+		case 0x00: r[i].width = r[i].height * 4 / 3; break;
+		case 0x40: r[i].width = r[i].height * 16 / 9; break;
+		case 0x80: r[i].width = r[i].height * 16 / 10; break;
+		case 0xc0: r[i].width = r[i].height * 15 / 9; break;
+	    }
+	    switch (c[2] & 0x60) {
+		case 0x00: r[i].rate = 50; break;
+		case 0x20: r[i].rate = 60; break;
+		case 0x40: r[i].rate = 75; break;
+		case 0x60: r[i].rate = 85; break;
+	    }
+	    r[i].rates = c[2] & 0x1f;
+	} else {
+	    return;
+	}
+	c += 3;
+    }
+}
+
+static void
 get_std_timing_section(Uchar *c, struct std_timings *r,
 		       struct edid_version *v)
 {
@@ -232,6 +260,7 @@ get_dt_md_section(Uchar *c, struct edid_version *ver,
 	break;
       case CVT_3BYTE_DATA:
 	det_mon[i].type = DS_CVT;
+	get_cvt_timing_section(c, det_mon[i].section.cvt);
 	break;
       case ADD_EST_TIMINGS:
 	det_mon[i].type = DS_EST_III;
diff --git a/hw/xfree86/ddc/print_edid.c b/hw/xfree86/ddc/print_edid.c
index 17e21ac..5aebc6e 100644
--- a/hw/xfree86/ddc/print_edid.c
+++ b/hw/xfree86/ddc/print_edid.c
@@ -235,6 +235,24 @@ print_std_timings(int scrnIndex, struct std_timings *t)
 	}
     }
 }
+
+static void
+print_cvt_timings(int si, struct cvt_timings *t)
+{
+    int i;
+
+    for (i = 0; i < 4; i++) {
+	if (t[i].height) {
+	    xf86DrvMsg(si, X_INFO, "%dx%d @ %s%s%s%s%s Hz\n",
+		    t[i].width, t[i].height,
+		    t[i].rates & 0x10 ? "50," : "",
+		    t[i].rates & 0x08 ? "60," : "",
+		    t[i].rates & 0x04 ? "75," : "",
+		    t[i].rates & 0x02 ? "85," : "",
+		    t[i].rates & 0x01 ? "60RB" : "");
+	} else break;
+    }
+}
   
 static void
 print_detailed_monitor_section(int scrnIndex,
@@ -296,7 +314,8 @@ print_detailed_monitor_section(int scrnIndex,
 	    break;
 	case DS_CVT:
 	    xf86DrvMsg(scrnIndex, X_INFO,
-		       "CVT 3-byte-code modes: (not decoded)\n");
+		       "CVT 3-byte-code modes:\n");
+	    print_cvt_timings(scrnIndex, m[i].section.cvt);
 	    break;
 	case DS_EST_III:
 	    xf86DrvMsg(scrnIndex, X_INFO,
diff --git a/hw/xfree86/modes/xf86EdidModes.c b/hw/xfree86/modes/xf86EdidModes.c
index a125d8c..d8c6161 100644
--- a/hw/xfree86/modes/xf86EdidModes.c
+++ b/hw/xfree86/modes/xf86EdidModes.c
@@ -354,6 +354,36 @@ DDCModeFromDetailedTiming(int scrnIndex, struct detailed_timings *timing,
     return Mode;
 }
 
+static DisplayModePtr
+DDCModesFromCVT(int scrnIndex, struct cvt_timings *t)
+{
+    DisplayModePtr modes = NULL;
+    int i;
+
+    for (i = 0; i < 4; i++) {
+	if (t[i].height) {
+	    if (t[i].rates & 0x10)
+		modes = xf86ModesAdd(modes,
+			xf86CVTMode(t[i].width, t[i].height, 50, 0, 0));
+	    if (t[i].rates & 0x08)
+		modes = xf86ModesAdd(modes,
+			xf86CVTMode(t[i].width, t[i].height, 60, 0, 0));
+	    if (t[i].rates & 0x04)
+		modes = xf86ModesAdd(modes,
+			xf86CVTMode(t[i].width, t[i].height, 75, 0, 0));
+	    if (t[i].rates & 0x02)
+		modes = xf86ModesAdd(modes,
+			xf86CVTMode(t[i].width, t[i].height, 85, 0, 0));
+	    if (t[i].rates & 0x01)
+		modes = xf86ModesAdd(modes,
+			xf86CVTMode(t[i].width, t[i].height, 60, 1, 0));
+	} else break;
+    }
+
+    return modes;
+}
+
+
 /*
  *
  */
@@ -527,6 +557,10 @@ xf86DDCGetModes(int scrnIndex, xf86MonPtr DDC)
 					      quirks);
             Modes = xf86ModesAdd(Modes, Mode);
             break;
+	case DS_CVT:
+	    Mode = DDCModesFromCVT(scrnIndex, det_mon->section.cvt);
+	    Modes = xf86ModesAdd(Modes, Mode);
+	    break;
         default:
             break;
         }
commit f6df66cc89bcd0a0be2e7bca05839fdd428c1d4c
Author: Adam Jackson <ajax at redhat.com>
Date:   Fri Dec 28 13:55:39 2007 -0500

    EDID 1.4: Trivial support for new detailed sections.
    
    Nothing actually decoded yet, but at least we print what they are.
    
    New in EDID 1.4:
    - Color Management Data (0xF9), Section 3.10.3.7
    - CVT 3 Byte Code Descriptor (0xF8), Section 3.10.3.8
    - Established Timings III Descriptor (0xF7), section 3.10.3.9
    - Manufacturer-specified data tag (0x00 - 0x0F), section 3.10.3.12

diff --git a/hw/xfree86/ddc/edid.h b/hw/xfree86/ddc/edid.h
index 02f5d09..2e3e7df 100644
--- a/hw/xfree86/ddc/edid.h
+++ b/hw/xfree86/ddc/edid.h
@@ -286,6 +286,9 @@
 #define _WHITE_GAMMA2(x) _GAMMA(x[14])
 #define WHITE_GAMMA2 _WHITE_GAMMA2(c)
 #define ADD_STD_TIMINGS 0xFA
+#define COLOR_MANAGEMENT_DATA 0xF9
+#define CVT_3BYTE_DATA 0xF8
+#define ADD_EST_TIMINGS 0xF7
 #define ADD_DUMMY 0x10
 
 #define _NEXT_DT_MD_SECTION(x) (x = (x + DET_TIMING_INFO_LEN))
@@ -418,8 +421,13 @@ struct detailed_timings {
 #define DS_RANGES 0xFD
 #define DS_WHITE_P 0xFB
 #define DS_STD_TIMINGS 0xFA
+#define DS_CMD 0xF9
+#define DS_CVT 0xF8
+#define DS_EST_III 0xF7
 #define DS_DUMMY 0x10
 #define DS_UNKOWN 0x100 /* type is an int */
+#define DS_VENDOR 0x101
+#define DS_VENDOR_MAX 0x110
 
 struct monitor_ranges {
   int min_v;
diff --git a/hw/xfree86/ddc/interpret_edid.c b/hw/xfree86/ddc/interpret_edid.c
index 7b4b2b9..ecec2b0 100644
--- a/hw/xfree86/ddc/interpret_edid.c
+++ b/hw/xfree86/ddc/interpret_edid.c
@@ -1,8 +1,28 @@
-
-/* interpret_edid.c: interpret a primary EDID block
- * 
+/*
  * Copyright 1998 by Egbert Eich <Egbert.Eich at Physik.TU-Darmstadt.DE>
+ * Copyright 2007 Red Hat, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software")
+ * to deal in the software without restriction, including without limitation
+ * on the rights to use, copy, modify, merge, publish, distribute, sub
+ * license, and/or sell copies of the Software, and to permit persons to whom
+ * them Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTIBILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES, OR OTHER LIABILITY, WHETHER
+ * IN AN ACTION OF CONTRACT, TORT, OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * interpret_edid.c: interpret a primary EDID block
  */
+
 #ifdef HAVE_XORG_CONFIG_H
 #include <xorg-config.h>
 #endif
@@ -207,6 +227,15 @@ get_dt_md_section(Uchar *c, struct edid_version *ver,
 	det_mon[i].type = DS_STD_TIMINGS;
 	get_dst_timing_section(c,det_mon[i].section.std_t, ver);
 	break;
+      case COLOR_MANAGEMENT_DATA:
+	det_mon[i].type = DS_CMD;
+	break;
+      case CVT_3BYTE_DATA:
+	det_mon[i].type = DS_CVT;
+	break;
+      case ADD_EST_TIMINGS:
+	det_mon[i].type = DS_EST_III;
+	break;
       case ADD_DUMMY:
 	det_mon[i].type = DS_DUMMY;
         break;
@@ -214,6 +243,9 @@ get_dt_md_section(Uchar *c, struct edid_version *ver,
         det_mon[i].type = DS_UNKOWN;
         break;
       }
+      if (c[3] <= 0x0F) {
+	det_mon[i].type = DS_VENDOR + c[3];
+      }
     } else { 
       det_mon[i].type = DT;
       get_detailed_timing_section(c,&det_mon[i].section.d_timings);
diff --git a/hw/xfree86/ddc/print_edid.c b/hw/xfree86/ddc/print_edid.c
index 30b607d..17e21ac 100644
--- a/hw/xfree86/ddc/print_edid.c
+++ b/hw/xfree86/ddc/print_edid.c
@@ -290,10 +290,27 @@ print_detailed_monitor_section(int scrnIndex,
 			       m[i].section.wp[j].white_y,
 			       m[i].section.wp[j].white_gamma);
 	    break;
+	case DS_CMD:
+	    xf86DrvMsg(scrnIndex, X_INFO,
+		       "Color management data: (not decoded)\n");
+	    break;
+	case DS_CVT:
+	    xf86DrvMsg(scrnIndex, X_INFO,
+		       "CVT 3-byte-code modes: (not decoded)\n");
+	    break;
+	case DS_EST_III:
+	    xf86DrvMsg(scrnIndex, X_INFO,
+		       "Established timings III: (not decoded)\n");
+	    break;
 	case DS_DUMMY:
 	default:
 	    break;
 	}
+	if (m[i].type >= DS_VENDOR && m[i].type <= DS_VENDOR_MAX) {
+	    xf86DrvMsg(scrnIndex, X_WARNING,
+		       "Unknown vendor-specific block %hx\n",
+		       m[i].type - DS_VENDOR);
+	}
     }
 }
   
commit bac3ecde39cc914ab515991234b7dc2138005b84
Author: Adam Jackson <ajax at redhat.com>
Date:   Fri Dec 28 13:33:39 2007 -0500

    EDID 1.4: Allow for sync range offsets.
    
    Table 3.26: Display Range Limits & Timing Descriptor Block Definition

diff --git a/hw/xfree86/ddc/edid.h b/hw/xfree86/ddc/edid.h
index 4487273..02f5d09 100644
--- a/hw/xfree86/ddc/edid.h
+++ b/hw/xfree86/ddc/edid.h
@@ -1,5 +1,5 @@
-
-/* edid.h: defines to parse an EDID block 
+/*
+ * edid.h: defines to parse an EDID block 
  *
  * This file contains all information to interpret a standard EDIC block 
  * transmitted by a display device via DDC (Display Data Channel). So far 
@@ -241,14 +241,18 @@
 #define SERIAL_NUMBER 0xFF
 #define ASCII_STR 0xFE
 #define MONITOR_RANGES 0xFD
+#define _MIN_V_OFFSET(x) ((!!(x[4] & 0x01)) * 255)
+#define _MAX_V_OFFSET(x) ((!!(x[4] & 0x02)) * 255)
+#define _MIN_H_OFFSET(x) ((!!(x[4] & 0x04)) * 255)
+#define _MAX_H_OFFSET(x) ((!!(x[4] & 0x08)) * 255)
 #define _MIN_V(x) x[5]
-#define MIN_V _MIN_V(c) 
+#define MIN_V (_MIN_V(c) + _MIN_V_OFFSET(c))
 #define _MAX_V(x) x[6]
-#define MAX_V _MAX_V(c) 
+#define MAX_V (_MAX_V(c) + _MAX_V_OFFSET(c))
 #define _MIN_H(x) x[7]
-#define MIN_H _MIN_H(c) 
+#define MIN_H (_MIN_H(c) + _MIN_H_OFFSET(c))
 #define _MAX_H(x) x[8]
-#define MAX_H _MAX_H(c) 
+#define MAX_H (_MAX_H(c) + _MAX_H_OFFSET(c))
 #define _MAX_CLOCK(x) x[9]
 #define MAX_CLOCK _MAX_CLOCK(c) 
 #define _HAVE_2ND_GTF(x) (x[10] == 0x02)
commit 3b23dd9fd43a28033d0af7b02088b0c6ca433158
Author: Eamon Walsh <ewalsh at tycho.nsa.gov>
Date:   Fri Dec 28 13:29:45 2007 -0500

    xselinux: Fix whitespace warnings.

diff --git a/Xext/xselinux.c b/Xext/xselinux.c
index 6550c7f..4629e90 100644
--- a/Xext/xselinux.c
+++ b/Xext/xselinux.c
@@ -1145,31 +1145,31 @@ ProcSELinuxDispatch(ClientPtr client)
     REQUEST(xReq);
     switch (stuff->data) {
     case X_SELinuxQueryVersion:
-        return ProcSELinuxQueryVersion(client);
+	return ProcSELinuxQueryVersion(client);
     case X_SELinuxSetSelectionManager:
 	return ProcSELinuxSetSelectionManager(client);
     case X_SELinuxGetSelectionManager:
-    	return ProcSELinuxGetSelectionManager(client);
+	return ProcSELinuxGetSelectionManager(client);
     case X_SELinuxSetDeviceCreateContext:
-    	return ProcSELinuxSetDeviceCreateContext(client);
+	return ProcSELinuxSetDeviceCreateContext(client);
     case X_SELinuxGetDeviceCreateContext:
-    	return ProcSELinuxGetDeviceCreateContext(client);
+	return ProcSELinuxGetDeviceCreateContext(client);
     case X_SELinuxSetDeviceContext:
-    	return ProcSELinuxSetDeviceContext(client);
+	return ProcSELinuxSetDeviceContext(client);
     case X_SELinuxGetDeviceContext:
-    	return ProcSELinuxGetDeviceContext(client);
+	return ProcSELinuxGetDeviceContext(client);
     case X_SELinuxSetPropertyCreateContext:
-    	return ProcSELinuxSetPropertyCreateContext(client);
+	return ProcSELinuxSetPropertyCreateContext(client);
     case X_SELinuxGetPropertyCreateContext:
-    	return ProcSELinuxGetPropertyCreateContext(client);
+	return ProcSELinuxGetPropertyCreateContext(client);
     case X_SELinuxGetPropertyContext:
-    	return ProcSELinuxGetPropertyContext(client);
+	return ProcSELinuxGetPropertyContext(client);
     case X_SELinuxSetWindowCreateContext:
-    	return ProcSELinuxSetWindowCreateContext(client);
+	return ProcSELinuxSetWindowCreateContext(client);
     case X_SELinuxGetWindowCreateContext:
-    	return ProcSELinuxGetWindowCreateContext(client);
+	return ProcSELinuxGetWindowCreateContext(client);
     case X_SELinuxGetWindowContext:
-    	return ProcSELinuxGetWindowContext(client);
+	return ProcSELinuxGetWindowContext(client);
     default:
 	return BadRequest;
     }
commit 643c52be32c187a0fdb9a031b1e31d97cd551339
Author: Eamon Walsh <ewalsh at tycho.nsa.gov>
Date:   Fri Dec 28 13:26:26 2007 -0500

    xselinux: Remove "X" prefix on remaining functions and strings.
    
    Should be evident from the context.

diff --git a/Xext/xselinux.c b/Xext/xselinux.c
index f3a8457..6550c7f 100644
--- a/Xext/xselinux.c
+++ b/Xext/xselinux.c
@@ -175,12 +175,12 @@ SELinuxSelectionToSID(Atom selection, SELinuxStateRec *sid_return)
 	security_id_t sid;
 
 	if (selabel_lookup(label_hnd, &con, name, SELABEL_X_SELN) < 0) {
-	    ErrorF("XSELinux: a selection label lookup failed!\n");
+	    ErrorF("SELinux: a selection label lookup failed!\n");
 	    return BadValue;
 	}
 	/* Get a SID for context */
 	if (avc_context_to_sid(con, &sid) < 0) {
-	    ErrorF("XSELinux: a context_to_SID call failed!\n");
+	    ErrorF("SELinux: a context_to_SID call failed!\n");
 	    return BadAlloc;
 	}
 	freecon(con);
@@ -216,12 +216,12 @@ SELinuxEventToSID(unsigned type, security_id_t sid_of_window,
     if (!knownEvents[type]) {
 	/* Look in the mappings of event names to contexts */
 	if (selabel_lookup(label_hnd, &con, name, SELABEL_X_EVENT) < 0) {
-	    ErrorF("XSELinux: an event label lookup failed!\n");
+	    ErrorF("SELinux: an event label lookup failed!\n");
 	    return BadValue;
 	}
 	/* Get a SID for context */
 	if (avc_context_to_sid(con, knownEvents + type) < 0) {
-	    ErrorF("XSELinux: a context_to_SID call failed!\n");
+	    ErrorF("SELinux: a context_to_SID call failed!\n");
 	    return BadAlloc;
 	}
 	freecon(con);
@@ -230,7 +230,7 @@ SELinuxEventToSID(unsigned type, security_id_t sid_of_window,
     /* Perform a transition to obtain the final SID */
     if (avc_compute_create(sid_of_window, knownEvents[type], SECCLASS_X_EVENT,
 			   &sid_return->sid) < 0) {
-	ErrorF("XSELinux: a compute_create call failed!\n");
+	ErrorF("SELinux: a compute_create call failed!\n");
 	return BadValue;
     }
 
@@ -607,13 +607,13 @@ SELinuxExtension(CallbackListPtr *pcbl, pointer unused, pointer calldata)
 
 	/* Look in the mappings of property names to contexts */
 	if (selabel_lookup(label_hnd, &con, name, SELABEL_X_EXT) < 0) {
-	    ErrorF("XSELinux: a property label lookup failed!\n");
+	    ErrorF("SELinux: a property label lookup failed!\n");
 	    rec->status = BadValue;
 	    return;
 	}
 	/* Get a SID for context */
 	if (avc_context_to_sid(con, &sid) < 0) {
-	    ErrorF("XSELinux: a context_to_SID call failed!\n");
+	    ErrorF("SELinux: a context_to_SID call failed!\n");
 	    rec->status = BadAlloc;
 	    return;
 	}
@@ -623,7 +623,7 @@ SELinuxExtension(CallbackListPtr *pcbl, pointer unused, pointer calldata)
 	/* Perform a transition to obtain the final SID */
 	if (avc_compute_create(serv->sid, sid, SECCLASS_X_EXTENSION,
 			       &obj->sid) < 0) {
-	    ErrorF("XSELinux: a SID transition call failed!\n");
+	    ErrorF("SELinux: a SID transition call failed!\n");
 	    freecon(con);
 	    rec->status = BadValue;
 	    return;
@@ -658,13 +658,13 @@ SELinuxProperty(CallbackListPtr *pcbl, pointer unused, pointer calldata)
 
 	/* Look in the mappings of property names to contexts */
 	if (selabel_lookup(label_hnd, &con, name, SELABEL_X_PROP) < 0) {
-	    ErrorF("XSELinux: a property label lookup failed!\n");
+	    ErrorF("SELinux: a property label lookup failed!\n");
 	    rec->status = BadValue;
 	    return;
 	}
 	/* Get a SID for context */
 	if (avc_context_to_sid(con, &sid) < 0) {
-	    ErrorF("XSELinux: a context_to_SID call failed!\n");
+	    ErrorF("SELinux: a context_to_SID call failed!\n");
 	    rec->status = BadAlloc;
 	    return;
 	}
@@ -674,7 +674,7 @@ SELinuxProperty(CallbackListPtr *pcbl, pointer unused, pointer calldata)
 	/* Perform a transition to obtain the final SID */
 	if (avc_compute_create(subj->sid, sid, SECCLASS_X_PROPERTY,
 			       &obj->sid) < 0) {
-	    ErrorF("XSELinux: a SID transition call failed!\n");
+	    ErrorF("SELinux: a SID transition call failed!\n");
 	    freecon(con);
 	    rec->status = BadValue;
 	    return;
@@ -732,7 +732,7 @@ SELinuxResource(CallbackListPtr *pcbl, pointer unused, pointer calldata)
 
 	/* Perform a transition to obtain the final SID */
 	if (avc_compute_create(subj->sid, pobj->sid, class, &obj->sid) < 0) {
-	    ErrorF("XSELinux: a compute_create call failed!\n");
+	    ErrorF("SELinux: a compute_create call failed!\n");
 	    rec->status = BadValue;
 	    return;
 	}
@@ -766,7 +766,7 @@ SELinuxScreen(CallbackListPtr *pcbl, pointer is_saver, pointer calldata)
 	/* Perform a transition to obtain the final SID */
 	if (avc_compute_create(subj->sid, subj->sid, SECCLASS_X_SCREEN,
 			       &obj->sid) < 0) {
-	    ErrorF("XSELinux: a compute_create call failed!\n");
+	    ErrorF("SELinux: a compute_create call failed!\n");
 	    rec->status = BadValue;
 	    return;
 	}
@@ -883,16 +883,16 @@ SELinuxResourceState(CallbackListPtr *pcbl, pointer unused, pointer calldata)
 	security_context_t ctx;
 	int rc = avc_sid_to_context(state->sid, &ctx);
 	if (rc < 0)
-	    FatalError("XSELinux: Failed to get security context!\n");
+	    FatalError("SELinux: Failed to get security context!\n");
 	rc = dixChangeWindowProperty(serverClient,
 				     pWin, atom_client_ctx, XA_STRING, 8,
 				     PropModeReplace, strlen(ctx), ctx, FALSE);
 	if (rc != Success)
-	    FatalError("XSELinux: Failed to set label property on window!\n");
+	    FatalError("SELinux: Failed to set label property on window!\n");
 	freecon(ctx);
     }
     else
-	FatalError("XSELinux: Unexpected unlabeled client found\n");
+	FatalError("SELinux: Unexpected unlabeled client found\n");
 
     state = dixLookupPrivate(&pWin->devPrivates, stateKey);
 
@@ -900,16 +900,16 @@ SELinuxResourceState(CallbackListPtr *pcbl, pointer unused, pointer calldata)
 	security_context_t ctx;
 	int rc = avc_sid_to_context(state->sid, &ctx);
 	if (rc < 0)
-	    FatalError("XSELinux: Failed to get security context!\n");
+	    FatalError("SELinux: Failed to get security context!\n");
 	rc = dixChangeWindowProperty(serverClient,
 				     pWin, atom_ctx, XA_STRING, 8,
 				     PropModeReplace, strlen(ctx), ctx, FALSE);
 	if (rc != Success)
-	    FatalError("XSELinux: Failed to set label property on window!\n");
+	    FatalError("SELinux: Failed to set label property on window!\n");
 	freecon(ctx);
     }
     else
-	FatalError("XSELinux: Unexpected unlabeled window found\n");
+	FatalError("SELinux: Unexpected unlabeled window found\n");
 }
 
 static void
@@ -931,7 +931,7 @@ SELinuxSelectionState(CallbackListPtr *pcbl, pointer unused, pointer calldata)
 
 	if (avc_compute_create(subj->sid, subj->sid, SECCLASS_X_SELECTION,
 			       &obj->sid) < 0) {
-	    ErrorF("XSELinux: a compute_create call failed!\n");
+	    ErrorF("SELinux: a compute_create call failed!\n");
 	    obj->sid = unlabeled_sid;
 	}
 	break;
@@ -998,8 +998,8 @@ ProcSELinuxQueryVersion(ClientPtr client)
     rep.type = X_Reply;
     rep.length = 0;
     rep.sequenceNumber = client->sequence;
-    rep.server_major = XSELINUX_MAJOR_VERSION;
-    rep.server_minor = XSELINUX_MINOR_VERSION;
+    rep.server_major = SELINUX_MAJOR_VERSION;
+    rep.server_minor = SELINUX_MINOR_VERSION;
     if (client->swapped) {
 	int n;
 	swaps(&rep.sequenceNumber, n);
@@ -1367,7 +1367,7 @@ SELinuxResetProc(ExtensionEntry *extEntry)
 }
 
 void
-XSELinuxExtensionInit(INITARGS)
+SELinuxExtensionInit(INITARGS)
 {
     ExtensionEntry *extEntry;
     struct selinux_opt options[] = { { SELABEL_OPT_VALIDATE, (char *)1 } };
@@ -1376,7 +1376,7 @@ XSELinuxExtensionInit(INITARGS)
 
     /* Setup SELinux stuff */
     if (!is_selinux_enabled()) {
-        ErrorF("XSELinux: SELinux not enabled, disabling SELinux support.\n");
+        ErrorF("SELinux: SELinux not enabled, disabling SELinux support.\n");
         return;
     }
 
@@ -1385,42 +1385,42 @@ XSELinuxExtensionInit(INITARGS)
 
     if (selinux_set_mapping(map) < 0) {
 	if (errno == EINVAL) {
-	    ErrorF("XSELinux: Invalid object class mapping, disabling SELinux support.\n");
+	    ErrorF("SELinux: Invalid object class mapping, disabling SELinux support.\n");
 	    return;
 	}
-	FatalError("XSELinux: Failed to set up security class mapping\n");
+	FatalError("SELinux: Failed to set up security class mapping\n");
     }
 
     if (avc_open(NULL, 0) < 0)
-	FatalError("XSELinux: Couldn't initialize SELinux userspace AVC\n");
+	FatalError("SELinux: Couldn't initialize SELinux userspace AVC\n");
     avc_active = 1;
 
     label_hnd = selabel_open(SELABEL_CTX_X, options, 1);
     if (!label_hnd)
-	FatalError("XSELinux: Failed to open x_contexts mapping in policy\n");
+	FatalError("SELinux: Failed to open x_contexts mapping in policy\n");
 
     if (security_get_initial_context("unlabeled", &con) < 0)
-	FatalError("XSELinux: Failed to look up unlabeled context\n");
+	FatalError("SELinux: Failed to look up unlabeled context\n");
     if (avc_context_to_sid(con, &unlabeled_sid) < 0)
-	FatalError("XSELinux: a context_to_SID call failed!\n");
+	FatalError("SELinux: a context_to_SID call failed!\n");
     freecon(con);
 
     /* Prepare for auditing */
     audit_fd = audit_open();
     if (audit_fd < 0)
-        FatalError("XSELinux: Failed to open the system audit log\n");
+        FatalError("SELinux: Failed to open the system audit log\n");
 
     /* Allocate private storage */
     if (!dixRequestPrivate(stateKey, sizeof(SELinuxStateRec)))
-	FatalError("XSELinux: Failed to allocate private storage.\n");
+	FatalError("SELinux: Failed to allocate private storage.\n");
 
     /* Create atoms for doing window labeling */
     atom_ctx = MakeAtom("_SELINUX_CONTEXT", 16, TRUE);
     if (atom_ctx == BAD_RESOURCE)
-	FatalError("XSELinux: Failed to create atom\n");
+	FatalError("SELinux: Failed to create atom\n");
     atom_client_ctx = MakeAtom("_SELINUX_CLIENT_CONTEXT", 23, TRUE);
     if (atom_client_ctx == BAD_RESOURCE)
-	FatalError("XSELinux: Failed to create atom\n");
+	FatalError("SELinux: Failed to create atom\n");
 
     /* Register callbacks */
     ret &= dixRegisterPrivateInitFunc(stateKey, SELinuxStateInit, NULL);
@@ -1443,11 +1443,11 @@ XSELinuxExtensionInit(INITARGS)
     ret &= XaceRegisterCallback(XACE_SCREEN_ACCESS, SELinuxScreen, NULL);
     ret &= XaceRegisterCallback(XACE_SCREENSAVER_ACCESS, SELinuxScreen, truep);
     if (!ret)
-	FatalError("XSELinux: Failed to register one or more callbacks\n");
+	FatalError("SELinux: Failed to register one or more callbacks\n");
 
     /* Add extension to server */
-    extEntry = AddExtension(XSELINUX_EXTENSION_NAME,
-			    XSELinuxNumberEvents, XSELinuxNumberErrors,
+    extEntry = AddExtension(SELINUX_EXTENSION_NAME,
+			    SELinuxNumberEvents, SELinuxNumberErrors,
 			    ProcSELinuxDispatch, SProcSELinuxDispatch,
 			    SELinuxResetProc, StandardMinorOpcode);
 
diff --git a/Xext/xselinux.h b/Xext/xselinux.h
index 9800d5a..ba1380b 100644
--- a/Xext/xselinux.h
+++ b/Xext/xselinux.h
@@ -23,11 +23,11 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 #include "dixaccess.h"
 
 /* Extension info */
-#define XSELINUX_EXTENSION_NAME		"SELinux"
-#define XSELINUX_MAJOR_VERSION		1
-#define XSELINUX_MINOR_VERSION		0
-#define XSELinuxNumberEvents		0
-#define XSELinuxNumberErrors		0
+#define SELINUX_EXTENSION_NAME		"SELinux"
+#define SELINUX_MAJOR_VERSION		1
+#define SELINUX_MINOR_VERSION		0
+#define SELinuxNumberEvents		0
+#define SELinuxNumberErrors		0
 
 /* Extension protocol */
 #define X_SELinuxQueryVersion			0
diff --git a/hw/xfree86/dixmods/extmod/modinit.h b/hw/xfree86/dixmods/extmod/modinit.h
index 191b3ef..99d714c 100644
--- a/hw/xfree86/dixmods/extmod/modinit.h
+++ b/hw/xfree86/dixmods/extmod/modinit.h
@@ -130,7 +130,7 @@ extern void XaceExtensionInit(INITARGS);
 #endif
 
 #ifdef XSELINUX
-extern void XSELinuxExtensionInit(INITARGS);
+extern void SELinuxExtensionInit(INITARGS);
 #endif
 
 #if 1
diff --git a/mi/miinitext.c b/mi/miinitext.c
index 319d2ce..b146907 100644
--- a/mi/miinitext.c
+++ b/mi/miinitext.c
@@ -330,7 +330,7 @@ extern void XaceExtensionInit(INITARGS);
 extern void SecurityExtensionInit(INITARGS);
 #endif
 #ifdef XSELINUX
-extern void XSELinuxExtensionInit(INITARGS);
+extern void SELinuxExtensionInit(INITARGS);
 #endif
 #ifdef XPRINT
 extern void XpExtensionInit(INITARGS);
@@ -606,7 +606,7 @@ InitExtensions(argc, argv)
     if (!noSecurityExtension) SecurityExtensionInit();
 #endif
 #ifdef XSELINUX
-    XSELinuxExtensionInit();
+    SELinuxExtensionInit();
 #endif
 #ifdef XPRINT
     XpExtensionInit(); /* server-specific extension, cannot be disabled */
@@ -703,7 +703,7 @@ static ExtensionModule staticExtensions[] = {
     { SecurityExtensionInit, SECURITY_EXTENSION_NAME, &noSecurityExtension, NULL, NULL },
 #endif
 #ifdef XSELINUX
-    { XSELinuxExtensionInit, XSELINUX_EXTENSION_NAME, NULL, NULL, NULL },
+    { SELinuxExtensionInit, SELINUX_EXTENSION_NAME, NULL, NULL, NULL },
 #endif
 #ifdef XPRINT
     { XpExtensionInit, XP_PRINTNAME, NULL, NULL, NULL },
commit f4bc333fc1e8d9fa9911771d2072df4df741c553
Author: Eamon Walsh <ewalsh at tycho.nsa.gov>
Date:   Fri Dec 28 11:56:54 2007 -0500

    xselinux: don't FatalError on an invalid class mapping, just disable support.

diff --git a/Xext/xselinux.c b/Xext/xselinux.c
index d7c7322..f3a8457 100644
--- a/Xext/xselinux.c
+++ b/Xext/xselinux.c
@@ -1376,15 +1376,20 @@ XSELinuxExtensionInit(INITARGS)
 
     /* Setup SELinux stuff */
     if (!is_selinux_enabled()) {
-        ErrorF("XSELinux: Extension failed to load: SELinux not enabled\n");
+        ErrorF("XSELinux: SELinux not enabled, disabling SELinux support.\n");
         return;
     }
 
     selinux_set_callback(SELINUX_CB_LOG, (union selinux_callback)SELinuxLog);
     selinux_set_callback(SELINUX_CB_AUDIT, (union selinux_callback)SELinuxAudit);
 
-    if (selinux_set_mapping(map) < 0)
+    if (selinux_set_mapping(map) < 0) {
+	if (errno == EINVAL) {
+	    ErrorF("XSELinux: Invalid object class mapping, disabling SELinux support.\n");
+	    return;
+	}
 	FatalError("XSELinux: Failed to set up security class mapping\n");
+    }
 
     if (avc_open(NULL, 0) < 0)
 	FatalError("XSELinux: Couldn't initialize SELinux userspace AVC\n");
commit f3780ece528ed3ead809ba6a388fa0f8aab2a775
Author: Eamon Walsh <ewalsh at tycho.nsa.gov>
Date:   Thu Dec 20 20:32:07 2007 -0500

    xselinux: Implement swapped protocol request logic.

diff --git a/Xext/xselinux.c b/Xext/xselinux.c
index bbd8d1a..d7c7322 100644
--- a/Xext/xselinux.c
+++ b/Xext/xselinux.c
@@ -1199,68 +1199,81 @@ SProcSELinuxSetSelectionManager(ClientPtr client)
 }
 
 static int
-SProcSELinuxGetSelectionManager(ClientPtr client)
-{
-    return ProcSELinuxGetSelectionManager(client);
-}
-
-static int
 SProcSELinuxSetDeviceCreateContext(ClientPtr client)
 {
-    return ProcSELinuxSetDeviceCreateContext(client);
-}
+    REQUEST(SELinuxSetCreateContextReq);
+    int n;
 
-static int
-SProcSELinuxGetDeviceCreateContext(ClientPtr client)
-{
-    return ProcSELinuxGetDeviceCreateContext(client);
+    REQUEST_AT_LEAST_SIZE(SELinuxSetCreateContextReq);
+    swaps(&stuff->context_len,n);
+    return ProcSELinuxSetDeviceCreateContext(client);
 }
 
 static int
 SProcSELinuxSetDeviceContext(ClientPtr client)
 {
+    REQUEST(SELinuxSetContextReq);
+    int n;
+
+    REQUEST_AT_LEAST_SIZE(SELinuxSetContextReq);
+    swapl(&stuff->id,n);
+    swaps(&stuff->context_len,n);
     return ProcSELinuxSetDeviceContext(client);
 }
 
 static int
 SProcSELinuxGetDeviceContext(ClientPtr client)
 {
+    REQUEST(SELinuxGetContextReq);
+    int n;
+
+    REQUEST_SIZE_MATCH(SELinuxGetContextReq);
+    swapl(&stuff->id,n);
     return ProcSELinuxGetDeviceContext(client);
 }
 
 static int
 SProcSELinuxSetPropertyCreateContext(ClientPtr client)
 {
-    return ProcSELinuxSetPropertyCreateContext(client);
-}
+    REQUEST(SELinuxSetCreateContextReq);
+    int n;
 
-static int
-SProcSELinuxGetPropertyCreateContext(ClientPtr client)
-{
-    return ProcSELinuxGetPropertyCreateContext(client);
+    REQUEST_AT_LEAST_SIZE(SELinuxSetCreateContextReq);
+    swaps(&stuff->context_len,n);
+    return ProcSELinuxSetPropertyCreateContext(client);
 }
 
 static int
 SProcSELinuxGetPropertyContext(ClientPtr client)
 {
+    REQUEST(SELinuxGetPropertyContextReq);
+    int n;
+
+    REQUEST_SIZE_MATCH(SELinuxGetPropertyContextReq);
+    swapl(&stuff->window,n);
+    swapl(&stuff->property,n);
     return ProcSELinuxGetPropertyContext(client);
 }
 
 static int
 SProcSELinuxSetWindowCreateContext(ClientPtr client)
 {
-    return ProcSELinuxSetWindowCreateContext(client);
-}
+    REQUEST(SELinuxSetCreateContextReq);
+    int n;
 
-static int
-SProcSELinuxGetWindowCreateContext(ClientPtr client)
-{
-    return ProcSELinuxGetWindowCreateContext(client);
+    REQUEST_AT_LEAST_SIZE(SELinuxSetCreateContextReq);
+    swaps(&stuff->context_len,n);
+    return ProcSELinuxSetWindowCreateContext(client);
 }
 
 static int
 SProcSELinuxGetWindowContext(ClientPtr client)
 {
+    REQUEST(SELinuxGetContextReq);
+    int n;
+
+    REQUEST_SIZE_MATCH(SELinuxGetContextReq);
+    swapl(&stuff->id,n);
     return ProcSELinuxGetWindowContext(client);
 }
 
@@ -1278,11 +1291,11 @@ SProcSELinuxDispatch(ClientPtr client)
     case X_SELinuxSetSelectionManager:
 	return SProcSELinuxSetSelectionManager(client);
     case X_SELinuxGetSelectionManager:
-    	return SProcSELinuxGetSelectionManager(client);
+    	return ProcSELinuxGetSelectionManager(client);
     case X_SELinuxSetDeviceCreateContext:
     	return SProcSELinuxSetDeviceCreateContext(client);
     case X_SELinuxGetDeviceCreateContext:
-    	return SProcSELinuxGetDeviceCreateContext(client);
+    	return ProcSELinuxGetDeviceCreateContext(client);
     case X_SELinuxSetDeviceContext:
     	return SProcSELinuxSetDeviceContext(client);
     case X_SELinuxGetDeviceContext:
@@ -1290,13 +1303,13 @@ SProcSELinuxDispatch(ClientPtr client)
     case X_SELinuxSetPropertyCreateContext:
     	return SProcSELinuxSetPropertyCreateContext(client);
     case X_SELinuxGetPropertyCreateContext:
-    	return SProcSELinuxGetPropertyCreateContext(client);
+    	return ProcSELinuxGetPropertyCreateContext(client);
     case X_SELinuxGetPropertyContext:
     	return SProcSELinuxGetPropertyContext(client);
     case X_SELinuxSetWindowCreateContext:
     	return SProcSELinuxSetWindowCreateContext(client);
     case X_SELinuxGetWindowCreateContext:
-    	return SProcSELinuxGetWindowCreateContext(client);
+    	return ProcSELinuxGetWindowCreateContext(client);
     case X_SELinuxGetWindowContext:
     	return SProcSELinuxGetWindowContext(client);
     default:
commit 1bbf64ab115e2a1121d6f9c0830b1b977f025178
Author: Eamon Walsh <ewalsh at tycho.nsa.gov>
Date:   Thu Dec 20 20:31:34 2007 -0500

    xselinux: Remove unnecessary structure definition.

diff --git a/Xext/xselinux.h b/Xext/xselinux.h
index ebcc4aa..9800d5a 100644
--- a/Xext/xselinux.h
+++ b/Xext/xselinux.h
@@ -139,20 +139,6 @@ typedef struct {
 } SELinuxGetContextReq;
 
 typedef struct {
-    CARD8   type;
-    CARD8   pad1;
-    CARD16  sequenceNumber;
-    CARD32  length;
-    CARD16  context_len;
-    CARD16  pad2;
-    CARD32  pad3;
-    CARD32  pad4;
-    CARD32  pad5;
-    CARD32  pad6;
-    CARD32  pad7;
-} SELinuxGetContextReply;
-
-typedef struct {
     CARD8   reqType;
     CARD8   SELinuxReqType;
     CARD16  length;
@@ -172,7 +158,7 @@ typedef struct {
     CARD32  pad5;
     CARD32  pad6;
     CARD32  pad7;
-} SELinuxGetPropertyContextReply;
+} SELinuxGetContextReply;
 
 
 /* Private Flask definitions */
commit 938da5ee389975f910721f1c2cebc2dcec793117
Author: Adam Jackson <ajax at redhat.com>
Date:   Fri Dec 28 12:23:44 2007 -0500

    Add HDMI and DisplayPort connector types.

diff --git a/hw/xfree86/modes/xf86Crtc.c b/hw/xfree86/modes/xf86Crtc.c
index e00fdf3..10db862 100644
--- a/hw/xfree86/modes/xf86Crtc.c
+++ b/hw/xfree86/modes/xf86Crtc.c
@@ -2192,9 +2192,12 @@ xf86OutputGetEDID (xf86OutputPtr output, I2CBusPtr pDDCBus)
     return mon;
 }
 
-static char *_xf86ConnectorNames[] = { "None", "VGA", "DVI-I", "DVI-D",
-				      "DVI-A", "Composite", "S-Video",
-				      "Component", "LFP", "Proprietary" };
+static char *_xf86ConnectorNames[] = {
+					"None", "VGA", "DVI-I", "DVI-D",
+					"DVI-A", "Composite", "S-Video",
+					"Component", "LFP", "Proprietary",
+					"HDMI", "DisplayPort",
+				     };
 _X_EXPORT char *
 xf86ConnectorGetName(xf86ConnectorType connector)
 {
diff --git a/hw/xfree86/modes/xf86Crtc.h b/hw/xfree86/modes/xf86Crtc.h
index f312b30..62d85bb 100644
--- a/hw/xfree86/modes/xf86Crtc.h
+++ b/hw/xfree86/modes/xf86Crtc.h
@@ -61,7 +61,9 @@ typedef enum _xf86ConnectorType {
    XF86ConnectorSvideo,
    XF86ConnectorComponent,
    XF86ConnectorLFP,
-   XF86ConnectorProprietary
+   XF86ConnectorProprietary,
+   XF86ConnectorHDMI,
+   XF86ConnectorDisplayPort,
 } xf86ConnectorType;
 
 typedef enum _xf86OutputStatus {
commit 24105cf6582201a94bc39aeac5a795297018aeb5
Author: Daniel Stone <daniel at fooishbar.org>
Date:   Fri Dec 28 15:49:50 2007 +0200

    Input: Don't reinit devices
    
    If a device is already initialised (i.e. the virtual core devices) during
    IASD, don't init them again.  This fixes a leak.

diff --git a/dix/devices.c b/dix/devices.c
index adf2fba..534a0b9 100644
--- a/dix/devices.c
+++ b/dix/devices.c
@@ -469,7 +469,8 @@ InitAndStartDevices(void)
 
     for (dev = inputInfo.off_devices; dev; dev = dev->next) {
         DebugF("(dix) initialising device %d\n", dev->id);
-	ActivateDevice(dev);
+        if (!dev->inited)
+            ActivateDevice(dev);
     }
     for (dev = inputInfo.off_devices; dev; dev = next)
     {
commit 941058f8da0d725f909dc97f68c32ce244a9dc0a
Author: Daniel Stone <daniel at fooishbar.org>
Date:   Fri Dec 28 15:48:57 2007 +0200

    KDrive: Xephyr: Don't leak screen damage structure

diff --git a/hw/kdrive/ephyr/ephyr.c b/hw/kdrive/ephyr/ephyr.c
index a4d995c..2a762a2 100644
--- a/hw/kdrive/ephyr/ephyr.c
+++ b/hw/kdrive/ephyr/ephyr.c
@@ -402,6 +402,7 @@ ephyrUnsetInternalDamage (ScreenPtr pScreen)
   
   pPixmap = (*pScreen->GetScreenPixmap) (pScreen);
   DamageUnregister (&pPixmap->drawable, scrpriv->pDamage);
+  DamageDestroy (scrpriv->pDamage);
   
   RemoveBlockAndWakeupHandlers (ephyrInternalDamageBlockHandler,
 				ephyrInternalDamageWakeupHandler,
commit b2f6cd290c43b88f0d08fb29f8657618a067d2a0
Author: Daniel Stone <daniel at fooishbar.org>
Date:   Fri Dec 28 15:48:25 2007 +0200

    OS: Don't leak connection translation table on regeneration

diff --git a/os/connection.c b/os/connection.c
index 3b5742c..8b6541c 100644
--- a/os/connection.c
+++ b/os/connection.c
@@ -353,7 +353,8 @@ InitConnectionLimits(void)
 #endif
 
 #if !defined(WIN32)
-    ConnectionTranslation = (int *)xnfalloc(sizeof(int)*(lastfdesc + 1));
+    if (!ConnectionTranslation)
+        ConnectionTranslation = (int *)xnfalloc(sizeof(int)*(lastfdesc + 1));
 #else
     InitConnectionTranslation();
 #endif
commit 190a0506243b39cd8dfc0e12068e3a3f416330f1
Author: Daniel Stone <daniel at fooishbar.org>
Date:   Fri Dec 28 15:47:57 2007 +0200

    Config: HAL: Don't leak options on failure to add device
    
    This showed up in Xephyr in particular, which denies new device requests.

diff --git a/config/hal.c b/config/hal.c
index af96fc2..4ab2961 100644
--- a/config/hal.c
+++ b/config/hal.c
@@ -92,6 +92,8 @@ add_option(InputOption **options, const char *key, const char *value)
     for (; *options; options = &(*options)->next)
         ;
     *options = xcalloc(sizeof(**options), 1);
+    if (!*options) /* Yeesh. */
+        return;
     (*options)->key = xstrdup(key);
     (*options)->value = xstrdup(value);
     (*options)->next = NULL;
@@ -156,7 +158,7 @@ device_added(LibHalContext *hal_ctx, const char *udi)
     char *path = NULL, *driver = NULL, *name = NULL, *xkb_rules = NULL;
     char *xkb_model = NULL, *xkb_layout = NULL, *xkb_variant = NULL;
     char *xkb_options = NULL, *config_info = NULL;
-    InputOption *options = NULL;
+    InputOption *options = NULL, *tmpo = NULL;
     DeviceIntPtr dev;
     DBusError error;
     int type = TYPE_NONE;
@@ -234,6 +236,7 @@ device_added(LibHalContext *hal_ctx, const char *udi)
 
     if (NewInputDeviceRequest(options, &dev) != Success) {
         DebugF("[config/hal] NewInputDeviceRequest failed\n");
+        dev = NULL;
         goto unwind;
     }
 
@@ -259,6 +262,12 @@ unwind:
         xfree(xkb_options);
     if (config_info)
         xfree(config_info);
+    while (!dev && (tmpo = options)) {
+        options = tmpo->next;
+        xfree(tmpo->key);
+        xfree(tmpo->value);
+        xfree(tmpo);
+    }
 
 out_error:
     dbus_error_free(&error);
commit f44fd3f9e41bf467360ace93ef5b532d8f61fb2c
Author: Daniel Stone <daniel at fooishbar.org>
Date:   Fri Dec 28 15:47:21 2007 +0200

    Config: D-Bus: Don't leak timers
    
    TimerCancel doesn't free the timer: you need TimerFree for that.

diff --git a/config/dbus-core.c b/config/dbus-core.c
index eab72a5..9cf1530 100644
--- a/config/dbus-core.c
+++ b/config/dbus-core.c
@@ -76,7 +76,7 @@ teardown(void)
     struct config_dbus_core_hook *hook;
 
     if (bus_info.timer) {
-        TimerCancel(bus_info.timer);
+        TimerFree(bus_info.timer);
         bus_info.timer = NULL;
     }
 
@@ -116,6 +116,8 @@ message_filter(DBusConnection *connection, DBusMessage *message, void *data)
         bus_info.connection = NULL;
         teardown();
 
+        if (bus_info.timer)
+            TimerFree(bus_info.timer);
         bus_info.timer = TimerSet(NULL, 0, 1, reconnect_timer, NULL);
 
         return DBUS_HANDLER_RESULT_HANDLED;
@@ -186,6 +188,7 @@ static CARD32
 reconnect_timer(OsTimerPtr timer, CARD32 time, pointer arg)
 {
     if (connect_to_bus()) {
+        TimerFree(bus_info.timer);
         bus_info.timer = NULL;
         return 0;
     }


More information about the xorg-commit mailing list