xserver: Branch 'master' - 3 commits

Keith Packard keithp at kemper.freedesktop.org
Sun Mar 3 22:26:43 PST 2013


 hw/xfree86/common/xf86platformBus.c |    7 ++++++-
 hw/xfree86/modes/xf86Crtc.c         |   18 ++++++------------
 hw/xfree86/modes/xf86RandR12.c      |   22 ++++++++++++++++++++++
 randr/randrstr.h                    |    6 ++++++
 randr/rrprovider.c                  |    2 ++
 5 files changed, 42 insertions(+), 13 deletions(-)

New commits:
commit 8f4640bdb9d3988148e09a08d2c7e3bab1d538d6
Author: Dave Airlie <airlied at redhat.com>
Date:   Wed Jan 9 12:58:28 2013 +1000

    randr: cleanup provider properly
    
    So in the cold plug server shutdown case, we reap the resources
    before we call CloseScreen handlers, so the config->randr_provider
    is a dangling pointer when the xf86CrtcCloseScreen handler is called,
    
    however in the hot screen unplug case, we can't rely on automatically
    reaped resources, so we need to clean up the provider in the xf86CrtcCloseScreen
    case.
    
    This patch provides a cleanup callback from the randr provider removal
    into the DDX so it can cleanup properly, this then gets called by the automatic
    code for cold plug, or if hot unplug it gets called explicitly.
    
    Fixes a number of random server crashes on shutdown
    Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=58174
    Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=891140
    
    Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>
    Signed-off-by: Dave Airlie <airlied at redhat.com>

diff --git a/hw/xfree86/modes/xf86Crtc.c b/hw/xfree86/modes/xf86Crtc.c
index b52b6ef..f9ae465 100644
--- a/hw/xfree86/modes/xf86Crtc.c
+++ b/hw/xfree86/modes/xf86Crtc.c
@@ -743,16 +743,8 @@ xf86CrtcCloseScreen(ScreenPtr screen)
     }
     /* detach any providers */
     if (config->randr_provider) {
-        if (config->randr_provider->offload_sink) {
-            DetachOffloadGPU(screen);
-            config->randr_provider->offload_sink = NULL;
-        }
-        else if (config->randr_provider->output_source) {
-            DetachOutputGPU(screen);
-            config->randr_provider->output_source = NULL;
-        }
-        else if (screen->current_master)
-            DetachUnboundGPU(screen);
+        RRProviderDestroy(config->randr_provider);
+        config->randr_provider = NULL;
     }
     return TRUE;
 }
diff --git a/hw/xfree86/modes/xf86RandR12.c b/hw/xfree86/modes/xf86RandR12.c
index 3530abf..01fc9c5 100644
--- a/hw/xfree86/modes/xf86RandR12.c
+++ b/hw/xfree86/modes/xf86RandR12.c
@@ -1885,6 +1885,27 @@ xf86RandR13ConstrainCursorHarder(DeviceIntPtr dev, ScreenPtr screen, int mode, i
     }
 }
 
