From f37972f4a67b49ba9649310a6778bd1bf31e0130 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Wed, 24 Apr 2013 14:58:27 -0700 Subject: [PATCH] miext/sync: Fix multi-screen support in SyncFence initialization 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. Reviewed-by: Adam Jackson Signed-off-by: Keith Packard --- 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 d24921a18..b6914d18d 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; }