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

Jeremy Huddleston jeremyhu at freedesktop.org
Thu Sep 20 22:03:12 PDT 2012


 config/udev.c                           |   16 ++++-
 configure.ac                            |    6 +-
 dix/dispatch.c                          |    4 +
 hw/xfree86/common/xf86.h                |    1 
 hw/xfree86/common/xf86Bus.c             |   19 +-----
 hw/xfree86/common/xf86Configure.c       |   27 ---------
 hw/xfree86/common/xf86Events.c          |   11 +++
 hw/xfree86/common/xf86Init.c            |   27 +++++----
 hw/xfree86/common/xf86Priv.h            |    1 
 hw/xfree86/common/xf86platformBus.c     |    6 +-
 hw/xfree86/dri2/dri2.c                  |   74 +++++++++++++++-----------
 hw/xfree86/modes/xf86Crtc.c             |    5 -
 hw/xfree86/os-support/linux/lnx_video.c |   89 +++++++++++++++++---------------
 hw/xquartz/xpr/dri.c                    |    6 ++
 hw/xquartz/xpr/xprFrame.c               |   28 ++++++++++
 include/hotplug.h                       |    2 
 test/signal-logging.c                   |    4 -
 17 files changed, 189 insertions(+), 137 deletions(-)

New commits:
commit a55ccb7e8f80992e985694a5ec40b5aa72526d39
Author: Jeremy Huddleston Sequoia <jeremyhu at apple.com>
Date:   Thu Sep 20 21:11:21 2012 -0700

    XQuartz: Add some verbose logging to debug xp_lock_window being unbalanced
    
    Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu at apple.com>

diff --git a/hw/xquartz/xpr/xprFrame.c b/hw/xquartz/xpr/xprFrame.c
index 01f1def..aad375b 100644
--- a/hw/xquartz/xpr/xprFrame.c
+++ b/hw/xquartz/xpr/xprFrame.c
@@ -49,6 +49,10 @@
 #include <pthread.h>
 #endif
 
