xserver: Branch 'server-1.10-branch' - 36 commits

Jeremy Huddleston jeremyhu at kemper.freedesktop.org
Wed Jan 18 11:44:36 PST 2012


 Xext/saver.c                            |    3 -
 Xext/shm.c                              |    2 -
 Xext/xace.c                             |    4 ++
 Xext/xselinux_ext.c                     |    6 ---
 Xext/xvdisp.c                           |    4 +-
 Xi/exevents.c                           |    2 -
 Xi/extinit.c                            |    4 +-
 Xi/xichangehierarchy.c                  |   15 ++++++++
 Xi/xipassivegrab.c                      |   10 ++++-
 config/hal.c                            |    1 
 configure.ac                            |    8 +---
 dix/devices.c                           |    4 ++
 dix/dixutils.c                          |    7 +---
 hw/dmx/examples/Makefile.am             |   56 ++++++++++++++++----------------
 hw/dmx/glxProxy/compsize.c              |    1 
 hw/dmx/glxProxy/compsize.h              |   51 +++++++++++++++++++++++++++++
 hw/dmx/glxProxy/g_renderswap.c          |    1 
 hw/dmx/glxProxy/glxcmds.c               |    2 +
 hw/dmx/glxProxy/glxcmds.h               |   37 +++++++++++++++++++++
 hw/dmx/glxProxy/glxcmdsswap.c           |    3 +
 hw/kdrive/linux/keyboard.c              |    6 +--
 hw/kdrive/linux/ms.c                    |    4 +-
 hw/kdrive/linux/ps2.c                   |    4 +-
 hw/kdrive/src/kinput.c                  |    6 ---
 hw/vfb/InitOutput.c                     |    6 ++-
 hw/xfree86/common/xf86VidMode.c         |    3 +
 hw/xfree86/common/xf86Xinput.c          |   11 +++---
 hw/xfree86/dri2/dri2.c                  |   17 ++++++++-
 hw/xfree86/dri2/dri2ext.c               |    3 +
 hw/xfree86/fbdevhw/fbdevhw.c            |   18 +++++-----
 hw/xfree86/loader/loadmod.c             |    2 -
 hw/xfree86/modes/xf86Crtc.c             |   41 ++++++++++-------------
 hw/xfree86/modes/xf86EdidModes.c        |    5 ++
 hw/xfree86/os-support/linux/lnx_video.c |    8 ++--
 hw/xfree86/vbe/vbe.c                    |    5 ++
 hw/xfree86/xaa/xaaGC.c                  |    1 
 hw/xquartz/bundle/Info.plist.cpp        |    8 ++--
 mi/mibitblt.c                           |    2 -
 miext/rootless/rootlessScreen.c         |    4 +-
 os/backtrace.c                          |    6 ++-
 xfixes/cursor.c                         |    4 +-
 41 files changed, 264 insertions(+), 121 deletions(-)

New commits:
commit f70ee729518fc9bda78b810e550a2f9995fef782
Author: Jeremy Huddleston <jeremyhu at apple.com>
Date:   Wed Jan 18 11:43:56 2012 -0800

    XQuartz: Bump bundle version to 2.6.4
    
    Signed-off-by: Jeremy Huddleston <jeremyhu at apple.com>

diff --git a/hw/xquartz/bundle/Info.plist.cpp b/hw/xquartz/bundle/Info.plist.cpp
index 8873118..c2569a3 100644
--- a/hw/xquartz/bundle/Info.plist.cpp
+++ b/hw/xquartz/bundle/Info.plist.cpp
@@ -19,9 +19,9 @@
 	<key>CFBundlePackageType</key>
 		<string>APPL</string>
 	<key>CFBundleShortVersionString</key>
-		<string>2.6.3</string>
+		<string>2.6.4</string>
 	<key>CFBundleVersion</key>
-		<string>2.6.3</string>
+		<string>2.6.4</string>
 	<key>CFBundleSignature</key>
 		<string>x11a</string>
 	<key>CSResourcesFileMapped</key>
@@ -37,9 +37,9 @@
 	<key>LSApplicationCategoryType</key>
 		<string>public.app-category.utilities</string>
 	<key>NSHumanReadableCopyright</key>
-		<string>© 2003-2011 Apple Inc.
+		<string>© 2003-2012 Apple Inc.
 © 2003 XFree86 Project, Inc.
-© 2003-2011 X.org Foundation, Inc.
+© 2003-2012 X.org Foundation, Inc.
 </string>
 	<key>NSMainNibFile</key>
 		<string>main</string>
commit 2f2b48074bc182474101fbaa19a6d11aa04f26fe
Author: Zhigang Gong <zhigang.gong at linux.intel.com>
Date:   Wed Jan 4 07:01:19 2012 +0000

    mi/mibitblt: Fix an overflow bug of bit shift.
    
    When depth equal to 32 and planeMask equal to 0, the overflow will
    occur and cause the pixmap can't be cleared. There are some test
    cases in XTS hit this bug, and this fix can eliminate the corresponding
    failures.
    
    Signed-off-by: Zhigang Gong <zhigang.gong at linux.intel.com>
    Reviewed-by: Adam Jackson <ajax at redhat.com>
    Signed-off-by: Keith Packard <keithp at keithp.com>
    (cherry picked from commit f4956faab9ccf9aba6cf9603f4489f5dad19a347)

