static int driUnbindContext(__DRIcontext *pcp) { __DRIdrawable *pdp; __DRIdrawable *prp; if (pcp == NULL) return GL_FALSE; pdp = pcp->driDrawablePriv; prp = pcp->driReadablePriv; /* already unbound */ if (!pdp && !prp) return GL_TRUE; driDriverAPI.UnbindContext(pcp); dri_put_drawable(pdp); if (prp != pdp) { dri_put_drawable(prp); } pcp->driDrawablePriv = NULL; pcp->driReadablePriv = NULL; return GL_TRUE; }
/** * Unbind context. * * \param scrn the screen. * \param gc context. * * \return \c GL_TRUE on success, or \c GL_FALSE on failure. * * \internal * This function calls __DriverAPIRec::UnbindContext, and then decrements * __DRIdrawableRec::refcount which must be non-zero for a successful * return. * * While casting the opaque private pointers associated with the parameters * into their respective real types it also assures they are not \c NULL. */ static int driUnbindContext(__DRIcontext *pcp) { __DRIscreen *psp; __DRIdrawable *pdp; __DRIdrawable *prp; /* ** Assume error checking is done properly in glXMakeCurrent before ** calling driUnbindContext. */ if (pcp == NULL) return GL_FALSE; psp = pcp->driScreenPriv; pdp = pcp->driDrawablePriv; prp = pcp->driReadablePriv; /* already unbound */ if (!pdp && !prp) return GL_TRUE; /* Let driver unbind drawable from context */ (*psp->DriverAPI.UnbindContext)(pcp); assert(pdp); if (pdp->refcount == 0) { /* ERROR!!! */ return GL_FALSE; } dri_put_drawable(pdp); if (prp != pdp) { if (prp->refcount == 0) { /* ERROR!!! */ return GL_FALSE; } dri_put_drawable(prp); } /* XXX this is disabled so that if we call SwapBuffers on an unbound * window we can determine the last context bound to the window and * use that context's lock. (BrianP, 2-Dec-2000) */ pcp->driDrawablePriv = pcp->driReadablePriv = NULL; return GL_TRUE; }
/** * Unbind context. * * \param scrn the screen. * \param gc context. * * \return \c GL_TRUE on success, or \c GL_FALSE on failure. * * \internal * This function calls __DriverAPIRec::UnbindContext, and then decrements * __DRIdrawableRec::refcount which must be non-zero for a successful * return. * * While casting the opaque private pointers associated with the parameters * into their respective real types it also assures they are not \c NULL. */ static int driUnbindContext(__DRIcontext *pcp) { __DRIdrawable *pdp; __DRIdrawable *prp; /* ** Assume error checking is done properly in glXMakeCurrent before ** calling driUnbindContext. */ if (pcp == NULL) return GL_FALSE; /* ** Call driUnbindContext before checking for valid drawables ** to handle surfaceless contexts properly. */ pcp->driScreenPriv->driver->UnbindContext(pcp); pdp = pcp->driDrawablePriv; prp = pcp->driReadablePriv; /* already unbound */ if (!pdp && !prp) return GL_TRUE; assert(pdp); if (pdp->refcount == 0) { /* ERROR!!! */ return GL_FALSE; } dri_put_drawable(pdp); if (prp != pdp) { if (prp->refcount == 0) { /* ERROR!!! */ return GL_FALSE; } dri_put_drawable(prp); } pcp->driDrawablePriv = NULL; pcp->driReadablePriv = NULL; return GL_TRUE; }
static void driDestroyDrawable(__DRIdrawable *pdp) { /* * The loader's data structures are going away, even if pdp itself stays * around for the time being because it is currently bound. This happens * when a currently bound GLX pixmap is destroyed. * * Clear out the pointer back into the loader's data structures to avoid * accessing an outdated pointer. */ pdp->loaderPrivate = NULL; dri_put_drawable(pdp); }
static void driDestroyDrawable(__DRIdrawable *pdp) { dri_put_drawable(pdp); }