+#ifdef DEBUG_XP_LOCK_WINDOW
+#include <execinfo.h>
+#endif
+
 #define DEFINE_ATOM_HELPER(func, atom_name)                      \
     static Atom func(void) {                                       \
         static int generation;                                      \
@@ -376,6 +380,18 @@ xprStartDrawing(RootlessFrameID wid, char **pixelData, int *bytesPerRow)
     unsigned int rowbytes[2];
     xp_error err;
 
+#ifdef DEBUG_XP_LOCK_WINDOW
+    void* callstack[128];
+    int i, frames = backtrace(callstack, 128);
+    char** strs = backtrace_symbols(callstack, frames);
+
+    ErrorF("=== LOCK %d ===\n", (int)x_cvt_vptr_to_uint(wid));
+    for (i = 0; i < frames; ++i) {
+        ErrorF("    %s\n", strs[i]);
+    }
+    free(strs);
+#endif
+
     err = xp_lock_window(x_cvt_vptr_to_uint(
                              wid), NULL, NULL, data, rowbytes, NULL);
     if (err != Success)
@@ -395,6 +411,18 @@ xprStopDrawing(RootlessFrameID wid, Bool flush)
 {
     xp_error err;
 
+#ifdef DEBUG_XP_LOCK_WINDOW
+    void* callstack[128];
+    int i, frames = backtrace(callstack, 128);
+    char** strs = backtrace_symbols(callstack, frames);
+
+    ErrorF("=== UNLOCK %d ===\n", (int)x_cvt_vptr_to_uint(wid));
+    for (i = 0; i < frames; ++i) {
+        ErrorF("    %s\n", strs[i]);
+    }
+    free(strs);
+#endif
+
     err = xp_unlock_window(x_cvt_vptr_to_uint(wid), flush);
     /* This should be a FatalError, but we started tripping over it.  Make it a
      * FatalError after http://xquartz.macosforge.org/trac/ticket/482 is fixed.
commit b6b4287a1db26f75e88f53486c91bfefeb7726fd
Author: Jeremy Huddleston Sequoia <jeremyhu at apple.com>
Date:   Thu Sep 20 21:49:40 2012 -0700

    XQuartz: Avoid a possible deadlock with DRI on OS X 10.7.5 and OS X 10.8.2
    
    <rdar://problem/12338921>
    http://bugs.winehq.org/show_bug.cgi?id=31751
    
    Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu at apple.com>

diff --git a/hw/xquartz/xpr/dri.c b/hw/xquartz/xpr/dri.c
index 03af163..4fa4aa8 100644
--- a/hw/xquartz/xpr/dri.c
+++ b/hw/xquartz/xpr/dri.c
@@ -64,6 +64,7 @@
 #include "mi.h"
 #include "mipointer.h"
 #include "rootless.h"
+#include "rootlessCommon.h"
 #include "x-hash.h"
 #include "x-hook.h"
 #include "driWrap.h"
@@ -385,6 +386,11 @@ DRICreateSurface(ScreenPtr pScreen, Drawable id,
 
         if (NULL == pDRIDrawablePriv)
             return FALSE;  /*error*/
+
+        /* <rdar://problem/12338921>
+         * http://bugs.winehq.org/show_bug.cgi?id=31751
+         */
+        RootlessStopDrawing((WindowPtr)pDrawable, FALSE);
     }
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
     else if (pDrawable->type == DRAWABLE_PIXMAP) {
commit d01921ec18c21f21d377b60626cc2d3418b84a7c
Merge: 70e5766 245e7e0
Author: Keith Packard <keithp at keithp.com>
Date:   Thu Sep 20 17:26:48 2012 +0200

    Merge remote-tracking branch 'ajax/ioperm'

commit 245e7e0361b18766583ae391a2ac1231bb1a1f84
Author: Adam Jackson <ajax at redhat.com>
Date:   Tue Jun 26 14:32:31 2012 -0400

    xfree86: Change the semantics of driverFunc(GET_REQUIRED_HW_INTERFACES)
    
    This is a really awkward interface, since we're calling it well before
    the driver knows what device it's going to drive.  Drivers with both KMS
    and UMS support therefore don't know whether to say they need I/O port
    access or not, and have to assume they do.
    
    With this change we now call it only to query whether port access might
    be needed; we don't use that to determine whether to call a driver's
    probe function or not, instead we call them unconditionally.  If the
    driver doesn't check whether port access was enabled, they might crash
    ungracefully.  To accomodate this, we move xorgHWAccess to be explicitly
    intentionally exported (sigh xf86Priv.h) so that drivers can check that
    before they attempt port access.
    
    v2: Move initial xf86EnableIO() nearer the logic that determines whether
    to call it, suggested by Simon Farnsworth.
    
    Reviewed-by: Alex Deucher <alexander.deucher at amd.com>
    Reviewed-by: Simon Farnsworth <simon.farnsworth at onelan.co.uk>
    Signed-off-by: Adam Jackson <ajax at redhat.com>

diff --git a/hw/xfree86/common/xf86.h b/hw/xfree86/common/xf86.h
index bb2903d..179b87c 100644
--- a/hw/xfree86/common/xf86.h
+++ b/hw/xfree86/common/xf86.h
@@ -55,6 +55,7 @@
 extern _X_EXPORT int xf86DoConfigure;
 extern _X_EXPORT int xf86DoShowOptions;
 extern _X_EXPORT Bool xf86DoConfigurePass1;
+extern _X_EXPORT Bool xorgHWAccess;
 
 extern _X_EXPORT DevPrivateKeyRec xf86ScreenKeyRec;
 
diff --git a/hw/xfree86/common/xf86Bus.c b/hw/xfree86/common/xf86Bus.c
index 6de8409..3c8ae69 100644
--- a/hw/xfree86/common/xf86Bus.c
+++ b/hw/xfree86/common/xf86Bus.c
@@ -115,27 +115,12 @@ xf86BusConfig(void)
     screenLayoutPtr layout;
     int i, j;
 
-    /* Enable full I/O access */
-    if (xorgHWAccess)
-        xorgHWAccess = xf86EnableIO();
-
     /*
      * Now call each of the Probe functions.  Each successful probe will
      * result in an extra entry added to the xf86Screens[] list for each
      * instance of the hardware found.
      */
     for (i = 0; i < xf86NumDrivers; i++) {
-        xorgHWFlags flags;
-
-        if (!xorgHWAccess) {
-            if (!xf86DriverList[i]->driverFunc
-                || !xf86DriverList[i]->driverFunc(NULL,
-                                                  GET_REQUIRED_HW_INTERFACES,
-                                                  &flags)
-                || NEED_IO_ENABLED(flags))
-                continue;
-        }
-
         xf86CallDriverProbe(xf86DriverList[i], FALSE);
     }
 
diff --git a/hw/xfree86/common/xf86Configure.c b/hw/xfree86/common/xf86Configure.c
index 6f69117..6c5e359 100644
--- a/hw/xfree86/common/xf86Configure.c
+++ b/hw/xfree86/common/xf86Configure.c
@@ -545,41 +545,16 @@ DoConfigure(void)
 
     free(vlist);
 
-    for (i = 0; i < xf86NumDrivers; i++) {
-        xorgHWFlags flags;
-
-        if (!xf86DriverList[i]->driverFunc
-            || !xf86DriverList[i]->driverFunc(NULL,
-                                              GET_REQUIRED_HW_INTERFACES,
-                                              &flags)
-            || NEED_IO_ENABLED(flags)) {
-            xorgHWAccess = TRUE;
-            break;
-        }
-    }
-    /* Enable full I/O access */
-    if (xorgHWAccess) {
-        if (!xf86EnableIO())
-            /* oops, we have failed */
-            xorgHWAccess = FALSE;
-    }
+    xorgHWAccess = xf86EnableIO();
 
     /* Create XF86Config file structure */
     xf86config = calloc(1, sizeof(XF86ConfigRec));
 
     /* Call all of the probe functions, reporting the results. */
     for (CurrentDriver = 0; CurrentDriver < xf86NumDrivers; CurrentDriver++) {
-        xorgHWFlags flags;
         Bool found_screen;
         DriverRec *const drv = xf86DriverList[CurrentDriver];
 
-        if (!xorgHWAccess) {
-            if (!drv->driverFunc
-                || !drv->driverFunc(NULL, GET_REQUIRED_HW_INTERFACES, &flags)
-                || NEED_IO_ENABLED(flags))
-                continue;
-        }
-
         found_screen = xf86CallDriverProbe(drv, TRUE);
         if (found_screen && drv->Identify) {
             (*drv->Identify) (0);
diff --git a/hw/xfree86/common/xf86Init.c b/hw/xfree86/common/xf86Init.c
index e4a6b86..1695dbf 100644
--- a/hw/xfree86/common/xf86Init.c
+++ b/hw/xfree86/common/xf86Init.c
@@ -402,6 +402,7 @@ InitOutput(ScreenInfo * pScreenInfo, int argc, char **argv)
     Bool pix24Fail = FALSE;
     Bool autoconfig = FALSE;
     Bool sigio_blocked = FALSE;
+    Bool want_hw_access = FALSE;
     GDevPtr configured_device;
 
     xf86Initialising = TRUE;
@@ -530,23 +531,21 @@ InitOutput(ScreenInfo * pScreenInfo, int argc, char **argv)
          */
 
         for (i = 0; i < xf86NumDrivers; i++) {
+            xorgHWFlags flags = HW_IO;
+
             if (xf86DriverList[i]->Identify != NULL)
                 xf86DriverList[i]->Identify(0);
 
-            if (!xorgHWAccess || !xorgHWOpenConsole) {
-                xorgHWFlags flags;
+            if (xf86DriverList[i]->driverFunc)
+                xf86DriverList[i]->driverFunc(NULL,
+                                              GET_REQUIRED_HW_INTERFACES,
+                                              &flags);
 
-                if (!xf86DriverList[i]->driverFunc
-                    || !xf86DriverList[i]->driverFunc(NULL,
-                                                      GET_REQUIRED_HW_INTERFACES,
-                                                      &flags))
-                    flags = HW_IO;
+            if (NEED_IO_ENABLED(flags))
+                want_hw_access = TRUE;
 
-                if (NEED_IO_ENABLED(flags))
-                    xorgHWAccess = TRUE;
-                if (!(flags & HW_SKIP_CONSOLE))
-                    xorgHWOpenConsole = TRUE;
-            }
+            if (!(flags & HW_SKIP_CONSOLE))
+                xorgHWOpenConsole = TRUE;
         }
 
         if (xorgHWOpenConsole)
@@ -554,6 +553,10 @@ InitOutput(ScreenInfo * pScreenInfo, int argc, char **argv)
         else
             xf86Info.dontVTSwitch = TRUE;
 
+	/* Enable full I/O access */
+	if (want_hw_access)
+	    xorgHWAccess = xf86EnableIO();
+
         if (xf86BusConfig() == FALSE)
             return;
 
diff --git a/hw/xfree86/common/xf86Priv.h b/hw/xfree86/common/xf86Priv.h
index c9f2e7e..58cfe0a 100644
--- a/hw/xfree86/common/xf86Priv.h
+++ b/hw/xfree86/common/xf86Priv.h
@@ -91,7 +91,6 @@ extern _X_EXPORT int xf86NumScreens;
 extern _X_EXPORT const char *xf86VisualNames[];
 extern _X_EXPORT int xf86Verbose;       /* verbosity level */
 extern _X_EXPORT int xf86LogVerbose;    /* log file verbosity level */
-extern _X_EXPORT Bool xorgHWAccess;
 
 extern _X_EXPORT RootWinPropPtr *xf86RegisteredPropertiesTable;
 
commit d88fb00d791c2b19cf9dd244276838aba3a6b442
Author: Adam Jackson <ajax at redhat.com>
Date:   Tue Jun 26 13:15:45 2012 -0400

    linux: Make failure to iopl non-fatal
    
    We load the driver list, then enable I/O, then call driver probe based
    on whether I/O enable succeeded.  That's bad, because the loaded
    security policy might forbid port access.  We happen to treat that as
    fatal for some reason, which means even drivers that don't need I/O
    access (like kms and fbdev) don't get the chance to run.  Facepalm.
    
    How about we just make that non-fatal instead, that sounds like a much
    better plan.
    
    Reviewed-by: Alex Deucher <alexander.deucher at amd.com>
    Reviewed-by: Simon Farnsworth <simon.farnsworth at onelan.co.uk>
    Signed-off-by: Adam Jackson <ajax at redhat.com>

diff --git a/hw/xfree86/os-support/linux/lnx_video.c b/hw/xfree86/os-support/linux/lnx_video.c
index 895a79b..d9a5da1 100644
--- a/hw/xfree86/os-support/linux/lnx_video.c
+++ b/hw/xfree86/os-support/linux/lnx_video.c
@@ -510,11 +510,8 @@ static Bool
 hwEnableIO(void)
 {
     if (ioperm(0, 1024, 1) || iopl(3)) {
-        if (errno == ENODEV)
-            ErrorF("xf86EnableIOPorts: no I/O ports found\n");
-        else
-            FatalError("xf86EnableIOPorts: failed to set IOPL"
-                       " for I/O (%s)\n", strerror(errno));
+        ErrorF("xf86EnableIOPorts: failed to set IOPL for I/O (%s)\n",
+               strerror(errno));
         return FALSE;
     }
 #if !defined(__alpha__)
commit 048674a6aeb61149a1b5f6b0bc3762ddf57f38ee
Author: Adam Jackson <ajax at redhat.com>
Date:   Tue Jun 26 13:12:45 2012 -0400

    linux: Refactor xf86{En,Dis}ableIO
    
    Pull platform methods into their own sections for legibility, and
    rewrite the ifdefs to be more concise.
    
    Reviewed-by: Alex Deucher <alexander.deucher at amd.com>
    Reviewed-by: Simon Farnsworth <simon.farnsworth at onelan.co.uk>
    Signed-off-by: Adam Jackson <ajax at redhat.com>

diff --git a/hw/xfree86/os-support/linux/lnx_video.c b/hw/xfree86/os-support/linux/lnx_video.c
index 3526a21..895a79b 100644
--- a/hw/xfree86/os-support/linux/lnx_video.c
+++ b/hw/xfree86/os-support/linux/lnx_video.c
@@ -479,39 +479,36 @@ volatile unsigned char *ioBase = NULL;
 #define __NR_pciconfig_iobase	200
 #endif
 
-#endif
-
-Bool
-xf86EnableIO(void)
+static Bool
+hwEnableIO(void)
 {
-#if defined(__powerpc__)
     int fd;
-    unsigned int ioBase_phys;
-#endif
-
-    if (ExtendedEnabled)
-        return TRUE;
-
-#if defined(__powerpc__)
-    ioBase_phys = syscall(__NR_pciconfig_iobase, 2, 0, 0);
+    unsigned int ioBase_phys = syscall(__NR_pciconfig_iobase, 2, 0, 0);
 
     fd = open("/dev/mem", O_RDWR);
     if (ioBase == NULL) {
         ioBase = (volatile unsigned char *) mmap(0, 0x20000,
                                                  PROT_READ | PROT_WRITE,
                                                  MAP_SHARED, fd, ioBase_phys);
-/* Should this be fatal or just a warning? */
-#if 0
-        if (ioBase == MAP_FAILED) {
-            xf86Msg(X_WARNING,
-                    "xf86EnableIOPorts: Failed to map iobase (%s)\n",
-                    strerror(errno));
-            return FALSE;
-        }
-#endif
     }
     close(fd);
-#elif !defined(__mc68000__) && !defined(__sparc__) && !defined(__mips__) && !defined(__sh__) && !defined(__hppa__) && !defined(__s390__) && !defined(__arm__) && !defined(__m32r__) && !defined(__nds32__)
+
+    return ioBase != MAP_FAILED;
+}
+
+static void
+hwDisableIO(void)
+{
+    munmap(ioBase, 0x20000);
+    ioBase = NULL;
+}
+
+#elif defined(__i386__) || defined(__x86_64__) || defined(__ia64__) || \
+      defined(__alpha__)
+
+static Bool
+hwEnableIO(void)
+{
     if (ioperm(0, 1024, 1) || iopl(3)) {
         if (errno == ENODEV)
             ErrorF("xf86EnableIOPorts: no I/O ports found\n");
@@ -526,27 +523,44 @@ xf86EnableIO(void)
     ioperm(0x40, 4, 0);         /* trap access to the timer chip */
     ioperm(0x60, 4, 0);         /* trap access to the keyboard controller */
 #endif
-#endif
-    ExtendedEnabled = TRUE;
 
     return TRUE;
 }
 
+static void
+hwDisableIO(void)
+{
+    iopl(0);
+    ioperm(0, 1024, 0);
+}
+
+#else /* non-IO architectures */
+
+#define hwEnableIO() TRUE
+#define hwDisableIO() do {} while (0)
+
+#endif
+
+Bool
+xf86EnableIO(void)
+{
+    if (ExtendedEnabled)
+        return TRUE;
+
+    ExtendedEnabled = hwEnableIO();
+
+    return ExtendedEnabled;
+}
+
 void
 xf86DisableIO(void)
 {
     if (!ExtendedEnabled)
         return;
-#if defined(__powerpc__)
-    munmap(ioBase, 0x20000);
-    ioBase = NULL;
-#elif !defined(__mc68000__) && !defined(__sparc__) && !defined(__mips__) && !defined(__sh__) && !defined(__hppa__) && !defined(__arm__) && !defined(__s390__) && !defined(__m32r__) && !defined(__nds32__)
-    iopl(0);
-    ioperm(0, 1024, 0);
-#endif
-    ExtendedEnabled = FALSE;
 
-    return;
+    hwDisableIO();
+
+    ExtendedEnabled = FALSE;
 }
 
 #if defined (__alpha__)
commit 70e5766874a919039678bb2ed75f2ccea0cb4345
Author: Dave Airlie <airlied at redhat.com>
Date:   Mon Aug 27 15:22:44 2012 +1000

    xf86: fix multi-seat video device support. (v2)
    
    If we are not seat 0 the following apply:
    
    don't probe any bus other than platform
    don't probe any drivers other than platform
    assume the first platform device we match on the bus is the primary GPU.
    
    This just adds checks in the correct places to ensure this, and
    with this X can now start on a secondary seat for an output device.
    
    v2: fix Seat0 macros
    Reviewed-by: Keith Packard <keithp at keithp.com>
    Signed-off-by: Dave Airlie <airlied at redhat.com>

diff --git a/hw/xfree86/common/xf86Bus.c b/hw/xfree86/common/xf86Bus.c
index 6de8409..4ffbf7e 100644
--- a/hw/xfree86/common/xf86Bus.c
+++ b/hw/xfree86/common/xf86Bus.c
@@ -81,6 +81,8 @@ xf86CallDriverProbe(DriverPtr drv, Bool detect_only)
     if (drv->platformProbe != NULL) {
         foundScreen = xf86platformProbeDev(drv);
     }
+    if (ServerIsNotSeat0())
+        return foundScreen;
 #endif
 
 #ifdef XSERVER_LIBPCIACCESS
@@ -214,6 +216,8 @@ xf86BusProbe(void)
 {
 #ifdef XSERVER_PLATFORM_BUS
     xf86platformProbe();
+    if (ServerIsNotSeat0())
+        return;
 #endif
 #ifdef XSERVER_LIBPCIACCESS
     xf86PciProbe();
diff --git a/hw/xfree86/common/xf86platformBus.c b/hw/xfree86/common/xf86platformBus.c
index 6a8fb90..0525e39 100644
--- a/hw/xfree86/common/xf86platformBus.c
+++ b/hw/xfree86/common/xf86platformBus.c
@@ -359,6 +359,9 @@ xf86platformProbeDev(DriverPtr drvp)
                     break;
             }
             else {
+                /* for non-seat0 servers assume first device is the master */
+                if (ServerIsNotSeat0())
+                    break;
                 if (xf86_platform_devices[j].pdev) {
                     if (xf86IsPrimaryPlatform(&xf86_platform_devices[j]))
                         break;
commit 37d956e3ac9513b74078882dff489f9b0a7a5a28
Author: Keith Packard <keithp at keithp.com>
Date:   Mon Sep 10 11:14:20 2012 +1000

    xf86: fix compat output selection for no output GPUs
    
    This should work properly with dynamic outputs.
    
    Reviewed-by: Dave Airlie <airlied at redhat.com>
    Signed-off-by: Dave Airlie <airlied at redhat.com>

diff --git a/hw/xfree86/modes/xf86Crtc.c b/hw/xfree86/modes/xf86Crtc.c
index e3eaf5f..177f7ac 100644
--- a/hw/xfree86/modes/xf86Crtc.c
+++ b/hw/xfree86/modes/xf86Crtc.c
@@ -66,6 +66,7 @@ xf86CrtcConfigInit(ScrnInfoPtr scrn, const xf86CrtcConfigFuncsRec * funcs)
     config = xnfcalloc(1, sizeof(xf86CrtcConfigRec));
 
     config->funcs = funcs;
+    config->compat_output = -1;
 
     scrn->privates[xf86CrtcConfigPrivateIndex].ptr = config;
 }
@@ -1841,7 +1842,7 @@ SetCompatOutput(xf86CrtcConfigPtr config)
     if (compat >= 0) {
         config->compat_output = compat;
     }
-    else {
+    else if (config->compat_output >= 0 && config->compat_output < config->num_output) {
         /* Don't change the compat output when no valid outputs found */
         output = config->output[config->compat_output];
     }
commit e0b92f5f86f8ce71ab4c80e9902e51e2525f9705
Author: Dave Airlie <airlied at gmail.com>
Date:   Thu Sep 13 18:44:06 2012 +1000

    config/udev: ignore change on drm devices
    
    for input devices we handle change like remove/add, but for
    drm devices we get change events when we hotplug outputs,
    so lets just ignore change at this level, and let the drivers
    handle it. We may in the future want to route driver udev
    from here instead.
    
    Reported-by: Timo Aaltonen <timo.aaltonen at canonical.com>
    Reviewed-by: Keith Packard <keithp at keithp.com>
    Signed-off-by: Dave Airlie <airlied at redhat.com>

diff --git a/config/udev.c b/config/udev.c
index c2d00bb..454838f 100644
--- a/config/udev.c
+++ b/config/udev.c
@@ -300,9 +300,15 @@ wakeup_handler(pointer data, int err, pointer read_mask)
             return;
         action = udev_device_get_action(udev_device);
         if (action) {
-            if (!strcmp(action, "add") || !strcmp(action, "change")) {
+            if (!strcmp(action, "add")) {
                 device_removed(udev_device);
                 device_added(udev_device);
+            } else if (!strcmp(action, "change")) {
+                /* ignore change for the drm devices */
+                if (strcmp(udev_device_get_subsystem(udev_device), "drm")) {
+                    device_removed(udev_device);
+                    device_added(udev_device);
+                }
             }
             else if (!strcmp(action, "remove"))
                 device_removed(udev_device);
commit 10672a5abe7d4e924844d7e41c86c24d6367a52b
Author: Dave Airlie <airlied at redhat.com>
Date:   Mon Sep 10 14:48:37 2012 +1000

    xf86/platform: scan pci after probing devices
    
    This solves a race if we are trying to dynamically power off
    secondary GPUs. Its not the greatest fix ever but it probably
    as good as we can do for now.
    
    The GPU probing causes the devices to be powered up, then when
    we scan the PCI bus we get the correct information from the kernel,
    rather than a bunch of 0xff due to the device being powered off.
    
    drop gratuitous '&'.
    
    Reviewed-by: Keith Packard <keithp at keithp.com>
    Signed-off-by: Dave Airlie <airlied at redhat.com>

diff --git a/hw/xfree86/common/xf86platformBus.c b/hw/xfree86/common/xf86platformBus.c
index 24b9473..6a8fb90 100644
--- a/hw/xfree86/common/xf86platformBus.c
+++ b/hw/xfree86/common/xf86platformBus.c
@@ -213,11 +213,12 @@ xf86platformProbe(void)
     int i;
     Bool pci = TRUE;
 
+    config_odev_probe(xf86PlatformDeviceProbe);
+
     if (!xf86scanpci()) {
         pci = FALSE;
     }
 
-    config_odev_probe(&xf86PlatformDeviceProbe);
     for (i = 0; i < xf86_num_platform_devices; i++) {
         char *busid = xf86_get_platform_attrib(i, ODEV_ATTRIB_BUSID);
 
commit 22746df15b5f75dc85f5cf5b73932eb8a44cb89b
Author: Dave Airlie <airlied at redhat.com>
Date:   Thu Sep 6 16:33:54 2012 +1000

    dri2: invalidate drawable after sharing pixmap
    
    After we share the pixmap, the backing storage may have changed,
    and we need to invalidate and buffers pointing at it.
    
    This fixes GL compositors and prime windows lacking contents initially.
    
    Reviewed-by: Chris Wilson <chris at chris-wilson.co.uk>
    Signed-off-by: Dave Airlie <airlied at redhat.com>

diff --git a/hw/xfree86/dri2/dri2.c b/hw/xfree86/dri2/dri2.c
index 23f589c..40963c3 100644
--- a/hw/xfree86/dri2/dri2.c
+++ b/hw/xfree86/dri2/dri2.c
@@ -766,6 +766,44 @@ static inline PixmapPtr GetDrawablePixmap(DrawablePtr drawable)
     }
 }
 
+/*
+ * A TraverseTree callback to invalidate all windows using the same
+ * pixmap
+ */
+static int
+DRI2InvalidateWalk(WindowPtr pWin, pointer data)
+{
+    if (pWin->drawable.pScreen->GetWindowPixmap(pWin) != data)
+        return WT_DONTWALKCHILDREN;
+    DRI2InvalidateDrawable(&pWin->drawable);
+    return WT_WALKCHILDREN;
+}
+
+static void
+DRI2InvalidateDrawableAll(DrawablePtr pDraw)
+{
+    if (pDraw->type == DRAWABLE_WINDOW) {
+        WindowPtr pWin = (WindowPtr) pDraw;
+        PixmapPtr pPixmap = pDraw->pScreen->GetWindowPixmap(pWin);
+
+        /*
+         * Find the top-most window using this pixmap
+         */
+        while (pWin->parent &&
+               pDraw->pScreen->GetWindowPixmap(pWin->parent) == pPixmap)
+            pWin = pWin->parent;
+
+        /*
+         * Walk the sub-tree to invalidate all of the
+         * windows using the same pixmap
+         */
+        TraverseTree(pWin, DRI2InvalidateWalk, pPixmap);
+        DRI2InvalidateDrawable(&pPixmap->drawable);
+    }
+    else
+        DRI2InvalidateDrawable(pDraw);
+}
+
 DrawablePtr DRI2UpdatePrime(DrawablePtr pDraw, DRI2BufferPtr pDest)
 {
     DRI2DrawablePtr pPriv = DRI2GetDrawable(pDraw);
@@ -831,6 +869,8 @@ DrawablePtr DRI2UpdatePrime(DrawablePtr pDraw, DRI2BufferPtr pDest)
     spix->screen_x = mpix->screen_x;
     spix->screen_y = mpix->screen_y;
 #endif
+
+    DRI2InvalidateDrawableAll(pDraw);
     return &spix->drawable;
 }
 
@@ -1048,18 +1088,7 @@ DRI2WaitSwap(ClientPtr client, DrawablePtr pDrawable)
     return FALSE;
 }
 
-/*
- * A TraverseTree callback to invalidate all windows using the same
- * pixmap
- */
-static int
-DRI2InvalidateWalk(WindowPtr pWin, pointer data)
-{
-    if (pWin->drawable.pScreen->GetWindowPixmap(pWin) != data)
-        return WT_DONTWALKCHILDREN;
-    DRI2InvalidateDrawable(&pWin->drawable);
-    return WT_WALKCHILDREN;
-}
+
 
 int
 DRI2SwapBuffers(ClientPtr client, DrawablePtr pDraw, CARD64 target_msc,
@@ -1162,26 +1191,7 @@ DRI2SwapBuffers(ClientPtr client, DrawablePtr pDraw, CARD64 target_msc,
      */
     *swap_target = pPriv->swap_count + pPriv->swapsPending;
 
-    if (pDraw->type == DRAWABLE_WINDOW) {
-        WindowPtr pWin = (WindowPtr) pDraw;
-        PixmapPtr pPixmap = pScreen->GetWindowPixmap(pWin);
-
-        /*
-         * Find the top-most window using this pixmap
-         */
-        while (pWin->parent &&
-               pScreen->GetWindowPixmap(pWin->parent) == pPixmap)
-            pWin = pWin->parent;
-
-        /*
-         * Walk the sub-tree to invalidate all of the
-         * windows using the same pixmap
-         */
-        TraverseTree(pWin, DRI2InvalidateWalk, pPixmap);
-        DRI2InvalidateDrawable(&pPixmap->drawable);
-    }
-    else
-        DRI2InvalidateDrawable(pDraw);
+    DRI2InvalidateDrawableAll(pDraw);
 
     return Success;
 }
commit f0bad69edd57facd6cffde8cb0863d1a735e2492
Author: Keith Packard <keithp at keithp.com>
Date:   Wed Sep 5 14:45:08 2012 -0700

    Version bumped to 1.13
    
    Signed-off-by: Keith Packard <keithp at keithp.com>

diff --git a/configure.ac b/configure.ac
index ab89027..ac3bf26 100644
--- a/configure.ac
+++ b/configure.ac
@@ -26,9 +26,9 @@ dnl
 dnl Process this file with autoconf to create configure.
 
 AC_PREREQ(2.60)
-AC_INIT([xorg-server], 1.12.99.905, [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], xorg-server)
-RELEASE_DATE="2012-08-21"
-RELEASE_NAME="Splashing Orca"
+AC_INIT([xorg-server], 1.13.0, [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], xorg-server)
+RELEASE_DATE="2012-09-05"
+RELEASE_NAME="Iced Tea"
 AC_CONFIG_SRCDIR([Makefile.am])
 AM_INIT_AUTOMAKE([foreign dist-bzip2])
 AM_MAINTAINER_MODE
commit 856f80c8d7f22b979c72d9c70b70187df6004a03
Merge: 0db936a b8ab93d
Author: Keith Packard <keithp at keithp.com>
Date:   Wed Sep 5 11:02:58 2012 -0700

    Merge remote-tracking branch 'jeremyhu/master'

commit 0db936a5b7125d9b73633733cb34e5e4b72f01e8
Author: Dave Airlie <airlied at redhat.com>
Date:   Mon Sep 3 15:09:36 2012 +1000

    xf86: call enter/leave VT for gpu screens as well
    
    Otherwise we can't do fast user switch properly for multiple GPUs.
    
    Reviewed-by: Alex Deucher <alexander.deucher at amd.com>
    Signed-off-by: Dave Airlie <airlied at redhat.com>

diff --git a/hw/xfree86/common/xf86Events.c b/hw/xfree86/common/xf86Events.c
index 47429ec..3ad34b5 100644
--- a/hw/xfree86/common/xf86Events.c
+++ b/hw/xfree86/common/xf86Events.c
@@ -460,6 +460,8 @@ xf86VTSwitch(void)
         OsBlockSIGIO();
         for (i = 0; i < xf86NumScreens; i++)
             xf86Screens[i]->LeaveVT(xf86Screens[i]);
+        for (i = 0; i < xf86NumGPUScreens; i++)
+            xf86GPUScreens[i]->LeaveVT(xf86GPUScreens[i]);
 
         xf86AccessLeave();      /* We need this here, otherwise */
 
@@ -474,6 +476,10 @@ xf86VTSwitch(void)
                 if (!xf86Screens[i]->EnterVT(xf86Screens[i]))
                     FatalError("EnterVT failed for screen %d\n", i);
             }
+            for (i = 0; i < xf86NumGPUScreens; i++) {
+                if (!xf86GPUScreens[i]->EnterVT(xf86GPUScreens[i]))
+                    FatalError("EnterVT failed for gpu screen %d\n", i);
+            }
             if (!(dispatchException & DE_TERMINATE)) {
                 for (i = 0; i < xf86NumScreens; i++) {
                     if (xf86Screens[i]->EnableDisableFBAccess)
@@ -530,6 +536,11 @@ xf86VTSwitch(void)
             if (!xf86Screens[i]->EnterVT(xf86Screens[i]))
                 FatalError("EnterVT failed for screen %d\n", i);
         }
+        for (i = 0; i < xf86NumGPUScreens; i++) {
+            xf86GPUScreens[i]->vtSema = TRUE;
+            if (!xf86GPUScreens[i]->EnterVT(xf86GPUScreens[i]))
+                FatalError("EnterVT failed for gpu screen %d\n", i);
+        }
         for (i = 0; i < xf86NumScreens; i++) {
             if (xf86Screens[i]->EnableDisableFBAccess)
                 (*xf86Screens[i]->EnableDisableFBAccess) (xf86Screens[i], TRUE);
commit 18deac48db0d2387242461025904eb28a0f71fac
Author: Dave Airlie <airlied at redhat.com>
Date:   Mon Aug 27 15:17:21 2012 +1000

    config/udev: respect seat for hotplugged video devices.
    
    This respects the seat tag for hotplugged video devices at X start.
    
    Reviewed-by: Keith Packard <keithp at keithp.com>
    Signed-off-by: Dave Airlie <airlied at redhat.com>

diff --git a/config/udev.c b/config/udev.c
index 5a8f481..c2d00bb 100644
--- a/config/udev.c
+++ b/config/udev.c
@@ -454,6 +454,10 @@ config_udev_odev_probe(config_odev_probe_proc_ptr probe_callback)
 
     udev_enumerate_add_match_subsystem(enumerate, "drm");
     udev_enumerate_add_match_sysname(enumerate, "card[0-9]*");
+#ifdef HAVE_UDEV_ENUMERATE_ADD_MATCH_TAG
+    if (ServerIsNotSeat0())
+        udev_enumerate_add_match_tag(enumerate, SeatId);
+#endif
     udev_enumerate_scan_devices(enumerate);
     devices = udev_enumerate_get_list_entry(enumerate);
     udev_list_entry_foreach(device, devices) {
commit ec740cffeba59216f4293fba829097654cde3b11
Author: Dave Airlie <airlied at redhat.com>
Date:   Mon Aug 27 15:15:19 2012 +1000

    config/udev: add wrapper around check if server is not seat 0
    
    this is a simple clean-up that is useful to stop further propogation
    of this construct.
    
    Reviewed-by: Keith Packard <keithp at keithp.com>
    Signed-off-by: Dave Airlie <airlied at redhat.com>

diff --git a/config/udev.c b/config/udev.c
index 03aca28..5a8f481 100644
--- a/config/udev.c
+++ b/config/udev.c
@@ -339,7 +339,7 @@ config_udev_pre_init(void)
 #endif
 
 #ifdef HAVE_UDEV_MONITOR_FILTER_ADD_MATCH_TAG
-    if (SeatId && strcmp(SeatId, "seat0"))
+    if (ServerIsNotSeat0())
         udev_monitor_filter_add_match_tag(udev_monitor, SeatId);
 #endif
     if (udev_monitor_enable_receiving(udev_monitor)) {
@@ -368,7 +368,7 @@ config_udev_init(void)
 #endif
 
 #ifdef HAVE_UDEV_ENUMERATE_ADD_MATCH_TAG
-    if (SeatId && strcmp(SeatId, "seat0"))
+    if (ServerIsNotSeat0())
         udev_enumerate_add_match_tag(enumerate, SeatId);
 #endif
 
diff --git a/include/hotplug.h b/include/hotplug.h
index 96b078d..2a95b45 100644
--- a/include/hotplug.h
+++ b/include/hotplug.h
@@ -69,4 +69,6 @@ void config_odev_probe(config_odev_probe_proc_ptr probe_callback);
 void NewGPUDeviceRequest(struct OdevAttributes *attribs);
 void DeleteGPUDeviceRequest(struct OdevAttributes *attribs);
 #endif
+
+#define ServerIsNotSeat0() (SeatId && strcmp(SeatId, "seat0"))
 #endif                          /* HOTPLUG_H */
commit 49ec57d5094be0dd2b67435ac7bb04ead780f36d
Author: Dave Airlie <airlied at redhat.com>
Date:   Fri Aug 24 13:23:01 2012 +1000

    dix: free default colormap before screen deletion
    
    If we don't free this here, it gets freed later in the resource
    cleanups, however it then looks up up pmap->pScreen, which we
    freed already in this function. So free the default colormap
    when we should.
    
    This fixes a bug after a couple of hotplug cycles when you try
    to exit the X server and it crashes.
    
    Reviewed-by: Keith Packard <keithp at keithp.com>
    Signed-off-by: Dave Airlie <airlied at redhat.com>

diff --git a/dix/dispatch.c b/dix/dispatch.c
index 3c6a591..0ce10c2 100644
--- a/dix/dispatch.c
+++ b/dix/dispatch.c
@@ -3904,6 +3904,10 @@ RemoveGPUScreen(ScreenPtr pScreen)
     }
     screenInfo.numGPUScreens--;
 
+    /* this gets freed later in the resource list, but without
+     * the screen existing it causes crashes - so remove it here */
+    if (pScreen->defColormap)
+        FreeResource(pScreen->defColormap, RT_COLORMAP);
     free(pScreen);
 
 }
commit 20f601a0fbc01a4f8ab85e54ee45f78f7817cdb5
Author: Dave Airlie <airlied at redhat.com>
Date:   Fri Aug 24 12:56:18 2012 +1000

    xf86/crtc: don't free config->name
    
    This is set by pre_init not screen init, so if we free it here
    and then recycle the server, we lose all the providers.
    
    I think we need to wrap FreeScreen here to do this properly,
    will investigate for 1.14 most likely, safer to just leak this
    on server exit for now.
    
    Reviewed-by: Keith Packard <keithp at keithp.com>
    Signed-off-by: Dave Airlie <airlied at redhat.com>

diff --git a/hw/xfree86/modes/xf86Crtc.c b/hw/xfree86/modes/xf86Crtc.c
index 1947c5b..e3eaf5f 100644
--- a/hw/xfree86/modes/xf86Crtc.c
+++ b/hw/xfree86/modes/xf86Crtc.c
@@ -728,8 +728,6 @@ xf86CrtcCloseScreen(ScreenPtr screen)
 
     xf86RandR12CloseScreen(screen);
 
-    free(config->name);
-
     screen->CloseScreen(screen);
 
     for (o = 0; o < config->num_output; o++) {
commit 148583d62b84832369e9df39b3e527b99ca96761
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date:   Wed Aug 29 09:11:35 2012 +1000

    tests: move GCC diagnostics pragma outside of function
    
    This is a  a gcc 4.6+ feature.
    
    signal-logging.c:210: error: #pragma GCC diagnostic not allowed inside
    functions
    
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
    Reviewed-by: Dave Airlie <airlied at redhat.com>
    Signed-off-by: Keith Packard <keithp at keithp.com>

diff --git a/test/signal-logging.c b/test/signal-logging.c
index 3206dde..810bd20 100644
--- a/test/signal-logging.c
+++ b/test/signal-logging.c
@@ -178,6 +178,7 @@ number_formatting(void)
         assert(check_signed_number_format_test(signed_tests + i));
 }
 
+#pragma GCC diagnostic ignored "-Wformat-security"
 static void logging_format(void)
 {
     const char *log_file_path = "/tmp/Xorg-logging-test.log";
@@ -207,9 +208,7 @@ static void logging_format(void)
     assert(strcmp(logmsg, "(EE) test message\n") == 0);
 
     /* long buf is truncated to "....en\n" */
-#pragma GCC diagnostic ignored "-Wformat-security"
     LogMessageVerbSigSafe(X_ERROR, -1, buf);
-#pragma GCC diagnostic pop "-Wformat-security"
     read_log_msg(logmsg);
     assert(strcmp(&logmsg[strlen(logmsg) - 3], "en\n") == 0);
 
@@ -298,6 +297,7 @@ static void logging_format(void)
 
 #undef read_log_msg
 }
+#pragma GCC diagnostic pop "-Wformat-security"
 
 int
 main(int argc, char **argv)


More information about the Xquartz-changes mailing list