commit 7972e2dade58158bb98f5b7dc5f873b9fb3446de Author: Chris Wilson Date: Thu Aug 25 16:04:04 2011 +0100 dri2: Register the DRI2DrawableType after server regeneration The Resource database is reset upon regeneration and so the dri2 module needs to re-register its RESTYPE for the drawable or else it will clobber the next unsuspecting user of the database. Fortunately, DRI2 is loaded late in the initialisation sequence and was last up until xf86-video-intel started using the Resource database to track outstanding swaps... Signed-off-by: Chris Wilson Reviewed-by: Jeremy Huddleston Tested-by: Paulo Zanoni (cherry picked from commit 34b0e4eee911f8b09a3682a7f1b4c8598ef48b8d) diff --git a/hw/xfree86/dri2/dri2.c b/hw/xfree86/dri2/dri2.c index d71e4f4..f7f7000 100644 --- a/hw/xfree86/dri2/dri2.c +++ b/hw/xfree86/dri2/dri2.c @@ -1194,14 +1194,24 @@ DRI2CloseScreen(ScreenPtr pScreen) } extern ExtensionModule dri2ExtensionModule; +extern Bool DRI2ModuleSetup(void); + +/* Called by InitExtensions() */ +Bool +DRI2ModuleSetup(void) +{ + dri2DrawableRes = CreateNewResourceType(DRI2DrawableGone, "DRI2Drawable"); + if (!dri2DrawableRes) + return FALSE; + + return TRUE; +} static pointer DRI2Setup(pointer module, pointer opts, int *errmaj, int *errmin) { static Bool setupDone = FALSE; - dri2DrawableRes = CreateNewResourceType(DRI2DrawableGone, "DRI2Drawable"); - if (!setupDone) { setupDone = TRUE; diff --git a/hw/xfree86/dri2/dri2ext.c b/hw/xfree86/dri2/dri2ext.c index 552b26b..a2198e2 100644 --- a/hw/xfree86/dri2/dri2ext.c +++ b/hw/xfree86/dri2/dri2ext.c @@ -50,6 +50,7 @@ #include "xf86Module.h" static ExtensionEntry *dri2Extension; +extern Bool DRI2ModuleSetup(void); static Bool validDrawable(ClientPtr client, XID drawable, Mask access_mode, @@ -636,6 +637,8 @@ DRI2ExtensionInit(void) StandardMinorOpcode); DRI2EventBase = dri2Extension->eventBase; + + DRI2ModuleSetup(); } extern Bool noDRI2Extension;