+static void
+xf86RandR14ProviderDestroy(ScreenPtr screen, RRProviderPtr provider)
+{
+    ScrnInfoPtr scrn = xf86ScreenToScrn(screen);
+    xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn);
+    
+    if (config->randr_provider == provider) {
+        if (config->randr_provider->offload_sink) {
+            DetachOffloadGPU(screen);
+            config->randr_provider->offload_sink = NULL;
+        }
+        else if (config->randr_provider->output_source) {
+            DetachOutputGPU(screen);
+            config->randr_provider->output_source = NULL;
+        }
+        else if (screen->current_master)
+            DetachUnboundGPU(screen);
+    }
+    config->randr_provider = NULL;
+}
+
 static Bool
 xf86RandR12Init12(ScreenPtr pScreen)
 {
@@ -1914,6 +1935,7 @@ xf86RandR12Init12(ScreenPtr pScreen)
     rp->rrProviderSetProperty = xf86RandR14ProviderSetProperty;
     rp->rrProviderGetProperty = xf86RandR14ProviderGetProperty;
     rp->rrCrtcSetScanoutPixmap = xf86CrtcSetScanoutPixmap;
+    rp->rrProviderDestroy = xf86RandR14ProviderDestroy;
 
     pScrn->PointerMoved = xf86RandR12PointerMoved;
     pScrn->ChangeGamma = xf86RandR12ChangeGamma;
diff --git a/randr/randrstr.h b/randr/randrstr.h
index f52d0f2..2517479 100644
--- a/randr/randrstr.h
+++ b/randr/randrstr.h
@@ -232,6 +232,9 @@ typedef Bool (*RRProviderSetOffloadSinkProcPtr)(ScreenPtr pScreen,
                                          RRProviderPtr offload_sink);
 
 
+typedef void (*RRProviderDestroyProcPtr)(ScreenPtr pScreen,
+                                         RRProviderPtr provider);
+
 /* These are for 1.0 compatibility */
 
 typedef struct _rrRefresh {
@@ -330,6 +333,9 @@ typedef struct _rrScrPriv {
     Bool discontiguous;
 
     RRProviderPtr provider;
+
+    RRProviderDestroyProcPtr rrProviderDestroy;
+
 } rrScrPrivRec, *rrScrPrivPtr;
 
 extern _X_EXPORT DevPrivateKeyRec rrPrivKeyRec;
diff --git a/randr/rrprovider.c b/randr/rrprovider.c
index c4ed515..b321e62 100644
--- a/randr/rrprovider.c
+++ b/randr/rrprovider.c
@@ -389,6 +389,8 @@ RRProviderDestroyResource (pointer value, XID pid)
     {
         rrScrPriv(pScreen);
 
+        if (pScrPriv->rrProviderDestroy)
+            (*pScrPriv->rrProviderDestroy)(pScreen, provider);
         pScrPriv->provider = NULL;
     }
     free(provider);
commit 3ec35c45ca17f5ed6fd02c50fc49ae7b8d128dcb
Author: Dave Airlie <airlied at redhat.com>
Date:   Wed Jan 9 12:53:14 2013 +1000

    xf86: actually set the compat output in the failure case
    
    The previous fix for the previous fix, didn't fully work,
    
    If we don't set compat_output we end up doing derferences
    of arrays with -1, leading to valgrind warnings.
    
    Reviewed-by: Chris Wilson <chris at chris-wilson.co.uk>
    Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>
    Signed-off-by: Dave Airlie <airlied at redhat.com>

diff --git a/hw/xfree86/modes/xf86Crtc.c b/hw/xfree86/modes/xf86Crtc.c
index b3ded5a..b52b6ef 100644
--- a/hw/xfree86/modes/xf86Crtc.c
+++ b/hw/xfree86/modes/xf86Crtc.c
@@ -1848,8 +1848,10 @@ SetCompatOutput(xf86CrtcConfigPtr config)
     }
 
     /* All outputs are disconnected, select one to fake */
-    if (!output && config->num_output)
-        output = config->output[0];
+    if (!output && config->num_output) {
+        config->compat_output = 0;
+        output = config->output[config->compat_output];
+    }
 
     return output;
 }
commit da8ee26023fc2868fe970471195a5f3c86fb574b
Author: Dave Airlie <airlied at redhat.com>
Date:   Wed Jan 9 12:51:45 2013 +1000

    xfree86/hotplug: cleanup properly if the screen fails to initialise
    
    Due to another bug, the modesetting/udl driver would fail to init properly
    on hotplug, when it did the code didn't clean up properly, and on removing
    the device the server could crash.
    
    Found in F18 testing.
    
    Signed-off-by: Dave Airlie <airlied at redhat.com>
    Reviewed-by: Aaron Plattner <aplattner at nvidia.com>

diff --git a/hw/xfree86/common/xf86platformBus.c b/hw/xfree86/common/xf86platformBus.c
index 0525e39..5866333 100644
--- a/hw/xfree86/common/xf86platformBus.c
+++ b/hw/xfree86/common/xf86platformBus.c
@@ -438,7 +438,12 @@ xf86platformAddDevice(int index)
     }
 
    scr_index = AddGPUScreen(xf86GPUScreens[i]->ScreenInit, 0, NULL);
-
+   if (scr_index == -1) {
+       xf86DeleteScreen(xf86GPUScreens[i]);
+       xf86UnclaimPlatformSlot(&xf86_platform_devices[index], NULL);
+       xf86NumGPUScreens = old_screens;
+       return -1;
+   }
    dixSetPrivate(&xf86GPUScreens[i]->pScreen->devPrivates,
                  xf86ScreenKey, xf86GPUScreens[i]);
 


More information about the xorg-commit mailing list