diff --git a/mi/mibitblt.c b/mi/mibitblt.c
index 49e17bd..6e00557 100644
--- a/mi/mibitblt.c
+++ b/mi/mibitblt.c
@@ -648,7 +648,7 @@ miGetImage( DrawablePtr pDraw, int sx, int sy, int w, int h,
     depth = pDraw->depth;
     if(format == ZPixmap)
     {
-	if ( (((1<<depth)-1)&planeMask) != (1<<depth)-1 )
+	if ( (((1LL<<depth)-1)&planeMask) != (1LL<<depth)-1 )
 	{
 	    ChangeGCVal gcv;
 	    xPoint pt;
commit b3d380f18559ec423130a20244c108b17b4753ef
Author: Adam Jackson <ajax at redhat.com>
Date:   Tue Dec 13 21:23:12 2011 -0500

    dix: Tune dixLookupDrawable for success
    
    The vast vast vast majority of resource lookups are successful.  Move some
    work to the error paths so we don't punish success.
    
    Before:
    40000000 trep @   0.0009 msec (1109091.3/sec): PutImage 10x10 square
    60000000 trep @   0.0005 msec (2072652.2/sec): ShmPutImage 10x10 square
    
    After:
    40000000 trep @   0.0009 msec (1148346.9/sec): PutImage 10x10 square
    60000000 trep @   0.0005 msec (2091666.1/sec): ShmPutImage 10x10 square
    
    Reviewed-by: Alan Coopersmith <alan.coopersmith at oracle.com>
    Signed-off-by: Adam Jackson <ajax at redhat.com>
    (cherry picked from commit 8f9bdfd293ad8e45755efe8d764b4dcc2a724f51)

diff --git a/dix/dixutils.c b/dix/dixutils.c
index 104363b..7f16811 100644
--- a/dix/dixutils.c
+++ b/dix/dixutils.c
@@ -202,13 +202,12 @@ dixLookupDrawable(DrawablePtr *pDraw, XID id, ClientPtr client,
     int rc;
 
     *pDraw = NULL;
-    client->errorValue = id;
-
-    if (id == INVALID)
-	return BadDrawable;
 
     rc = dixLookupResourceByClass((pointer *)&pTmp, id, RC_DRAWABLE, client, access);
 
+    if (rc != Success)
+	client->errorValue = id;
+
     if (rc == BadValue)
 	return BadDrawable;
     if (rc != Success)
commit 800e2d1e724cbf4bbb1ab0b487c681ffce9a93f2
Author: Adam Jackson <ajax at redhat.com>
Date:   Tue Dec 13 21:00:05 2011 -0500

    xace: ricer tuning for XaceHook
    
    gcc doesn't want to hoist the check for XaceHooks[hook] != NULL above the
    varargs code for some reason, so do it ourselves.
    
    Before:
    40000000 trep @   0.0010 msec (1050420.2/sec): PutImage 10x10 square
    60000000 trep @   0.0005 msec (1921147.6/sec): ShmPutImage 10x10 square
    
    After:
    40000000 trep @   0.0009 msec (1087458.5/sec): PutImage 10x10 square
    60000000 trep @   0.0005 msec (2012238.6/sec): ShmPutImage 10x10 square
    
    Reviewed-by: Alan Coopersmith <alan.coopersmith at oracle.com>
    Signed-off-by: Adam Jackson <ajax at redhat.com>
    (cherry picked from commit 11977fab546da35d579ebe285e3c26864007805e)

diff --git a/Xext/xace.c b/Xext/xace.c
index c757cad..ef69fe3 100644
--- a/Xext/xace.c
+++ b/Xext/xace.c
@@ -101,6 +101,10 @@ int XaceHook(int hook, ...)
     } u;
     int *prv = NULL;	/* points to return value from callback */
     va_list ap;		/* argument list */
+
+    if (!XaceHooks[hook])
+	return Success;
+
     va_start(ap, hook);
 
     /* Marshal arguments for passing to callback.
commit f12ec33ae058ebf850d17c28f21411372db2c8f0
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date:   Tue Jan 3 10:45:45 2012 +1000

    xfree86: split warning about missing identifier or input driver
    
    Check for identifier first and bail if it's missing (also remove the current
    identifier check after we've already bailed due to missing identifiers)
    
    If a driver is missing, warn but also say that we may have added this device
    already. I see too many bugreports with incorrectly shortened log files.
    
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
    Reviewed-by: Cyril Brulebois <kibi at debian.org>
    (cherry picked from commit 75953ccb9e9e5f1dbbaa44c714716a0049e22aae)
    (cherry picked from commit a3b6ecc893e17028cfbe16d8d7981c9037fc0766)

diff --git a/hw/xfree86/common/xf86Xinput.c b/hw/xfree86/common/xf86Xinput.c
index 579ee09..328036f 100644
--- a/hw/xfree86/common/xf86Xinput.c
+++ b/hw/xfree86/common/xf86Xinput.c
@@ -920,15 +920,16 @@ NewInputDeviceRequest (InputOption *options, InputAttributes *attrs,
         pInfo->attrs = DuplicateInputAttributes(attrs);
     }
 
-    if (!pInfo->driver || !pInfo->name) {
-        xf86Msg(X_INFO, "No input driver/identifier specified (ignoring)\n");
+    if (!pInfo->name) {
+        xf86Msg(X_INFO, "No identifier specified, ignoring this device.\n");
         rval = BadRequest;
         goto unwind;
     }
 
-    if (!pInfo->name) {
-        xf86Msg(X_ERROR, "No device identifier specified (ignoring)\n");
-        rval = BadMatch;
+    if (!pInfo->driver) {
+        xf86Msg(X_INFO, "No input driver specified, ignoring this device.\n");
+        xf86Msg(X_INFO, "This device may have been added with another device file.\n");
+        rval = BadRequest;
         goto unwind;
     }
 
commit d395749a4eb8c34189600ca34cb66f65803e462e
Author: Julien Cristau <jcristau at debian.org>
Date:   Fri Dec 30 20:41:25 2011 +0100

    os: don't ignore failure from dladdr
    
    If dladdr returns 0, don't go and use the returned Dl_info, it may
    contain garbage.
    
    X.Org bug#44315 <https://bugs.freedesktop.org/show_bug.cgi?id=44315>
    
    Reported-and-tested-by: Cyril Brulebois <kibi at debian.org>
    Reviewed-by: Jeremy Huddleston <jeremyhu at apple.com>
    Reviewed-by: Cyril Brulebois <kibi at debian.org>
    Signed-off-by: Julien Cristau <jcristau at debian.org>
    (cherry picked from commit 6269977c91071e0ea16ca5b4b8e15fd6db0b6fcf)
    (cherry picked from commit 4a339afc586d55a9a248b893f007219d79c72600)

diff --git a/os/backtrace.c b/os/backtrace.c
index 7ca6dab..f3255c7 100644
--- a/os/backtrace.c
+++ b/os/backtrace.c
@@ -44,7 +44,11 @@ void xorg_backtrace(void)
     ErrorF("\nBacktrace:\n");
     size = backtrace(array, 64);
     for (i = 0; i < size; i++) {
-	dladdr(array[i], &info);
+	int rc = dladdr(array[i], &info);
+	if (rc == 0) {
+	    ErrorF("%d: ?? [%p]\n", i, array[i]);
+	    continue;
+	}
 	mod = (info.dli_fname && *info.dli_fname) ? info.dli_fname : "(vdso)";
 	if (info.dli_saddr)
 	    ErrorF("%d: %s (%s+0x%lx) [%p]\n", i, mod,
commit 977ea84992657abe17b372578c5952c0b6d54c1f
Author: Carlos Garnacho <carlosg at gnome.org>
Date:   Tue Dec 13 15:41:23 2011 +0100

    Xi: assign correct grab_mode/other_device_mode in XI2 passive grabs
    
    CreateGrab() expects the keyboard mode to be stored in grab_mode, and the
    pointer mode in other_device_mode, so respect this in passive XI2 grabs,
    and switch modes if needed.
    
    Signed-off-by: Carlos Garnacho <carlosg at gnome.org>
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
    Reviewed-by: Chase Douglas <chase.douglas at canonical.com>
    (cherry picked from commit 5b169cb695bd450d7f64e3800f00c9237ee67f96)

diff --git a/Xi/xipassivegrab.c b/Xi/xipassivegrab.c
index 762bedb..4064481 100644
--- a/Xi/xipassivegrab.c
+++ b/Xi/xipassivegrab.c
@@ -140,11 +140,17 @@ ProcXIPassiveGrabDevice(ClientPtr client)
     memset(&param, 0, sizeof(param));
     param.grabtype = GRABTYPE_XI2;
     param.ownerEvents = stuff->owner_events;
-    param.this_device_mode = stuff->grab_mode;
-    param.other_devices_mode = stuff->paired_device_mode;
     param.grabWindow = stuff->grab_window;
     param.cursor = stuff->cursor;
 
+    if (IsKeyboardDevice(dev)) {
+        param.this_device_mode = stuff->grab_mode;
+        param.other_devices_mode = stuff->paired_device_mode;
+    } else {
+        param.this_device_mode = stuff->paired_device_mode;
+        param.other_devices_mode = stuff->grab_mode;
+    }
+
     if (stuff->cursor != None)
     {
         status = dixLookupResourceByType(&tmp, stuff->cursor,
commit 4b39a4be114284f32ad73f4e6cce4d0a2e6300ce
Author: Alan Coopersmith <alan.coopersmith at oracle.com>
Date:   Thu Dec 8 21:52:07 2011 -0800

    Change disable_clientpointer return type to void
    
    It doesn't return anything, nor does it's caller expect it to.
    
    Fixes Solaris Studio compiler error:
    "xichangehierarchy.c", line 214: Function has no return statement : disable_clientpointer
    
    Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
    Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>
    Signed-off-by: Keith Packard <keithp at keithp.com>
    (cherry picked from commit 372a6f10dc2d74d2d179e8b92449e9b8636a99ef)

diff --git a/Xi/xichangehierarchy.c b/Xi/xichangehierarchy.c
index 8514846..b581969 100644
--- a/Xi/xichangehierarchy.c
+++ b/Xi/xichangehierarchy.c
@@ -200,7 +200,7 @@ unwind:
     return rc;
 }
 
-static int
+static void
 disable_clientpointer(DeviceIntPtr dev)
 {
     int i;
commit 13fb5212633b3442b98ddb8079a3776510865559
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date:   Wed Nov 9 15:31:10 2011 +1000

    Xext: don't swap CARD8 in SProcSELinuxQueryVersion
    
    xselinux_ext.c: In function 'SELinuxSendItemsToClient':
    xselinux_ext.c:340:16: warning: unused variable 'n' [-Wunused-variable]
    xselinux_ext.c: In function 'SProcSELinuxQueryVersion':
    xselinux_ext.c:532:62: error: call to 'wrong_size' declared with attribute
    error: wrong sized variable passed to swap
    xselinux_ext.c:533:62: error: call to 'wrong_size' declared with attribute
    error: wrong sized variable passed to swap
    
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
    Reviewed-by: Julien Cristau <jcristau at debian.org>
    (cherry picked from commit bb4aa1f263ad38c175bfda3b7e6c325260ce3f28)
    
    Conflicts:
    
    	Xext/xselinux_ext.c
    (cherry picked from commit cf296f2eeffe4b438e9378268f84a1f63c555e52)

diff --git a/Xext/xselinux_ext.c b/Xext/xselinux_ext.c
index 374571c..85ca2dc 100644
--- a/Xext/xselinux_ext.c
+++ b/Xext/xselinux_ext.c
@@ -528,12 +528,6 @@ ProcSELinuxDispatch(ClientPtr client)
 static int
 SProcSELinuxQueryVersion(ClientPtr client)
 {
-    REQUEST(SELinuxQueryVersionReq);
-    int n;
-
-    REQUEST_SIZE_MATCH(SELinuxQueryVersionReq);
-    swaps(&stuff->client_major, n);
-    swaps(&stuff->client_minor, n);
     return ProcSELinuxQueryVersion(client);
 }
 
commit 0eef22676bf87cca3bd145d7d266d891089d7552
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date:   Tue Nov 29 16:15:37 2011 +1000

    Xi: when removing a device, reset ClientPointers where needed
    
    if a client had the to-be-removed device as ClientPointer, reset to NULL.
    
    Fixes #43165
    
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
    Reviewed-by: Jeremy Huddleston <jeremyhu at apple.com>
    (cherry picked from commit d2ebbcdaf6b13d70eee704b1764ff349e1be22a0)

diff --git a/Xi/xichangehierarchy.c b/Xi/xichangehierarchy.c
index 15eb5c9..8514846 100644
--- a/Xi/xichangehierarchy.c
+++ b/Xi/xichangehierarchy.c
@@ -201,6 +201,19 @@ unwind:
 }
 
 static int
+disable_clientpointer(DeviceIntPtr dev)
+{
+    int i;
+
+    for (i = 0; i < currentMaxClients; i++)
+    {
+        ClientPtr client = clients[i];
+        if (client && client->clientPtr == dev)
+            client->clientPtr = NULL;
+    }
+}
+
+static int
 remove_master(ClientPtr client, xXIRemoveMasterInfo *r,
               int flags[MAXDEVICES])
 {
@@ -250,6 +263,8 @@ remove_master(ClientPtr client, xXIRemoveMasterInfo *r,
     if (rc != Success)
         goto unwind;
 
+    disable_clientpointer(ptr);
+
     /* Disabling sends the devices floating, reattach them if
      * desired. */
     if (r->return_mode == XIAttachToMaster)
commit 85ee512bd573ea613054d167dc0039d8b017ff66
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date:   Wed Nov 30 09:06:06 2011 +1000

    xfixes: don't dereference a NULL cursor
    
    If the new cursor is the NULL cursor, don't dereference it and use zeros
    instead.
    
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
    Reviewed-by: Jeremy Huddleston <jeremyhu at apple.com>
    (cherry picked from commit 1ab50be938524dcd4a9e56d27e3b96a27c2db2c0)

diff --git a/xfixes/cursor.c b/xfixes/cursor.c
index fb608f6..6e07f4f 100644
--- a/xfixes/cursor.c
+++ b/xfixes/cursor.c
@@ -165,9 +165,9 @@ CursorDisplayCursor (DeviceIntPtr pDev,
 		ev.type = XFixesEventBase + XFixesCursorNotify;
 		ev.subtype = XFixesDisplayCursorNotify;
 		ev.window = e->pWindow->drawable.id;
-		ev.cursorSerial = pCursor->serialNumber;
+		ev.cursorSerial = pCursor ? pCursor->serialNumber : 0;
 		ev.timestamp = currentTime.milliseconds;
-		ev.name = pCursor->name;
+		ev.name = pCursor ? pCursor->name : None;
 		WriteEventsToClient (e->pClient, 1, (xEvent *) &ev);
 	    }
 	}
commit 9e0f777b7b8855068f0702dd19f0358a2c214cd4
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date:   Fri Dec 16 09:15:25 2011 -0500

    dmx: force -fno-strict-aliasing for xinput example
    
    Compiler warning:
    xinput.c:272: warning: dereferencing pointer 'e' does break strict-aliasing
    rules
    
    The code itself is the usual XInput client-side code:
            XEvent event;
            XDeviceMotionEvent *e = (XDeviceMotionEvent *)&event;
            XNextEvent(display, &event);
            printf("%d\n", e->type);
    
    Since XDeviceMotionEvent is not guaranteed the same size as XEvent, clients
    must use pointer aliasing as above when using the XNextEvent API. Disable
    strict aliasing for this example.
    
    Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>
    Reviewed-by: Gaetan Nadon <memsize at videotron.ca>
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
    Signed-off-by: Gaetan Nadon <memsize at videotron.ca>
    Signed-off-by: Keith Packard <keithp at keithp.com>
    (cherry picked from commit 3aca8199405cff5097ee5813605ec78b5ae44a43)

diff --git a/hw/dmx/examples/Makefile.am b/hw/dmx/examples/Makefile.am
index 229bb57..d055ddc 100644
--- a/hw/dmx/examples/Makefile.am
+++ b/hw/dmx/examples/Makefile.am
@@ -10,60 +10,60 @@ bin_PROGRAMS = \
 noinst_PROGRAMS = xinput xtest evi res xled xbell $(EV_PROG)
 
 dmxinfo_SOURCES = dmxinfo.c
-dmxinfo_LDADD = @DMXEXAMPLES_DEP_LIBS@
-dmxinfo_CFLAGS = @DMXEXAMPLES_DEP_CFLAGS@
+dmxinfo_LDADD = $(DMXEXAMPLES_DEP_LIBS)
+dmxinfo_CFLAGS = $(DMXEXAMPLES_DEP_CFLAGS) $(CWARNFLAGS)
 
 dmxwininfo_SOURCES = dmxwininfo.c
-dmxwininfo_LDADD = @DMXXMUEXAMPLES_DEP_LIBS@
-dmxwininfo_CFLAGS = @DMXXMUEXAMPLES_DEP_CFLAGS@
+dmxwininfo_LDADD = $(DMXXMUEXAMPLES_DEP_LIBS)
+dmxwininfo_CFLAGS = $(DMXXMUEXAMPLES_DEP_CFLAGS) $(CWARNFLAGS)
 
 dmxreconfig_SOURCES = dmxreconfig.c
-dmxreconfig_LDADD = @DMXEXAMPLES_DEP_LIBS@
-dmxreconfig_CFLAGS = @DMXEXAMPLES_DEP_CFLAGS@
+dmxreconfig_LDADD = $(DMXEXAMPLES_DEP_LIBS)
+dmxreconfig_CFLAGS = $(DMXEXAMPLES_DEP_CFLAGS) $(CWARNFLAGS)
 
 dmxresize_SOURCES = dmxresize.c
-dmxresize_LDADD = @DMXEXAMPLES_DEP_LIBS@
-dmxresize_CFLAGS = @DMXEXAMPLES_DEP_CFLAGS@
+dmxresize_LDADD = $(DMXEXAMPLES_DEP_LIBS)
+dmxresize_CFLAGS = $(DMXEXAMPLES_DEP_CFLAGS) $(CWARNFLAGS)
 
 dmxaddscreen_SOURCES = dmxaddscreen.c
-dmxaddscreen_LDADD = @DMXEXAMPLES_DEP_LIBS@
-dmxaddscreen_CFLAGS = @DMXEXAMPLES_DEP_CFLAGS@
+dmxaddscreen_LDADD = $(DMXEXAMPLES_DEP_LIBS)
+dmxaddscreen_CFLAGS = $(DMXEXAMPLES_DEP_CFLAGS) $(CWARNFLAGS)
 
 dmxrmscreen_SOURCES = dmxrmscreen.c
-dmxrmscreen_LDADD = @DMXEXAMPLES_DEP_LIBS@
-dmxrmscreen_CFLAGS = @DMXEXAMPLES_DEP_CFLAGS@
+dmxrmscreen_LDADD = $(DMXEXAMPLES_DEP_LIBS)
+dmxrmscreen_CFLAGS = $(DMXEXAMPLES_DEP_CFLAGS) $(CWARNFLAGS)
 
 dmxaddinput_SOURCES = dmxaddinput.c
-dmxaddinput_LDADD = @DMXEXAMPLES_DEP_LIBS@
-dmxaddinput_CFLAGS = @DMXEXAMPLES_DEP_CFLAGS@
+dmxaddinput_LDADD = $(DMXEXAMPLES_DEP_LIBS)
+dmxaddinput_CFLAGS = $(DMXEXAMPLES_DEP_CFLAGS) $(CWARNFLAGS)
 
 dmxrminput_SOURCES = dmxrminput.c
-dmxrminput_LDADD = @DMXEXAMPLES_DEP_LIBS@
-dmxrminput_CFLAGS = @DMXEXAMPLES_DEP_CFLAGS@
+dmxrminput_LDADD = $(DMXEXAMPLES_DEP_LIBS)
+dmxrminput_CFLAGS = $(DMXEXAMPLES_DEP_CFLAGS) $(CWARNFLAGS)
 
 xinput_SOURCES = xinput.c
-xinput_LDADD = @DMXXIEXAMPLES_DEP_LIBS@
-xinput_CFLAGS = @DMXXIEXAMPLES_DEP_CFLAGS@
+xinput_LDADD = $(DMXXIEXAMPLES_DEP_LIBS)
+xinput_CFLAGS = $(DMXXIEXAMPLES_DEP_CFLAGS) $(CWARNFLAGS)
 
 xtest_SOURCES = xtest.c
-xtest_LDADD = @XTSTEXAMPLES_DEP_LIBS@
-xtest_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@
+xtest_LDADD = $(XTSTEXAMPLES_DEP_LIBS)
+xtest_CFLAGS = $(XTSTEXAMPLES_DEP_CFLAGS) $(CWARNFLAGS)
 
 evi_SOURCES = evi.c
-evi_LDADD = @X11EXAMPLES_DEP_LIBS@
-evi_CFLAGS = @X11EXAMPLES_DEP_CFLAGS@
+evi_LDADD = $(X11EXAMPLES_DEP_LIBS)
+evi_CFLAGS = $(X11EXAMPLES_DEP_CFLAGS) $(CWARNFLAGS)
 
 res_SOURCES = res.c
-res_LDADD = @XRESEXAMPLES_DEP_LIBS@
-res_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@
+res_LDADD = $(XRESEXAMPLES_DEP_LIBS)
+res_CFLAGS = $(XRESEXAMPLES_DEP_CFLAGS) $(CWARNFLAGS)
 
 xled_SOURCES = xled.c
-xled_LDADD = @X11EXAMPLES_DEP_LIBS@
-xled_CFLAGS = @X11EXAMPLES_DEP_CFLAGS@
+xled_LDADD = $(X11EXAMPLES_DEP_LIBS)
+xled_CFLAGS = $(X11EXAMPLES_DEP_CFLAGS) $(CWARNFLAGS)
 
 xbell_SOURCES = xbell.c
-xbell_LDADD = @X11EXAMPLES_DEP_LIBS@
-xbell_CFLAGS = @X11EXAMPLES_DEP_CFLAGS@
+xbell_LDADD = $(X11EXAMPLES_DEP_LIBS)
+xbell_CFLAGS = $(X11EXAMPLES_DEP_CFLAGS) $(CWARNFLAGS)
 
 ev_SOURCES = ev.c
 ev_LDADD = 
commit 836573bd2f7c1789ee147aea37bd711bc425e044
Author: Julien Cristau <jcristau at debian.org>
Date:   Sat Nov 5 13:00:07 2011 +0100

    Fix ShmPutImage for XYBitmap
    
    We can't call CopyArea in that case because the image has depth 1, which
    might not match the target drawable, so we might overrun the shm
    segment.  Commit 11817a881cb93a89788105d1e575a468f2a8d27c apparently
    fixed a similar bug for XYPixmap, but missed the bitmap case.
    
    Fixes: http://bugs.debian.org/629611
    
    Thanks to Alan Curry for diagnosing this and providing a test case.
    
    Reported-and-tested-by: Alan Curry <pacman at kosh.dhis.org>
    Reviewed-by: Peter Harris <pharris at opentext.com>
    Signed-off-by: Julien Cristau <jcristau at debian.org>
    (cherry picked from commit 08ec4da6a7617637914bee1636858474213cf39d)

diff --git a/Xext/shm.c b/Xext/shm.c
index d9469ea..31621ff 100644
--- a/Xext/shm.c
+++ b/Xext/shm.c
@@ -482,7 +482,7 @@ doShmPutImage(DrawablePtr dst, GCPtr pGC,
 {
     PixmapPtr pPixmap;
 
-    if (format == ZPixmap || depth == 1) {
+    if (format == ZPixmap || (format == XYPixmap && depth == 1)) {
 	pPixmap = GetScratchPixmapHeader(dst->pScreen, w, h, depth,
 					 BitsPerPixel(depth),
 					 PixmapBytePad(w, depth),
commit 1ee6e300bd76636b8b4ab73fb5477178734adafd
Author: Jeremy Huddleston <jeremyhu at apple.com>
Date:   Sat Dec 17 12:56:59 2011 -0800

    kdrive/linux: Fix compilation with -Werror=int-to-pointer-cast -Werror=pointer-to-int-cast
    
    Reported-by: Arkadiusz Miśkiewicz <arekm at maven.pl>
    Signed-off-by: Jeremy Huddleston <jeremyhu at apple.com>
    Reviewed-by: Jamey Sharp <jamey at minilop.net>
    (cherry picked from commit 1deede3c48d5ac91f50774c79f02afc6e036614e)

diff --git a/hw/kdrive/linux/keyboard.c b/hw/kdrive/linux/keyboard.c
index e05c5ab..a6e8fe7 100644
--- a/hw/kdrive/linux/keyboard.c
+++ b/hw/kdrive/linux/keyboard.c
@@ -692,7 +692,7 @@ LinuxKeyboardEnable (KdKeyboardInfo *ki)
         return !Success;
 
     fd = LinuxConsoleFd;
-    ki->driverPrivate = (void *) fd;
+    ki->driverPrivate = (void *) (intptr_t) fd;
 
     ioctl (fd, KDGKBMODE, &LinuxKbdTrans);
     tcgetattr (fd, &LinuxTermios);
@@ -724,7 +724,7 @@ LinuxKeyboardDisable (KdKeyboardInfo *ki)
     if (!ki)
         return;
 
-    fd = (int) ki->driverPrivate;
+    fd = (int) (intptr_t) ki->driverPrivate;
 
     KdUnregisterFd(ki, fd, FALSE);
     ioctl(fd, KDSKBMODE, LinuxKbdTrans);
@@ -753,7 +753,7 @@ LinuxKeyboardLeds (KdKeyboardInfo *ki, int leds)
     if (!ki)
         return;
 
-    ioctl ((int)ki->driverPrivate, KDSETLED, leds & 7);
+    ioctl ((int)(intptr_t)ki->driverPrivate, KDSETLED, leds & 7);
 }
 
 KdKeyboardDriver LinuxKeyboardDriver = {
diff --git a/hw/kdrive/linux/ms.c b/hw/kdrive/linux/ms.c
index b6151cd..176e125 100644
--- a/hw/kdrive/linux/ms.c
+++ b/hw/kdrive/linux/ms.c
@@ -152,7 +152,7 @@ MsEnable (KdPointerInfo *pi)
     }
     if (KdRegisterFd (port, MsRead, pi))
 	return TRUE;
-    pi->driverPrivate = (void *)port;
+    pi->driverPrivate = (void *)(intptr_t)port;
 
     return Success;
 
@@ -164,7 +164,7 @@ MsEnable (KdPointerInfo *pi)
 static void
 MsDisable (KdPointerInfo *pi)
 {
-    KdUnregisterFd (pi, (int)pi->driverPrivate, TRUE);
+    KdUnregisterFd (pi, (int)(intptr_t)pi->driverPrivate, TRUE);
 }
 
 static void
diff --git a/hw/kdrive/linux/ps2.c b/hw/kdrive/linux/ps2.c
index 552a3c7..40793ba 100644
--- a/hw/kdrive/linux/ps2.c
+++ b/hw/kdrive/linux/ps2.c
@@ -159,7 +159,7 @@ Ps2Enable (KdPointerInfo *pi)
         return BadAlloc;
     }
 
-    pi->driverPrivate = (void *)fd;
+    pi->driverPrivate = (void *)(intptr_t)fd;
 
     return Success;
 }
@@ -168,7 +168,7 @@ Ps2Enable (KdPointerInfo *pi)
 static void
 Ps2Disable (KdPointerInfo *pi)
 {
-    KdUnregisterFd (pi, (int)pi->driverPrivate, TRUE);
+    KdUnregisterFd (pi, (int)(intptr_t)pi->driverPrivate, TRUE);
 }
 
 static void
commit 723eab982a8371e7bb92f5a55c06b1adcb0a0257
Author: Jeremy Huddleston <jeremyhu at apple.com>
Date:   Sat Dec 17 12:25:26 2011 -0800

    configure.ac: Make Xephyr dependency error message more informative
    
    Signed-off-by: Jeremy Huddleston <jeremyhu at apple.com>
    Reviewed-by: Jamey Sharp <jamey at minilop.net>
    (cherry picked from commit d0170d54c71fc761b8f1ae7a0e555dc2ca23cf9c)

diff --git a/configure.ac b/configure.ac
index 781a6b0..455c3db 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2073,12 +2073,10 @@ if test "$KDRIVE" = yes; then
         XEPHYR_REQUIRED_LIBS="$XEPHYR_REQUIRED_LIBS $LIBGL libdrm"
     fi
 
-    PKG_CHECK_MODULES(XEPHYR, $XEPHYR_REQUIRED_LIBS, [xephyr="yes"], [xephyr="no"])
     if test "x$XEPHYR" = xauto; then
-        XEPHYR=$xephyr
-    fi
-    if test "x$XEPHYR" = xyes && test "x$xephyr" = xno; then	
-        AC_MSG_ERROR([Xephyr dependencies missing])
+        PKG_CHECK_MODULES(XEPHYR, $XEPHYR_REQUIRED_LIBS, [XEPHYR="yes"], [XEPHYR="no"])
+    elif test "x$XEPHYR" = xyes ; then
+        PKG_CHECK_MODULES(XEPHYR, $XEPHYR_REQUIRED_LIBS)
     fi
 
     # Xephyr needs nanosleep() which is in librt on Solaris
commit 791d8ce5d8ab8c655f1d0cdb2ff631d8dea84ed1
Author: Dave Airlie <airlied at redhat.com>
Date:   Mon Nov 28 16:37:59 2011 +0000

    kdrive: drop screen crossing code.
    
    The only kdrive server we probably care about anymore is Xephyr,
    and this screen enable/disable code totally breaks it in multi-screen mode.
    
    When you are in one screen the other stops updating.
    
    Fixes https://bugzilla.redhat.com/show_bug.cgi?id=757457
    
    Signed-off-by: Dave Airlie <airlied at redhat.com>
    Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>
    (cherry picked from commit 98c4a888a4428789386c7c47cecc81933b5999ba)

diff --git a/hw/kdrive/src/kinput.c b/hw/kdrive/src/kinput.c
index 608f3a7..ac7ca78 100644
--- a/hw/kdrive/src/kinput.c
+++ b/hw/kdrive/src/kinput.c
@@ -2143,12 +2143,6 @@ KdCursorOffScreen(ScreenPtr *ppScreen, int *x, int *y)
 static void
 KdCrossScreen(ScreenPtr pScreen, Bool entering)
 {
-#ifndef XIPAQ
-    if (entering)
-	KdEnableScreen (pScreen);
-    else
-	KdDisableScreen (pScreen);
-#endif
 }
 
 int KdCurScreen;	/* current event screen */
commit 703885a2f4f4f8e53d89d9887cceb948e27dde7d
Author: Dave Airlie <airlied at redhat.com>
Date:   Thu Oct 20 10:48:26 2011 +0100

    hal: free tmp_val in one missing case
    
    Pointed out by coverity scan.
    
    Signed-off-by: Dave Airlie <airlied at redhat.com>
    Reviewed-by: Daniel Stone <daniel at fooishbar.org>
    (cherry picked from commit 8d3731a811e33e263920dd7c8ec63d02968cb56e)

diff --git a/config/hal.c b/config/hal.c
index 297520a..a4141d5 100644
--- a/config/hal.c
+++ b/config/hal.c
@@ -355,6 +355,7 @@ device_added(LibHalContext *hal_ctx, const char *udi)
                         if (!strcasecmp(tmp, ".options") && (!xkb_opts.options))
                             xkb_opts.options = strdup(tmp_val);
                     }
+                    free(tmp_val);
                 }
             }
         }
