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 <ajax@redhat.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
This commit is contained in:
Keith Packard 2013-04-24 14:58:27 -07:00 committed by Adam Jackson
parent 1c8beedfe4
commit f37972f4a6

View File

@ -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;
}