diff options
author | Pauli Nieminen <suokkos@gmail.com> | 2009-08-25 05:03:58 +0300 |
---|---|---|
committer | Pauli Nieminen <suokkos@gmail.com> | 2009-08-25 05:07:08 +0300 |
commit | 418cdc66ec10c1f3005320ab46404b907c30e37d (patch) | |
tree | 3349ca203b1e89fffc6d64776b5902f69dbaf0a2 | |
parent | ce7ed63f0c2f5cb1c030f73a5d8f6544eaac0f81 (diff) |
Revert "glx: Make drawables persistent untill they are changed by glXMakeCurrent"
This commit was not mean to end in to master yet. It is still queston if this
right design to fix the problem.
This reverts commit 45e3be3c07f543f3f2869ba7750ba4695cd25122.
-rw-r--r-- | src/mesa/drivers/dri/common/dri_util.c | 121 |
1 files changed, 41 insertions, 80 deletions
diff --git a/src/mesa/drivers/dri/common/dri_util.c b/src/mesa/drivers/dri/common/dri_util.c index d7bcd565d7..e48e10d7c0 100644 --- a/src/mesa/drivers/dri/common/dri_util.c +++ b/src/mesa/drivers/dri/common/dri_util.c @@ -82,46 +82,6 @@ driIntersectArea( drm_clip_rect_t rect1, drm_clip_rect_t rect2 ) return (rect1.x2 - rect1.x1) * (rect1.y2 - rect1.y1); } -static int driFreeDrawable(__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; - - 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; -} - /*****************************************************************/ /** \name Context (un)binding functions */ /*****************************************************************/ @@ -146,6 +106,8 @@ static int driFreeDrawable(__DRIcontext *pcp) static int driUnbindContext(__DRIcontext *pcp) { __DRIscreen *psp; + __DRIdrawable *pdp; + __DRIdrawable *prp; /* ** Assume error checking is done properly in glXMakeCurrent before @@ -156,10 +118,38 @@ static int driUnbindContext(__DRIcontext *pcp) return GL_FALSE; psp = pcp->driScreenPriv; + pdp = pcp->driDrawablePriv; + prp = pcp->driReadablePriv; - /* Let driver unbind drawable from context */ + /* already unbound */ + if (!pdp && !prp) + return GL_TRUE; + /* Let driver unbind drawable from context */ (*psp->DriverAPI.UnbindContext)(pcp); + 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; + #if 0 /* Unbind the drawable */ pdp->driContextPriv = &psp->dummyContextPriv; @@ -181,44 +171,17 @@ static int driBindContext(__DRIcontext *pcp, /* Bind the drawable to the context */ - if (pcp) { - - if (pcp->driDrawablePriv != pdp - || pcp->driReadablePriv != prp) - { - /* first increment ref count for new drawables */ - - if (pdp) - { - pdp->driContextPriv = pcp; - dri_get_drawable(pdp); - } - - if (prp && prp != pdp) - { - dri_get_drawable(prp); - } - - /* free old drawables */ - - if (pcp->driReadablePriv - && pcp->driReadablePriv != pcp->driDrawablePriv) - { - dri_put_drawable(pcp->driReadablePriv); - } - - if (pcp->driDrawablePriv) - { - dri_put_drawable(pcp->driDrawablePriv); - } - - /* assign new drawables to context */ - - pcp->driDrawablePriv = pdp; - pcp->driReadablePriv = prp; - - } + if (pcp) { + pcp->driDrawablePriv = pdp; + pcp->driReadablePriv = prp; + if (pdp) { + pdp->driContextPriv = pcp; + dri_get_drawable(pdp); } + if ( prp && pdp != prp ) { + dri_get_drawable(prp); + } + } /* ** Now that we have a context associated with this drawable, we can @@ -579,7 +542,6 @@ static void driDestroyContext(__DRIcontext *pcp) { if (pcp) { - driFreeDrawable(pcp); (*pcp->driScreenPriv->DriverAPI.DestroyContext)(pcp); _mesa_free(pcp); } @@ -617,7 +579,6 @@ driCreateNewContext(__DRIscreen *psp, const __DRIconfig *config, pcp->driScreenPriv = psp; pcp->driDrawablePriv = NULL; - pcp->driReadablePriv = NULL; /* When the first context is created for a screen, initialize a "dummy" * context. |