/* ** Free a context. */ GLboolean __glXFreeContext(__GLXcontext * cx) { if (cx->idExists || cx->isCurrent) return GL_FALSE; free(cx->feedbackBuf); free(cx->selectBuf); if (cx == __glXLastContext) { __glXFlushContextCache(); } __glXRemoveFromContextList(cx); /* We can get here through both regular dispatching from * __glXDispatch() or as a callback from the resource manager. In * the latter case we need to lift the DRI lock manually. */ if (!glxBlockClients) { __glXleaveServer(GL_FALSE); cx->destroy(cx); __glXenterServer(GL_FALSE); } else { cx->next = glxPendingDestroyContexts; glxPendingDestroyContexts = cx; } return GL_TRUE; }
/* ** Called when the extension is reset. */ static void ResetExtension(ExtensionEntry * extEntry) { __glXFlushContextCache(); __glXScreenReset(); SwapBarrierReset(); }
/* ** Free a context. */ GLboolean __glXFreeContext(__GLXcontext * cx) { if (cx->idExists || cx->isCurrent) return GL_FALSE; free(cx->feedbackBuf); free(cx->selectBuf); free(cx->real_ids); free(cx->real_vids); if (cx->pGlxPixmap) { /* ** The previous drawable was a glx pixmap, release it. */ cx->pGlxPixmap->refcnt--; __glXFreeGLXPixmap(cx->pGlxPixmap); cx->pGlxPixmap = 0; } if (cx->pGlxReadPixmap) { /* ** The previous drawable was a glx pixmap, release it. */ cx->pGlxReadPixmap->refcnt--; __glXFreeGLXPixmap(cx->pGlxReadPixmap); cx->pGlxReadPixmap = 0; } if (cx->pGlxWindow) { /* ** The previous drawable was a glx window, release it. */ cx->pGlxWindow->refcnt--; __glXFreeGLXWindow(cx->pGlxWindow); cx->pGlxWindow = 0; } if (cx->pGlxReadWindow) { /* ** The previous drawable was a glx window, release it. */ cx->pGlxReadWindow->refcnt--; __glXFreeGLXWindow(cx->pGlxReadWindow); cx->pGlxReadWindow = 0; } free(cx); if (cx == __glXLastContext) { __glXFlushContextCache(); } return GL_TRUE; }
/* ** Destroy routine that gets called when a drawable is freed. A drawable ** contains the ancillary buffers needed for rendering. */ static Bool DrawableGone(__GLXdrawable * glxPriv, XID xid) { __GLXcontext *c, *next; if (glxPriv->type == GLX_DRAWABLE_WINDOW) { /* If this was created by glXCreateWindow, free the matching resource */ if (glxPriv->drawId != glxPriv->pDraw->id) { if (xid == glxPriv->drawId) FreeResourceByType(glxPriv->pDraw->id, __glXDrawableRes, TRUE); else FreeResourceByType(glxPriv->drawId, __glXDrawableRes, TRUE); } /* otherwise this window was implicitly created by MakeCurrent */ } for (c = glxAllContexts; c; c = next) { next = c->next; if (c->isCurrent && (c->drawPriv == glxPriv || c->readPriv == glxPriv)) { if (GET_DISPATCH()) FlushContext(c); /* Only flush if we still have a context */ (*c->loseCurrent) (c); c->isCurrent = GL_FALSE; if (c == __glXLastContext) __glXFlushContextCache(); } if (c->drawPriv == glxPriv) c->drawPriv = NULL; if (c->readPriv == glxPriv) c->readPriv = NULL; } /* drop our reference to any backing pixmap */ if (glxPriv->type == GLX_DRAWABLE_PIXMAP) glxPriv->pDraw->pScreen->DestroyPixmap((PixmapPtr) glxPriv->pDraw); glxPriv->destroy(glxPriv); return True; }
/* ** Called when the extension is reset. */ static void ResetExtension(ExtensionEntry * extEntry) { __glXFlushContextCache(); }