aboutsummaryrefslogtreecommitdiffstats
path: root/src/mesa/drivers/dri/common
diff options
context:
space:
mode:
authorJakob Bornecrantz <[email protected]>2010-04-26 15:32:08 +0100
committerJakob Bornecrantz <[email protected]>2010-04-27 12:17:11 +0100
commit64fa717b18272bda2551a6dc2e1a40725b031097 (patch)
tree001f377e8261fb3224a37ed3bbdf19c4efe79e08 /src/mesa/drivers/dri/common
parentae79e778f7fae99812ade79ecf5cf3c783d2a93b (diff)
dri_util: Assume error checking is done properly in glXMakeCurrent
In short what the code did before: __DRIscreen *psp = NULL; if (pcp) psp = pcp->psb; assert(psp); if (psp->stuff) other_stuff(); return psb->even_more(pcp); Remove all that stupid checking which still segfaults/asserts later on and just do what we do in driUnbindContext. Also limited testing show libGL never call driUnbindContext or driBindContext with cPriv == NULL.
Diffstat (limited to 'src/mesa/drivers/dri/common')
-rw-r--r--src/mesa/drivers/dri/common/dri_util.c31
1 files changed, 17 insertions, 14 deletions
diff --git a/src/mesa/drivers/dri/common/dri_util.c b/src/mesa/drivers/dri/common/dri_util.c
index 11c189a6600..d2ffa5da642 100644
--- a/src/mesa/drivers/dri/common/dri_util.c
+++ b/src/mesa/drivers/dri/common/dri_util.c
@@ -153,19 +153,24 @@ static int driBindContext(__DRIcontext *pcp,
{
__DRIscreen *psp = NULL;
- /* Bind the drawable to the context */
+ /*
+ ** Assume error checking is done properly in glXMakeCurrent before
+ ** calling driUnbindContext.
+ */
- if (pcp) {
- psp = pcp->driScreenPriv;
- pcp->driDrawablePriv = pdp;
- pcp->driReadablePriv = prp;
- if (pdp) {
- pdp->driContextPriv = pcp;
- dri_get_drawable(pdp);
- }
- if ( prp && pdp != prp ) {
- dri_get_drawable(prp);
- }
+ if (!pcp)
+ return GL_FALSE;
+
+ /* Bind the drawable to the context */
+ psp = pcp->driScreenPriv;
+ pcp->driDrawablePriv = pdp;
+ pcp->driReadablePriv = prp;
+ if (pdp) {
+ pdp->driContextPriv = pcp;
+ dri_get_drawable(pdp);
+ }
+ if (prp && pdp != prp) {
+ dri_get_drawable(prp);
}
/*
@@ -173,7 +178,6 @@ static int driBindContext(__DRIcontext *pcp,
** initialize the drawable information if has not been done before.
*/
- assert(psp);
if (!psp->dri2.enabled) {
if (pdp && !pdp->pStamp) {
DRM_SPINLOCK(&psp->pSAREA->drawable_lock, psp->drawLockID);
@@ -188,7 +192,6 @@ static int driBindContext(__DRIcontext *pcp,
}
/* Call device-specific MakeCurrent */
-
return (*psp->DriverAPI.MakeCurrent)(pcp, pdp, prp);
}