commit a10fbf00433cb9ad04a39b75ece6bc60096e21dd
Author: Dave Airlie <airlied at redhat.com>
Date:   Thu Oct 20 11:00:43 2011 +0100

    xv: test correct number of requests. (v2)
    
    Pointed out by coverity.
    
    v2: fix swapped as well, as pointed out by Alan
    
    Signed-off-by: Dave Airlie <airlied at redhat.com>
    Reviewed-by: Alan Coopersmith <alan.coopersmith at oracle.com>
    (cherry picked from commit 41229392b790f30a0f0ef1f4ed95647c5bca4001)

diff --git a/Xext/xvdisp.c b/Xext/xvdisp.c
index deddebd..72f7958 100644
--- a/Xext/xvdisp.c
+++ b/Xext/xvdisp.c
@@ -1265,7 +1265,7 @@ ProcXvDispatch(ClientPtr client)
 
   UpdateCurrentTime();
 
-  if (stuff->data > xvNumRequests) {
+  if (stuff->data >= xvNumRequests) {
     SendErrorToClient(client, XvReqCode, stuff->data, 0, BadRequest);
     return BadRequest;
   }
@@ -1589,7 +1589,7 @@ SProcXvDispatch(ClientPtr client)
 
   UpdateCurrentTime();
 
-  if (stuff->data > xvNumRequests) {
+  if (stuff->data >= xvNumRequests) {
     SendErrorToClient(client, XvReqCode, stuff->data, 0, BadRequest);
     return BadRequest;
   }
commit 500213c1ae1ba632e9878d920b8dc483a25496f1
Author: Dave Airlie <airlied at redhat.com>
Date:   Wed Oct 19 16:57:13 2011 +0100

    xaa: avoid possible freed pointer reuse in epilogue
    
    If the pGCPriv->flags == 2, then we try to assign the freed pGCPriv->XAAOps
    avoid this by clearing the flags in to be destroyed pGCPriv.
    
    Reported by coverity.
    
    Signed-off-by: Dave Airlie <airlied at redhat.com>
    Reviewed-by: Jeremy Huddleston <jeremyhu at apple.com>
    (cherry picked from commit 1049139499d9132a20cd6d4d156fe9da9cddb6c2)

diff --git a/hw/xfree86/xaa/xaaGC.c b/hw/xfree86/xaa/xaaGC.c
index 44d50e6..1bc35d9 100644
--- a/hw/xfree86/xaa/xaaGC.c
+++ b/hw/xfree86/xaa/xaaGC.c
@@ -239,6 +239,7 @@ XAADestroyGC(GCPtr pGC)
 	free(pGCPriv->XAAOps);
 
     free(pGCPriv->DashPattern);
+    pGCPriv->flags = 0;
 
     (*pGC->funcs->DestroyGC)(pGC);
     XAA_GC_FUNC_EPILOGUE (pGC);
commit bd449cc5dbed85e13bfede5faf75763d04f27541
Author: Dave Airlie <airlied at redhat.com>
Date:   Wed Oct 19 16:22:31 2011 +0100

    Xi: avoid overrun of callback array.
    
    This code had an off-by-one and would allow writing one past the end of
    the callbacks array.
    
    Pointed out by coverity.
    
    Signed-off-by: Dave Airlie <airlied at redhat.com>
    Reviewed-by: Jeremy Huddleston <jeremyhu at apple.com>
    (cherry picked from commit 682c09a2cedd234b005334cc01247d859dd7f26a)

diff --git a/Xi/extinit.c b/Xi/extinit.c
index 7f09dfe..c29e123 100644
--- a/Xi/extinit.c
+++ b/Xi/extinit.c
@@ -411,7 +411,7 @@ static int
 ProcIDispatch(ClientPtr client)
 {
     REQUEST(xReq);
-    if (stuff->data > ARRAY_SIZE(ProcIVector) || !ProcIVector[stuff->data])
+    if (stuff->data >= ARRAY_SIZE(ProcIVector) || !ProcIVector[stuff->data])
         return BadRequest;
 
     return (*ProcIVector[stuff->data])(client);
@@ -430,7 +430,7 @@ static int
 SProcIDispatch(ClientPtr client)
 {
     REQUEST(xReq);
-    if (stuff->data > ARRAY_SIZE(SProcIVector) || !SProcIVector[stuff->data])
+    if (stuff->data >= ARRAY_SIZE(SProcIVector) || !SProcIVector[stuff->data])
         return BadRequest;
 
     return (*SProcIVector[stuff->data])(client);
commit 87efcf9c17eaba1da43a07b041b8715d632a2d7e
Author: Dave Airlie <airlied at redhat.com>
Date:   Wed Oct 19 16:21:26 2011 +0100

    xext: don't free uninitialised pointer when malloc fails. (v2)
    
    Initialise the pAttr->values to values so if the values allocation
    fails it just ends up as free(NULL).
    
    Pointed out by coverity.
    
    v2: use Alan's suggestion.
    
    Signed-off-by: Dave Airlie <airlied at redhat.com>
    Reviewed-by: Alan Coopersmith <alan.coopersmith at oracle.com>
    Reviewed-by: Jeremy Huddleston <jeremyhu at apple.com>
    (cherry picked from commit b62dc4fcbcffd10de16650bee284702c8608bb60)

diff --git a/Xext/saver.c b/Xext/saver.c
index 1888603..0f9e878 100644
--- a/Xext/saver.c
+++ b/Xext/saver.c
@@ -927,7 +927,7 @@ ScreenSaverSetAttributes (ClientPtr client)
 	goto bail;
     }
     /* over allocate for override redirect */
-    values = malloc((len + 1) * sizeof (unsigned long));
+    pAttr->values = values = malloc((len + 1) * sizeof (unsigned long));
     if (!values)
     {
 	ret = BadAlloc;
@@ -947,7 +947,6 @@ ScreenSaverSetAttributes (ClientPtr client)
     pAttr->pCursor = NullCursor;
     pAttr->pBackgroundPixmap = NullPixmap;
     pAttr->pBorderPixmap = NullPixmap;
-    pAttr->values = values;
     /*
      * go through the mask, checking the values,
      * looking up pixmaps and cursors and hold a reference
commit c672e2a110c54015fc858dca493db74b5dce4802
Author: Adam Jackson <ajax at redhat.com>
Date:   Thu Apr 28 13:34:28 2011 +1000

    fbdevhw: iterate over all modes that match a mode. (v3)
    
    So on RHEL5 anaconda sets an xorg.conf with a fixed 800x600 mode in it,
    we run radeonfb and fbdev since ati won't work in userspace due to domain
    issues in the older codebase.
    
    On certain pseries blades the built-in KVM can't accept an 800x600-43 mode,
    it requires the 800x600-60 mode, so we have to have the kernel radeonfb
    driver reject the 800x600-43 mode when it sees it. However then fbdev
    doesn't try any of the other 800x600 modes in the modelist, and we end up
    getting a default 640x480 mode we don't want.
    
    This patch changes the mode validation loop to continue on with the other modes
    that match to find one that works.
    
    v2: move code around to avoid extra loop, after comment from Jamey.
    v3: move loop setup back into loop as per Jeremy's review.
    
    Signed-off-by: Dave Airlie <airlied at redhat.com>
    Reviewed-by: Jamey Sharp <jamey at minilop.net>
    Reviewed-by: Jeremy Huddleston <jeremyhu at apple.com>
    (cherry picked from commit 22605effd188436629a0dbc688666549473741e4)

diff --git a/hw/xfree86/fbdevhw/fbdevhw.c b/hw/xfree86/fbdevhw/fbdevhw.c
index 17fba36..26abb3b 100644
--- a/hw/xfree86/fbdevhw/fbdevhw.c
+++ b/hw/xfree86/fbdevhw/fbdevhw.c
@@ -510,20 +510,22 @@ fbdevHWSetVideoModes(ScrnInfoPtr pScrn)
 	pScrn->virtualY = pScrn->display->virtualY;
 
 	for (modename = pScrn->display->modes; *modename != NULL; modename++) {
-		for (mode = pScrn->monitor->Modes; mode != NULL; mode = mode->next)
-			if (0 == strcmp(mode->name,*modename))
-				break;
+		for (mode = pScrn->monitor->Modes; mode != NULL; mode = mode->next) {
+			if (0 == strcmp(mode->name,*modename)) {
+				if (fbdevHWSetMode(pScrn, mode, TRUE))
+					break;
+
+				xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+					   "\tmode \"%s\" test failed\n", *modename);
+			}
+		}
+
 		if (NULL == mode) {
 			xf86DrvMsg(pScrn->scrnIndex, X_INFO,
 				   "\tmode \"%s\" not found\n", *modename);
 			continue;
 		}
 
-		if (!fbdevHWSetMode(pScrn, mode, TRUE)) {
-			xf86DrvMsg(pScrn->scrnIndex, X_INFO,
-				   "\tmode \"%s\" test failed\n", *modename);
-			continue;
-		}
 		xf86DrvMsg(pScrn->scrnIndex, X_INFO,
 			   "\tmode \"%s\" ok\n", *modename);
 
commit 7abd360638a4952919e1333e40cc4865087c94c9
Author: Alan Coopersmith <alan.coopersmith at oracle.com>
Date:   Thu Dec 1 23:45:42 2011 -0800

    LoaderOpen returns either a valid pointer or NULL, so don't check for < 0
    
    Fixes Sun cc warning that was recently elevated to error by the
    stricter default CFLAGS changes to xorg-macros:
    
    "loadmod.c", line 914: improper pointer/integer combination: op "<"
    
    Should have been changed when commit ab7f057ce9df4e905b12 changed the
    LoaderOpen return type from int to void *.
    
    Changes log message when file is found but dlopen() fails from:
     (EE) LoadModule: Module dbe does not have a dbeModuleData data object.
     (EE) Failed to load module "dbe" (invalid module, 0)
    to:
     (EE) Failed to load module "dbe" (loader failed, 7)
    
    Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
    Reviewed-by: Adam Jackson <ajax at redhat.com>
    (cherry picked from commit e4dcf580f007d6adcf5b0c639865d7aaab1a319d)

diff --git a/hw/xfree86/loader/loadmod.c b/hw/xfree86/loader/loadmod.c
index 46ce68b..370d56f 100644
--- a/hw/xfree86/loader/loadmod.c
+++ b/hw/xfree86/loader/loadmod.c
@@ -926,7 +926,7 @@ doLoadModule(const char *module, const char *path, const char **subdirlist,
 	goto LoadModule_fail;
     }
     ret->handle = LoaderOpen(found, errmaj, errmin);
-    if (ret->handle < 0)
+    if (ret->handle == NULL)
 	goto LoadModule_fail;
     ret->path = strdup(found);
 
commit de6f92513b29c9c48d98817d9c1aaae467aea614
Author: Alan Coopersmith <alan.coopersmith at oracle.com>
Date:   Wed Nov 23 00:30:02 2011 -0800

    Limit the number of screens Xvfb will attempt to allocate memory for
    
    Commit f9e3a2955d2ca7 removing the MAXSCREEN limit left the screen
    number too unlimited, and allowed any positive int for a screen number:
    
    Xvfb :1 -screen 2147483647 1024x1024x8
    
    Fatal server error:
    Not enough memory for screen 2147483647
    
    Found by Parfait 0.3.7:
    Error: Integer overflow (CWE 190)
       Integer parameter of memory allocation function realloc() may overflow due to multiplication with constant value 1112
            at line 293 of hw/vfb/InitOutput.c in function 'ddxProcessArgument'.
    
    Since the X11 connection setup only has a CARD8 for number of SCREENS,
    limit to 255 screens, which is also low enough to avoid overflow on the
    sizeof(*vfbScreens) * (screenNum + 1) calculation for realloc.
    
    Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
    Reviewed-by: Jamey Sharp <jamey at minilop.net>
    (cherry picked from commit feebf6746374aa04b12e9e3e51313a3a82c03530)

diff --git a/hw/vfb/InitOutput.c b/hw/vfb/InitOutput.c
index 49dfe48..95a4b0a 100644
--- a/hw/vfb/InitOutput.c
+++ b/hw/vfb/InitOutput.c
@@ -280,7 +280,9 @@ ddxProcessArgument(int argc, char *argv[], int i)
 	int screenNum;
 	CHECK_FOR_REQUIRED_ARGUMENTS(2);
 	screenNum = atoi(argv[i+1]);
-	if (screenNum < 0)
+	/* The protocol only has a CARD8 for number of screens in the
+	   connection setup block, so don't allow more than that. */
+	if ((screenNum < 0) || (screenNum >= 255))
 	{
 	    ErrorF("Invalid screen number %d\n", screenNum);
 	    UseMsg();
commit 8e82bde20d698e3fe5a9795fcdcdde1a0caf3feb
Author: Derek Buitenhuis <derek.buitenhuis at gmail.com>
Date:   Sun Nov 6 12:20:51 2011 -0500

    Fix vesa's VBE PanelID interpretation
    
    xserver's VESA driver's VBE (Vesa BIOS Extensions) code
    includes a PanelID probe, which can get a monitor's native
    resolution. From this, using CVT formulas, it derives
    horizontal sync rate and a vertical refresh rate ranges.
    
    It however, only derives the upper bounds of the ranges, and
    the lower bounds cannot de derived. By default, they are set
    to hardcoded constants which represent the lowest supported
    resolution: 640x480. The constants in vbe.c however, were
    not actually derived from forulas, but carried over from
    other code from the bad old days, and are not relevant
    to flat panel displays. This caused, for example, EEEPC701's
    panel, with a native resolution of 800x480, to end up with
    a upper bound of the horizontal sync rate that was lower
    than the hardcoded lower bound, which of course broke things.
    
    These numbers have been rederived using both my own CVT tool
    based on xf86CVTMode(), and using the provided 'cvt' tool
    that comes with xserver.
    
    Signed-off-by: Derek Buitenhuis <derek.buitenhuis at gmail.com>
    Reviewed-by: Adam Jackson <ajax at redhat.com>
    Signed-off-by: Keith Packard <keithp at keithp.com>
    (cherry picked from commit f0d50cc6651dce3a8a3cd3fb84210aa92b139763)

diff --git a/hw/xfree86/vbe/vbe.c b/hw/xfree86/vbe/vbe.c
index 04132d9..06a6284 100644
--- a/hw/xfree86/vbe/vbe.c
+++ b/hw/xfree86/vbe/vbe.c
@@ -1036,13 +1036,16 @@ VBEInterpretPanelID(int scrnIndex, struct vbePanelID *data)
     mode = xf86CVTMode(data->hsize, data->vsize, PANEL_HZ, 1, 0);
 
     pScrn->monitor->nHsync = 1;
-    pScrn->monitor->hsync[0].lo = 31.5;
+    pScrn->monitor->hsync[0].lo = 29.37;
     pScrn->monitor->hsync[0].hi = (float)mode->Clock / (float)mode->HTotal;
     pScrn->monitor->nVrefresh = 1;
     pScrn->monitor->vrefresh[0].lo = 56.0;
     pScrn->monitor->vrefresh[0].hi =
 	(float)mode->Clock*1000.0 / (float)mode->HTotal / (float)mode->VTotal;
 
+    if (pScrn->monitor->vrefresh[0].hi < 59.47)
+	pScrn->monitor->vrefresh[0].hi = 59.47;
+
     free(mode);
 }
 
commit df07ec2ef672e5222a58f79e033a8d55ba94552d
Author: Jeremy Huddleston <jeremyhu at apple.com>
Date:   Mon Nov 7 22:14:30 2011 +0000

    dmx: Build fix for -Werror=implicit-function-declaration
    
    Signed-off-by: Jeremy Huddleston <jeremyhu at apple.com>
    Reviewed-by: Alan Coopersmith <alan.coopersmith at oracle.com>
    Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
    (cherry picked from commit f405dfffe7d5db81d398615a80acbeba7e014ada)

diff --git a/hw/dmx/glxProxy/compsize.c b/hw/dmx/glxProxy/compsize.c
index 9a40d65..5a5d5d0 100644
--- a/hw/dmx/glxProxy/compsize.c
+++ b/hw/dmx/glxProxy/compsize.c
@@ -29,6 +29,7 @@
  */
 
 #include <GL/gl.h>
+#include "compsize.h"
 
 GLint __glFogiv_size(GLenum pname)
 {
diff --git a/hw/dmx/glxProxy/compsize.h b/hw/dmx/glxProxy/compsize.h
new file mode 100644
index 0000000..856c6f5
--- /dev/null
+++ b/hw/dmx/glxProxy/compsize.h
@@ -0,0 +1,51 @@
+/*
+ * Copyright 2011 Apple Inc.
+ *
+ * All Rights Reserved.
+ *
+ * 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, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the 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
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NON-INFRINGEMENT.  IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS
+ * 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.
+ */
+
+#ifndef __compsize_h__
+#define __compsize_h__
+
+extern GLint __glColorTableParameterfv_size(GLenum pname);
+extern GLint __glColorTableParameteriv_size(GLenum pname);
+extern GLint __glConvolutionParameterfv_size(GLenum pname);
+extern GLint __glConvolutionParameteriv_size(GLenum pname);
+extern GLint __glFogfv_size(GLenum pname);
+extern GLint __glFogiv_size(GLenum pname);
+extern GLint __glLightModelfv_size(GLenum pname);
+extern GLint __glLightModeliv_size(GLenum pname);
+extern GLint __glLightfv_size(GLenum pname);
+extern GLint __glLightiv_size(GLenum pname);
+extern GLint __glMaterialfv_size(GLenum pname);
+extern GLint __glMaterialiv_size(GLenum pname);
+extern GLint __glTexEnvfv_size(GLenum e);
+extern GLint __glTexEnviv_size(GLenum e);
+extern GLint __glTexGendv_size(GLenum e);
+extern GLint __glTexGenfv_size(GLenum e);
+extern GLint __glTexGeniv_size(GLenum e);
+extern GLint __glTexParameterfv_size(GLenum e);
+extern GLint __glTexParameteriv_size(GLenum e);
+
+#endif /* !__compsize_h__ */
diff --git a/hw/dmx/glxProxy/g_renderswap.c b/hw/dmx/glxProxy/g_renderswap.c
index e675696..e434a71 100644
--- a/hw/dmx/glxProxy/g_renderswap.c
+++ b/hw/dmx/glxProxy/g_renderswap.c
@@ -32,6 +32,7 @@
 #include "glxext.h"
 #include "g_disptab.h"
 #include "unpack.h"
+#include "compsize.h"
 
 void __glXDispSwap_CallList(GLbyte *pc)
 {
diff --git a/hw/dmx/glxProxy/glxcmds.c b/hw/dmx/glxProxy/glxcmds.c
index f79264e..3f21f65 100644
--- a/hw/dmx/glxProxy/glxcmds.c
+++ b/hw/dmx/glxProxy/glxcmds.c
@@ -52,6 +52,8 @@
 #include "glxvisuals.h"
 #include "glxswap.h"
 
+#include "glxcmds.h"
+
 #ifdef PANORAMIX
 #include "panoramiXsrv.h"
 #endif
diff --git a/hw/dmx/glxProxy/glxcmds.h b/hw/dmx/glxProxy/glxcmds.h
new file mode 100644
index 0000000..ae866be
--- /dev/null
+++ b/hw/dmx/glxProxy/glxcmds.h
@@ -0,0 +1,37 @@
+/*
+ * Copyright 2011 Apple Inc.
+ *
+ * All Rights Reserved.
+ *
+ * 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, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the 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
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NON-INFRINGEMENT.  IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS
+ * 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.
+ */
+
+#ifndef __GLX_cmds_h__
+#define __GLX_cmds_h__
+
+extern int __glXBindSwapBarrierSGIX(__GLXclientState *cl, GLbyte *pc);
+extern int __glXCreateContextWithConfigSGIX(__GLXclientState *cl, GLbyte *pc);
+extern int __glXJoinSwapGroupSGIX(__GLXclientState *cl, GLbyte *pc);
+extern int __glXMakeCurrentReadSGI(__GLXclientState *cl, GLbyte *pc);
+extern int __glXQueryMaxSwapBarriersSGIX(__GLXclientState *cl, GLbyte *pc);
+
+#endif /* !__GLX_cmds_h__ */
diff --git a/hw/dmx/glxProxy/glxcmdsswap.c b/hw/dmx/glxProxy/glxcmdsswap.c
index 2294059..f28a79d 100644
--- a/hw/dmx/glxProxy/glxcmdsswap.c
+++ b/hw/dmx/glxProxy/glxcmdsswap.c
@@ -35,11 +35,14 @@
 #include <pixmapstr.h>
 #include <windowstr.h>
 #include "unpack.h"
+#include "glxcmds.h"
 #include "glxext.h"
 #include "glxvendor.h"
 
 extern int glxIsExtensionSupported( char *ext );
 
+int __glXSwapGetFBConfigsSGIX(__GLXclientState *cl, GLbyte *pc);
+
 /************************************************************************/
 
 /*
commit 8f5595070150352a7bc20a55e94c9330a53135f4
Author: dtakahashi42 <dtakahashi42 at gmail.com>
Date:   Fri Nov 18 11:30:22 2011 -0800

    rootless: Fix a server crash when choosing a color with the gimp color wheel
    
    https://trac.macports.org/ticket/30927
    
    Signed-off-by: Jeremy Huddleston <jeremyhu at apple.com>
    Reviewed-by: Jeremy Huddleston <jeremyhu at apple.com>
    (cherry picked from commit 328074890eeb111950e984c6f618311983600b20)

diff --git a/miext/rootless/rootlessScreen.c b/miext/rootless/rootlessScreen.c
index 3211c0f..4099897 100644
--- a/miext/rootless/rootlessScreen.c
+++ b/miext/rootless/rootlessScreen.c
@@ -247,8 +247,8 @@ RootlessComposite(CARD8 op, PicturePtr pSrc, PicturePtr pMask, PicturePtr pDst,
     WindowPtr srcWin, dstWin, maskWin = NULL;
 
     if (pMask) {                        // pMask can be NULL
-        maskWin = (pMask->pDrawable->type == DRAWABLE_WINDOW) ?
-                  (WindowPtr)pMask->pDrawable :  NULL;
+        maskWin = (pMask->pDrawable && pMask->pDrawable->type == DRAWABLE_WINDOW) ?
+                  (WindowPtr)pMask->pDrawable : NULL;
     }
     srcWin  = (pSrc->pDrawable && pSrc->pDrawable->type  == DRAWABLE_WINDOW) ?
               (WindowPtr)pSrc->pDrawable  :  NULL;
commit 615c193a2e56587d77107ba4442561b791c93a9c
Author: Ross Burton <ross at linux.intel.com>
Date:   Wed Sep 28 11:46:02 2011 +0100

    edid: Add quirk for Acer Aspire One 110
    
    At least one revision of the AAO reports a 190x110mm maximum size but a
    451x113mm mode.
    
    X.Org Bug 41141 <https://bugs.freedesktop.org/show_bug.cgi?id=41141>
    
    Signed-off-by: Ross Burton <ross at linux.intel.com>
    Reviewed-by: Daniel Stone <daniel at fooishbar.org>
    Reviewed-by: Jeremy Huddleston <jeremyhu at apple.com>
    (cherry picked from commit 58864146fbdf1820d04825838691e84784ef91bc)

diff --git a/hw/xfree86/modes/xf86EdidModes.c b/hw/xfree86/modes/xf86EdidModes.c
index 9ff2f0d..86065f8 100644
--- a/hw/xfree86/modes/xf86EdidModes.c
+++ b/hw/xfree86/modes/xf86EdidModes.c
@@ -165,6 +165,11 @@ static Bool quirk_detailed_use_maximum_size (int scrnIndex, xf86MonPtr DDC)
 	DDC->vendor.prod_id == 6400)
 	return TRUE;
 
+    /* Bug #41141: Acer Aspire One */
+    if (memcmp (DDC->vendor.name, "LGD", 4) == 0 &&
+	DDC->vendor.prod_id == 0x7f01)
+	return TRUE;
+
     return FALSE;
 }
 
commit 564808beecd7052b0400e6f4b4bd30727bdf583a
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Thu Aug 25 16:04:04 2011 +0100

    dri2: Register the DRI2DrawableType after server regeneration
    
    The Resource database is reset upon regeneration and so the dri2 module
    needs to re-register its RESTYPE for the drawable or else it will
    clobber the next unsuspecting user of the database. Fortunately, DRI2 is
    loaded late in the initialisation sequence and was last up until
    xf86-video-intel started using the Resource database to track
    outstanding swaps...
    
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
    Reviewed-by: Jeremy Huddleston <jeremyhu at apple.com>
    Tested-by: Paulo Zanoni <paulo.r.zanoni at intel.com>
    (cherry picked from commit 34b0e4eee911f8b09a3682a7f1b4c8598ef48b8d)

diff --git a/hw/xfree86/dri2/dri2.c b/hw/xfree86/dri2/dri2.c
index 2b95ae2..2fd7ce7 100644
--- a/hw/xfree86/dri2/dri2.c
+++ b/hw/xfree86/dri2/dri2.c
@@ -1184,14 +1184,24 @@ DRI2CloseScreen(ScreenPtr pScreen)
 }
 
 extern ExtensionModule dri2ExtensionModule;
+extern Bool DRI2ModuleSetup(void);
+
+/* Called by InitExtensions() */
+Bool
+DRI2ModuleSetup(void)
+{
+    dri2DrawableRes = CreateNewResourceType(DRI2DrawableGone, "DRI2Drawable");
+    if (!dri2DrawableRes)
+	return FALSE;
+
+    return TRUE;
+}
 
 static pointer
 DRI2Setup(pointer module, pointer opts, int *errmaj, int *errmin)
 {
     static Bool setupDone = FALSE;
 
-    dri2DrawableRes = CreateNewResourceType(DRI2DrawableGone, "DRI2Drawable");
-
     if (!setupDone)
     {
 	setupDone = TRUE;
diff --git a/hw/xfree86/dri2/dri2ext.c b/hw/xfree86/dri2/dri2ext.c
index 4e48e65..5f00e37 100644
--- a/hw/xfree86/dri2/dri2ext.c
+++ b/hw/xfree86/dri2/dri2ext.c
@@ -50,6 +50,7 @@
 #include "xf86Module.h"
 
 static ExtensionEntry	*dri2Extension;
+extern Bool DRI2ModuleSetup(void);
 
 static Bool
 validDrawable(ClientPtr client, XID drawable, Mask access_mode,
@@ -637,6 +638,8 @@ DRI2ExtensionInit(void)
 				 StandardMinorOpcode);
 
     DRI2EventBase = dri2Extension->eventBase;
+
+    DRI2ModuleSetup();
 }
 
 extern Bool noDRI2Extension;
commit 165b8694a9d99b2ebf8a2e8e9cde46f6d9074d86
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Mon Jan 24 11:17:03 2011 +0000

    DRI2: Avoid a NULL pointer dereference
    
    Bugzilla:  https://bugs.freedesktop.org/show_bug.cgi?id=41211
    
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
    Reviewed-by: Jeremy Huddleston <jeremyhu at apple.com>
    (cherry picked from commit bfa1a0dd190ed88020d60eba3bb04681c8e83a68)

diff --git a/hw/xfree86/dri2/dri2.c b/hw/xfree86/dri2/dri2.c
index 10be599..2b95ae2 100644
--- a/hw/xfree86/dri2/dri2.c
+++ b/hw/xfree86/dri2/dri2.c
@@ -771,7 +771,8 @@ DRI2WaitSwap(ClientPtr client, DrawablePtr pDrawable)
     /* If we're currently waiting for a swap on this drawable, reset
      * the request and suspend the client.  We only support one
      * blocked client per drawable. */
-    if ((pPriv->swapsPending) &&
+    if (pPriv &&
+	pPriv->swapsPending &&
 	pPriv->blockedClient == NULL) {
 	ResetCurrentRequest(client);
 	client->sequence--;
commit f95ae43a799ad858a50d3c2420eac194ff469829
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Mon Jan 24 11:17:03 2011 +0000

    VidMode: prevent crash with no modes
    
    Bugzilla:  https://bugs.freedesktop.org/show_bug.cgi?id=17431
    
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
    Reviewed-by: Jeremy Huddleston <jeremyhu at apple.com>
    (cherry picked from commit eeb21a133b982f71de739baf62e53c8a68f5d495)

diff --git a/hw/xfree86/common/xf86VidMode.c b/hw/xfree86/common/xf86VidMode.c
index 4dd454d..2ae5484 100644
--- a/hw/xfree86/common/xf86VidMode.c
+++ b/hw/xfree86/common/xf86VidMode.c
@@ -221,6 +221,9 @@ VidModeGetFirstModeline(int scrnIndex, pointer *mode, int *dotClock)
 	return FALSE;
 
     pScrn = xf86Screens[scrnIndex];
+    if (pScrn->modes == NULL)
+	    return FALSE;
+
     pVidMode = VMPTR(pScrn->pScreen);
     pVidMode->First = pScrn->modes;
     pVidMode->Next =  pVidMode->First->next;
commit 783ba9d230f898e46b20ee21d1297824dfa899bb
Author: Jeremy Huddleston <jeremyhu at apple.com>
Date:   Tue Nov 1 14:59:15 2011 -0700

    xfree86: Fix powerpc build with -Werror=int-to-pointer-cast -Werror=pointer-to-int-cast
    
    memType is a uint64_t on powerpc. Using memType only really makes
    sense for *physical* addresses, which can be 64-bit for 32-bit
    systems running on 64-bit hardware.
    
    However, unmapVidMem() only deals with *virtual* addresses, which
    are guaranteed to fit into an uintptr_t.
    
    Signed-off-by: Jeremy Huddleston <jeremyhu at apple.com>
    Reviewed-by: Mark Kettenis <kettenis at openbsd.org>
    (cherry picked from commit eb3377ffb8a7baa26c9831e56ed782d48b28fa71)

diff --git a/hw/xfree86/os-support/linux/lnx_video.c b/hw/xfree86/os-support/linux/lnx_video.c
index 3d45511..468c621 100644
--- a/hw/xfree86/os-support/linux/lnx_video.c
+++ b/hw/xfree86/os-support/linux/lnx_video.c
@@ -469,11 +469,11 @@ mapVidMem(int ScreenNum, unsigned long Base, unsigned long Size, int flags)
 static void
 unmapVidMem(int ScreenNum, pointer Base, unsigned long Size)
 {
-    memType alignOff = (memType)Base 
-	- ((memType)Base & ~(getpagesize() - 1));
+    uintptr_t alignOff = (uintptr_t)Base
+	- ((uintptr_t)Base & ~(getpagesize() - 1));
 
-    DebugF("alignment offset: %lx\n",alignOff);
-    munmap((caddr_t)((memType)Base - alignOff), (Size + alignOff));
+    DebugF("alignment offset: %lx\n", (unsigned long)alignOff);
+    munmap((void *)((uintptr_t)Base - alignOff), (Size + alignOff));
 }
 
 
commit 6ded98becb1f1192062d4cb0f8cdf4ef0159a78b
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date:   Thu Oct 27 11:03:39 2011 +1000

    Xi: allow passive keygrabs on the XIAll(Master)Devices fake devices
    
    They don't have a KeyClassRec, but we must still allow passive grabs on
    them.
    
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
    Tested-by: Bastien Nocera <hadess at hadess.net>
    Reviewed-by: Daniel Stone <daniel at fooishbar.org>
    (cherry picked from commit 22715e465b415b3351b83b8279a4f44157f63199)
    (cherry picked from commit 2f2d871ccdfb256831ae487c5916054a3d29d126)

diff --git a/Xi/exevents.c b/Xi/exevents.c
index 9bd9d60..d214907 100644
--- a/Xi/exevents.c
+++ b/Xi/exevents.c
@@ -1483,7 +1483,7 @@ GrabKey(ClientPtr client, DeviceIntPtr dev, DeviceIntPtr modifier_device,
     rc = CheckGrabValues(client, param);
     if (rc != Success)
         return rc;
-    if (k == NULL)
+    if ((dev->id != XIAllDevices && dev->id != XIAllMasterDevices) && k == NULL)
 	return BadMatch;
     if (grabtype == GRABTYPE_XI)
     {
commit 0c4d7fca59f4d2076e26ddda5b4fd7e274b068a8
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date:   Mon Oct 24 12:00:32 2011 +1000

    dix: block signals when closing all devices
    
    When closing down all devices, we manually unset master for all attached
    devices, but the device's sprite info still points to the master's sprite
    info. This leaves us a window where the master is freed already but the
    device isn't yet. A signal during that window causes dereference of the
    already freed spriteInfo in mieqEnqueue's EnqueueScreen macro.
    
    Simply block signals when removing all devices. It's not like we're really
    worrying about high-responsive input at this stage.
    
    https://bugzilla.redhat.com/show_bug.cgi?id=737031
    
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
    Reviewed-by: Julien Cristau <jcristau at debian.org>
    (cherry picked from commit d7c44a7c9760449bef263413ad3b20f19b1dc95a)
    (cherry picked from commit 34bb83b9df20ff63dbb147ed661f39efb8bae8e4)

diff --git a/dix/devices.c b/dix/devices.c
index aa391a1..e8c4cf2 100644
--- a/dix/devices.c
+++ b/dix/devices.c
@@ -982,6 +982,8 @@ CloseDownDevices(void)
 {
     DeviceIntPtr dev;
 
+    OsBlockSignals();
+
     /* Float all SDs before closing them. Note that at this point resources
      * (e.g. cursors) have been freed already, so we can't just call
      * AttachDevice(NULL, dev, NULL). Instead, we have to forcibly set master
@@ -1004,6 +1006,8 @@ CloseDownDevices(void)
     inputInfo.keyboard = NULL;
     inputInfo.pointer = NULL;
     XkbDeleteRulesDflts();
+
+    OsReleaseSignals();
 }
 
 /**
commit cc9e3b3de7de30534bf72910838855b124d70ed6
Author: Christopher Yeleighton <giecrilj at stegny.2a.pl>
Date:   Mon Oct 24 18:47:06 2011 -0700

    Bug 38420: Xvfb crashes in miInitVisuals() when started with depth=2
    
    https://bugs.freedesktop.org/show_bug.cgi?id=38420
    
    Exit with fatal error message, not segfault.
    
    Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
    Reviewed-by: Jeremy Huddleston <jeremyhu at apple.com>
    Signed-off-by: Keith Packard <keithp at keithp.com>
    (cherry picked from commit 7d50211ab57a35910d79fc3f67ae89aff91fa995)
    (cherry picked from commit 97f2ae60fc0cc755abd8b88df826fcb1a20464fe)

diff --git a/hw/vfb/InitOutput.c b/hw/vfb/InitOutput.c
index 53f82f9..49dfe48 100644
--- a/hw/vfb/InitOutput.c
+++ b/hw/vfb/InitOutput.c
@@ -864,6 +864,8 @@ vfbScreenInit(int index, ScreenPtr pScreen, int argc, char **argv)
 				   (1 << DirectColor)),
 				  10, TrueColor, 0x3ff00000, 0x000ffc00, 0x000003ff);
 	break;
+    default:
+	return FALSE;
     }
 
     miSetPixmapDepths ();
commit 29dbb7c84ee382ecb40d8aaaa0d76b106c56c534
Author: Dave Airlie <airlied at redhat.com>
Date:   Thu Oct 20 14:43:01 2011 +0100

    xf86Crtc: handle no outputs with no modes harder.
    
    If you started an X server with no connected outputs, we pick a default
    1024x768 mode, however if you then ran an xvidmode using app against that
    server it would segfault the server due to not finding any valid modes.
    
    This was due to the no output mode set code, only adding the modes to the
    scrn->modes once, when something called randr 1.2 xf86SetScrnInfoModes would
    get called and remove all the modes and we'd end up with 0.
    
    This change fixes xf86SetScrnInfoModes to always report a scrn mode of at
    least 1024x768, and pushes the initial configuration to just call it instead
    of setting up the mode itself.
    
    Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=746926
    
    I've seen other bugs like this on other distros so it might also actually fix them.
    
    Signed-off-by: Dave Airlie <airlied at redhat.com>
    Reviewed-by: Keith Packard <keithp at keithp.com>
    Signed-off-by: Keith Packard <keithp at keithp.com>
    (cherry picked from commit 17416e88dcfcc584fe5f87580d5d2b719b3521c3)

diff --git a/hw/xfree86/modes/xf86Crtc.c b/hw/xfree86/modes/xf86Crtc.c
index 3fae039..28c905b 100644
--- a/hw/xfree86/modes/xf86Crtc.c
+++ b/hw/xfree86/modes/xf86Crtc.c
@@ -1915,19 +1915,25 @@ xf86SetScrnInfoModes (ScrnInfoPtr scrn)
 		break;
     }
 
-    if (scrn->modes != NULL) {
-	/* For some reason, scrn->modes is circular, unlike the other mode
-	 * lists.  How great is that?
-	 */
-	for (last = scrn->modes; last && last->next; last = last->next)
-	    ;
-	last->next = scrn->modes;
-	scrn->modes->prev = last;
-	if (mode) {
-	    while (scrn->modes != mode)
-		scrn->modes = scrn->modes->next;
-	}
+    if (!scrn->modes) {
+	scrn->modes = xf86ModesAdd(scrn->modes,
+				   xf86CVTMode(scrn->display->virtualX,
+					       scrn->display->virtualY,
+					       60, 0, 0));
+    }
+
+    /* For some reason, scrn->modes is circular, unlike the other mode
+     * lists.  How great is that?
+     */
+    for (last = scrn->modes; last && last->next; last = last->next)
+	;
+    last->next = scrn->modes;
+    scrn->modes->prev = last;
+    if (mode) {
+	while (scrn->modes != mode)
+	    scrn->modes = scrn->modes->next;
     }
+
     scrn->currentMode = scrn->modes;
 #ifdef XFreeXDGA
     if (scrn->pScreen)
@@ -2514,16 +2520,7 @@ xf86InitialConfiguration (ScrnInfoPtr scrn, Bool canGrow)
 			      width, height);
     }
 
-    if (have_outputs) {
-	/* Mirror output modes to scrn mode list */
-	xf86SetScrnInfoModes (scrn);
-    } else {
-	/* Clear any existing modes from scrn->modes */
-	while (scrn->modes != NULL)
-	    xf86DeleteMode(&scrn->modes, scrn->modes);
-	scrn->modes = xf86ModesAdd(scrn->modes,
-				   xf86CVTMode(width, height, 60, 0, 0));
-    }
+    xf86SetScrnInfoModes (scrn);
 
     success = TRUE;
  bailout:


More information about the xorg-commit mailing list