diff options
author | Kristian Høgsberg <[email protected]> | 2008-03-12 02:18:12 -0400 |
---|---|---|
committer | Kristian Høgsberg <[email protected]> | 2008-03-12 02:18:12 -0400 |
commit | 9110425c72e45f618131b559eba883fd6c5536b4 (patch) | |
tree | 47c90e48c71f91244b4f3ed541c4a79c7517a5ce /src/glx/x11/glxext.c | |
parent | 94f39f2e7cc7f8ef6915a40d14965e5b193d9952 (diff) |
libGL: Pull the drawable hash back out in the generic code.
This will be shared between dri and dri2 code.
Diffstat (limited to 'src/glx/x11/glxext.c')
-rw-r--r-- | src/glx/x11/glxext.c | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/src/glx/x11/glxext.c b/src/glx/x11/glxext.c index 077398fe33f..1d9be297414 100644 --- a/src/glx/x11/glxext.c +++ b/src/glx/x11/glxext.c @@ -350,6 +350,8 @@ static void FreeScreenConfigs(__GLXdisplayPrivate *priv) #ifdef GLX_DIRECT_RENDERING if (psc->driScreen) psc->driScreen->destroyScreen(psc); + if (psc->drawHash) + __glxHashDestroy(psc->drawHash); #endif } XFree((char*) priv->screenConfigs); @@ -772,8 +774,15 @@ static Bool AllocAndFetchScreenConfigs(Display *dpy, __GLXdisplayPrivate *priv) psc->scr = i; psc->dpy = dpy; #ifdef GLX_DIRECT_RENDERING - if (priv->driDisplay) + if (priv->driDisplay) { + /* Create drawable hash */ + psc->drawHash = __glxHashCreate(); + if (psc->drawHash == NULL) + continue; psc->driScreen = (*priv->driDisplay->createScreen)(psc, i, priv); + if (psc->driScreen == NULL) + __glxHashDestroy(psc->drawHash); + } #endif } SyncHandle(); @@ -1192,7 +1201,13 @@ FetchDRIDrawable(Display *dpy, GLXDrawable drawable, GLXContext gc) if (__glxHashLookup(psc->drawHash, drawable, (void *) &pdraw) == 0) return pdraw; - return psc->driScreen->createDrawable(psc, drawable, gc); + pdraw = psc->driScreen->createDrawable(psc, drawable, gc); + if (__glxHashInsert(psc->drawHash, drawable, pdraw)) { + (*pdraw->destroyDrawable)(pdraw); + return NULL; + } + + return pdraw; } #endif /* GLX_DIRECT_RENDERING */ |