[PATCH] miext/sync: Fix multi-screen support in SyncFence initialization

Keith Packard keithp at keithp.com
Wed Apr 24 14:58:27 PDT 2013


miSyncSetup was checking to see if the screen private key had been
registered, and if so, skipping the setup of the provided screen.

Instead, it should register the private index only once, but then
initialize the screen unless it has already been initialized. This
latter step allows drivers to initialize the sync private structures
before the Sync extension itself is initialized.

Signed-off-by: Keith Packard <keithp at keithp.com>
---
 miext/sync/misync.c |   21 +++++++++++----------
 1 file changed, 11 insertions(+), 10 deletions(-)

diff --git a/miext/sync/misync.c b/miext/sync/misync.c
index d24921a..b6914d1 100644
--- a/miext/sync/misync.c
+++ b/miext/sync/misync.c
@@ -182,20 +182,21 @@ miSyncSetup(ScreenPtr pScreen)
         &miSyncScreenDestroyFence
     };
 
-    if (dixPrivateKeyRegistered(syncScreenPrivateKey))
-        return TRUE;
-
-    if (!dixRegisterPrivateKey(syncScreenPrivateKey, PRIVATE_SCREEN,
-                               sizeof(SyncScreenPrivRec)))
-        return FALSE;
+    if (!dixPrivateKeyRegistered(syncScreenPrivateKey)) {
+        if (!dixRegisterPrivateKey(syncScreenPrivateKey, PRIVATE_SCREEN,
+                                   sizeof(SyncScreenPrivRec)))
+            return FALSE;
+    }
 
     pScreenPriv = SYNC_SCREEN_PRIV(pScreen);
 
-    pScreenPriv->funcs = miSyncScreenFuncs;
+    if (pScreenPriv->funcs.CreateFence) {
+        pScreenPriv->funcs = miSyncScreenFuncs;
 
-    /* Wrap CloseScreen to clean up */
-    pScreenPriv->CloseScreen = pScreen->CloseScreen;
-    pScreen->CloseScreen = SyncCloseScreen;
+        /* Wrap CloseScreen to clean up */
+        pScreenPriv->CloseScreen = pScreen->CloseScreen;
+        pScreen->CloseScreen = SyncCloseScreen;
+    }
 
     return TRUE;
 }
-- 
1.7.10.4



More information about the xorg-devel mailing list