xserver: Branch 'master'

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed Nov 13 18:00:46 UTC 2019


 hw/xfree86/common/xf86Init.c |   50 +++++++++++++++++++++----------------------
 1 file changed, 25 insertions(+), 25 deletions(-)

New commits:
commit e5e9a8ca91d1c087edd8788a110251ad940dbc94
Author: Aaron Plattner <aplattner at nvidia.com>
Date:   Wed Nov 6 10:45:43 2019 -0800

    xfree86: Call ScreenInit for protocol screens before GPU screens
    
    During startup, the xfree86 DDX's InitOutput() calls PreInit for
    protocol screens first, and then GPU screens. On teardown, dix_main()
    calls CloseScreen in the reverse order: GPU screens first starting with
    the last one and then working backwards, and then protocol screens also
    in reverse order.
    
    InitOutput() calls ScreenInit in the wrong order: for GPU screens first and then
    for protocol screens. This causes a problem for drivers that have global state
    that is tied to the first screen that calls ScreenInit.
    
    Fix this by simply re-ordering the for loops to call PreInit for
    protocol screens first and then for GPU screens second.

diff --git a/hw/xfree86/common/xf86Init.c b/hw/xfree86/common/xf86Init.c
index 6cc2f0b01..0631c7237 100644
--- a/hw/xfree86/common/xf86Init.c
+++ b/hw/xfree86/common/xf86Init.c
@@ -620,31 +620,6 @@ InitOutput(ScreenInfo * pScreenInfo, int argc, char **argv)
     if (!dixRegisterPrivateKey(&xf86ScreenKeyRec, PRIVATE_SCREEN, 0))
         FatalError("Cannot register DDX private keys");
 
-    for (i = 0; i < xf86NumGPUScreens; i++) {
-        ScrnInfoPtr pScrn = xf86GPUScreens[i];
-        xf86VGAarbiterLock(pScrn);
-
-        /*
-         * Almost everything uses these defaults, and many of those that
-         * don't, will wrap them.
-         */
-        pScrn->EnableDisableFBAccess = xf86EnableDisableFBAccess;
-#ifdef XFreeXDGA
-        pScrn->SetDGAMode = xf86SetDGAMode;
-#endif
-        scr_index = AddGPUScreen(xf86ScreenInit, argc, argv);
-        xf86VGAarbiterUnlock(pScrn);
-        if (scr_index == i) {
-            dixSetPrivate(&screenInfo.gpuscreens[scr_index]->devPrivates,
-                          xf86ScreenKey, xf86GPUScreens[i]);
-            pScrn->pScreen = screenInfo.gpuscreens[scr_index];
-            /* The driver should set this, but make sure it is set anyway */
-            pScrn->vtSema = TRUE;
-        } else {
-            FatalError("AddScreen/ScreenInit failed for gpu driver %d %d\n", i, scr_index);
-        }
-    }
-
     for (i = 0; i < xf86NumScreens; i++) {
         xf86VGAarbiterLock(xf86Screens[i]);
         /*
@@ -690,6 +665,31 @@ InitOutput(ScreenInfo * pScreenInfo, int argc, char **argv)
         xf86EnsureRANDR(xf86Screens[i]->pScreen);
     }
 
+    for (i = 0; i < xf86NumGPUScreens; i++) {
+        ScrnInfoPtr pScrn = xf86GPUScreens[i];
+        xf86VGAarbiterLock(pScrn);
+
+        /*
+         * Almost everything uses these defaults, and many of those that
+         * don't, will wrap them.
+         */
+        pScrn->EnableDisableFBAccess = xf86EnableDisableFBAccess;
+#ifdef XFreeXDGA
+        pScrn->SetDGAMode = xf86SetDGAMode;
+#endif
+        scr_index = AddGPUScreen(xf86ScreenInit, argc, argv);
+        xf86VGAarbiterUnlock(pScrn);
+        if (scr_index == i) {
+            dixSetPrivate(&screenInfo.gpuscreens[scr_index]->devPrivates,
+                          xf86ScreenKey, xf86GPUScreens[i]);
+            pScrn->pScreen = screenInfo.gpuscreens[scr_index];
+            /* The driver should set this, but make sure it is set anyway */
+            pScrn->vtSema = TRUE;
+        } else {
+            FatalError("AddScreen/ScreenInit failed for gpu driver %d %d\n", i, scr_index);
+        }
+    }
+
     for (i = 0; i < xf86NumGPUScreens; i++)
         AttachUnboundGPU(xf86Screens[0]->pScreen, xf86GPUScreens[i]->pScreen);
 


More information about the xorg-commit mailing list