From c952b3e907ab31cd5f95157c18ce2f81626aafe4 Mon Sep 17 00:00:00 2001 From: Thomas Hellstrom Date: Thu, 2 Apr 2009 10:30:30 +0200 Subject: dri glx: Propagate driver MakeCurrent errors. Signed-off-by: Thomas Hellstrom --- src/mesa/drivers/dri/common/dri_util.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'src/mesa/drivers/dri/common/dri_util.c') diff --git a/src/mesa/drivers/dri/common/dri_util.c b/src/mesa/drivers/dri/common/dri_util.c index ae79055405..a9e37ca51e 100644 --- a/src/mesa/drivers/dri/common/dri_util.c +++ b/src/mesa/drivers/dri/common/dri_util.c @@ -200,9 +200,8 @@ static int driBindContext(__DRIcontext *pcp, } /* Call device-specific MakeCurrent */ - (*psp->DriverAPI.MakeCurrent)(pcp, pdp, prp); - return GL_TRUE; + return (*psp->DriverAPI.MakeCurrent)(pcp, pdp, prp); } /*@}*/ -- cgit v1.2.3 From 8e753d04045a82062ac34d3b2622eb9dba8af374 Mon Sep 17 00:00:00 2001 From: Thomas Hellstrom Date: Thu, 2 Apr 2009 10:36:40 +0200 Subject: dri glx: Fix dri_util::driBindContext 1) Don't error-check here. It's done in glx makeCurrent. 2) Allow ctx and the dri drawables to be NULL for future use. This is currently blocked in glx makeCurrent. 3) Avoid updating dri drawables unless they are completely uninitialized. Since the updating was done outside of the lock, the driver need to verify and redo it anyway. Signed-off-by: Thomas Hellstrom --- src/mesa/drivers/dri/common/dri_util.c | 32 ++++++++++++++------------------ 1 file changed, 14 insertions(+), 18 deletions(-) (limited to 'src/mesa/drivers/dri/common/dri_util.c') diff --git a/src/mesa/drivers/dri/common/dri_util.c b/src/mesa/drivers/dri/common/dri_util.c index a9e37ca51e..38c2e7b00d 100644 --- a/src/mesa/drivers/dri/common/dri_util.c +++ b/src/mesa/drivers/dri/common/dri_util.c @@ -163,21 +163,18 @@ static int driBindContext(__DRIcontext *pcp, { __DRIscreenPrivate *psp = pcp->driScreenPriv; - /* - ** Assume error checking is done properly in glXMakeCurrent before - ** calling driBindContext. - */ - - if (pcp == NULL || pdp == None || prp == None) - return GL_FALSE; - /* Bind the drawable to the context */ - pcp->driDrawablePriv = pdp; - pcp->driReadablePriv = prp; - pdp->driContextPriv = pcp; - pdp->refcount++; - if ( pdp != prp ) { - prp->refcount++; + + if (pcp) { + pcp->driDrawablePriv = pdp; + pcp->driReadablePriv = prp; + if (pdp) { + pdp->driContextPriv = pcp; + pdp->refcount++; + } + if ( prp && pdp != prp ) { + prp->refcount++; + } } /* @@ -186,17 +183,16 @@ static int driBindContext(__DRIcontext *pcp, */ if (!psp->dri2.enabled) { - if (!pdp->pStamp || *pdp->pStamp != pdp->lastStamp) { + if (pdp && !pdp->pStamp) { DRM_SPINLOCK(&psp->pSAREA->drawable_lock, psp->drawLockID); __driUtilUpdateDrawableInfo(pdp); DRM_SPINUNLOCK(&psp->pSAREA->drawable_lock, psp->drawLockID); } - - if ((pdp != prp) && (!prp->pStamp || *prp->pStamp != prp->lastStamp)) { + if (prp && pdp != prp && !prp->pStamp) { DRM_SPINLOCK(&psp->pSAREA->drawable_lock, psp->drawLockID); __driUtilUpdateDrawableInfo(prp); DRM_SPINUNLOCK(&psp->pSAREA->drawable_lock, psp->drawLockID); - } + } } /* Call device-specific MakeCurrent */ -- cgit v1.2.3 From 43c7ffaea635f949fd4803c4f594cf53e4b98f24 Mon Sep 17 00:00:00 2001 From: Younes Manton Date: Mon, 13 Apr 2009 21:24:44 -0400 Subject: dri glx: Swap before checking for cliprects. We don't update drawables anymore unless they are completely uninitialized, so we need to swap even if we don't have cliprects yet, otherwise we never end up calling the driver's SwapBuffers(). The driver should update the drawable in its SwapBuffers() anyway. See 8e753d04045a82062ac34d3b2622eb9dba8af374, "dri glx: Fix dri_util::driBindContext" for the change that exposed it. --- src/mesa/drivers/dri/common/dri_util.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/mesa/drivers/dri/common/dri_util.c') diff --git a/src/mesa/drivers/dri/common/dri_util.c b/src/mesa/drivers/dri/common/dri_util.c index 38c2e7b00d..f620c26000 100644 --- a/src/mesa/drivers/dri/common/dri_util.c +++ b/src/mesa/drivers/dri/common/dri_util.c @@ -311,12 +311,12 @@ static void driSwapBuffers(__DRIdrawable *dPriv) __DRIscreen *psp = dPriv->driScreenPriv; drm_clip_rect_t *rects; int i; - - if (!dPriv->numClipRects) - return; psp->DriverAPI.SwapBuffers(dPriv); + if (!dPriv->numClipRects) + return; + rects = _mesa_malloc(sizeof(*rects) * dPriv->numClipRects); if (!rects) -- cgit v1.2.3 From 3264352c577ce1d6681e70abd76624ede906df71 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Thu, 16 Apr 2009 13:06:24 +1000 Subject: dri: attempt to actually refcount the __DRIDrawable valgrind was showing a race between the drawable getting destroyed by the X resource freeing code, and the context getting destroyed later and freeing the drawable. However I've no idea if some other combination of things could cause this code to leak. --- src/mesa/drivers/dri/common/dri_util.c | 32 ++++++++++++++++++++++++-------- 1 file changed, 24 insertions(+), 8 deletions(-) (limited to 'src/mesa/drivers/dri/common/dri_util.c') diff --git a/src/mesa/drivers/dri/common/dri_util.c b/src/mesa/drivers/dri/common/dri_util.c index 38c2e7b00d..0ec4adc232 100644 --- a/src/mesa/drivers/dri/common/dri_util.c +++ b/src/mesa/drivers/dri/common/dri_util.c @@ -37,6 +37,9 @@ typedef GLboolean ( * PFNGLXGETMSCRATEOMLPROC) (__DRIdrawable *drawable, int32_t *numerator, int32_t *denominator); #endif +static void dri_get_drawable(__DRIdrawable *pdp); +static void dri_put_drawable(__DRIdrawable *pdp); + /** * This is just a token extension used to signal that the driver * supports setting a read drawable. @@ -127,7 +130,7 @@ static int driUnbindContext(__DRIcontext *pcp) return GL_FALSE; } - pdp->refcount--; + dri_put_drawable(pdp); if (prp != pdp) { if (prp->refcount == 0) { @@ -135,7 +138,7 @@ static int driUnbindContext(__DRIcontext *pcp) return GL_FALSE; } - prp->refcount--; + dri_put_drawable(prp); } @@ -170,10 +173,10 @@ static int driBindContext(__DRIcontext *pcp, pcp->driReadablePriv = prp; if (pdp) { pdp->driContextPriv = pcp; - pdp->refcount++; + dri_get_drawable(pdp); } if ( prp && pdp != prp ) { - prp->refcount++; + dri_get_drawable(prp); } } @@ -430,7 +433,7 @@ driCreateNewDrawable(__DRIscreen *psp, const __DRIconfig *config, pdp->loaderPrivate = data; pdp->hHWDrawable = hwDrawable; - pdp->refcount = 0; + pdp->refcount = 1; pdp->pStamp = NULL; pdp->lastStamp = 0; pdp->index = 0; @@ -483,12 +486,19 @@ dri2CreateNewDrawable(__DRIscreen *screen, return pdraw; } - -static void -driDestroyDrawable(__DRIdrawable *pdp) +static void dri_get_drawable(__DRIdrawable *pdp) +{ + pdp->refcount++; +} + +static void dri_put_drawable(__DRIdrawable *pdp) { __DRIscreenPrivate *psp; + pdp->refcount--; + if (pdp->refcount) + return; + if (pdp) { psp = pdp->driScreenPriv; (*psp->DriverAPI.DestroyBuffer)(pdp); @@ -504,6 +514,12 @@ driDestroyDrawable(__DRIdrawable *pdp) } } +static void +driDestroyDrawable(__DRIdrawable *pdp) +{ + dri_put_drawable(pdp); +} + /*@}*/ -- cgit v1.2.3 From e1a8852aa49b535a4fcec4eefda3fb7f8e57a5cc Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 16 Apr 2009 16:37:53 -0600 Subject: dri: __driUtilMessage(): not all messages are errors --- src/mesa/drivers/dri/common/dri_util.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/mesa/drivers/dri/common/dri_util.c') diff --git a/src/mesa/drivers/dri/common/dri_util.c b/src/mesa/drivers/dri/common/dri_util.c index f620c26000..e112720471 100644 --- a/src/mesa/drivers/dri/common/dri_util.c +++ b/src/mesa/drivers/dri/common/dri_util.c @@ -59,7 +59,7 @@ __driUtilMessage(const char *f, ...) va_list args; if (getenv("LIBGL_DEBUG")) { - fprintf(stderr, "libGL error: \n"); + fprintf(stderr, "libGL: "); va_start(args, f); vfprintf(stderr, f, args); va_end(args); -- cgit v1.2.3 From 77506dac8e81e9548a7e9680ce367175fe5747af Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Thu, 11 Jun 2009 10:50:32 +1000 Subject: GLX: attempt to fix glean makeCurrent test cases. Two parts to this: One we don't keep pointers to possibly freed memory anymore once we unbind the drawables from the context. Brian I need to figure out what the comment you made there, can we get a glean/piglit test so we can fix it properly? If the new gc is the same as the oldGC, we call the unbind even though we just bound it in that function. doh. --- src/glx/x11/glxcurrent.c | 2 +- src/mesa/drivers/dri/common/dri_util.c | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) (limited to 'src/mesa/drivers/dri/common/dri_util.c') diff --git a/src/glx/x11/glxcurrent.c b/src/glx/x11/glxcurrent.c index 01f4233241..d44e0dd1fc 100644 --- a/src/glx/x11/glxcurrent.c +++ b/src/glx/x11/glxcurrent.c @@ -457,7 +457,7 @@ MakeContextCurrent(Display * dpy, GLXDrawable draw, &dummy_reply); } #ifdef GLX_DIRECT_RENDERING - else if (oldGC->driContext) { + else if (oldGC->driContext && oldGC != gc) { oldGC->driContext->unbindContext(oldGC->driContext); } #endif diff --git a/src/mesa/drivers/dri/common/dri_util.c b/src/mesa/drivers/dri/common/dri_util.c index ae0e61e515..2b1493a6de 100644 --- a/src/mesa/drivers/dri/common/dri_util.c +++ b/src/mesa/drivers/dri/common/dri_util.c @@ -122,6 +122,9 @@ static int driUnbindContext(__DRIcontext *pcp) pdp = pcp->driDrawablePriv; prp = pcp->driReadablePriv; + /* already unbound */ + if (!pdp && !prp) + return GL_TRUE; /* Let driver unbind drawable from context */ (*psp->DriverAPI.UnbindContext)(pcp); @@ -146,9 +149,10 @@ static int driUnbindContext(__DRIcontext *pcp) * 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 */ - pcp->driDrawablePriv = NULL; pdp->driContextPriv = &psp->dummyContextPriv; #endif -- cgit v1.2.3 From bf71ece171305f80972f6e401442372618265fcb Mon Sep 17 00:00:00 2001 From: "RALOVICH, Kristóf" Date: Sun, 5 Jul 2009 16:29:44 +0200 Subject: glx: death to RCS tag --- src/mesa/drivers/dri/common/dri_util.c | 1 - 1 file changed, 1 deletion(-) (limited to 'src/mesa/drivers/dri/common/dri_util.c') diff --git a/src/mesa/drivers/dri/common/dri_util.c b/src/mesa/drivers/dri/common/dri_util.c index 2b1493a6de..1d940603fa 100644 --- a/src/mesa/drivers/dri/common/dri_util.c +++ b/src/mesa/drivers/dri/common/dri_util.c @@ -1,4 +1,3 @@ -/* $XFree86: xc/lib/GL/dri/dri_util.c,v 1.7 2003/04/28 17:01:25 dawes Exp $ */ /** * \file dri_util.c * DRI utility functions. -- cgit v1.2.3 From 0d7fafa0ed706a2053944e9b25068dfed6339a0c Mon Sep 17 00:00:00 2001 From: Pauli Nieminen Date: Fri, 7 Aug 2009 10:02:22 -0700 Subject: dri: Fix problems with unitialized values in dri screen object. This fixes crash in r200 KMS driver when pSAREA was set to 1 randomly because of memory wasn't cleared. Signed-off-by: Pauli Nieminen --- src/mesa/drivers/dri/common/dri_util.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/mesa/drivers/dri/common/dri_util.c') diff --git a/src/mesa/drivers/dri/common/dri_util.c b/src/mesa/drivers/dri/common/dri_util.c index 1d940603fa..e48e10d7c0 100644 --- a/src/mesa/drivers/dri/common/dri_util.c +++ b/src/mesa/drivers/dri/common/dri_util.c @@ -778,7 +778,7 @@ dri2CreateNewScreen(int scrn, int fd, if (driDriverAPI.InitScreen2 == NULL) return NULL; - psp = _mesa_malloc(sizeof(*psp)); + psp = _mesa_calloc(sizeof(*psp)); if (!psp) return NULL; -- cgit v1.2.3 From 45e3be3c07f543f3f2869ba7750ba4695cd25122 Mon Sep 17 00:00:00 2001 From: Pauli Nieminen Date: Tue, 4 Aug 2009 01:39:37 +0300 Subject: glx: Make drawables persistent untill they are changed by glXMakeCurrent This fixes bug that xdemos/manywin would segfault if it was run with command ./manywin 2. Demo is tring to call glXSwapBuffers while another context was bind using glXMakeCurrent. Fix is simple makes drawable and readable persistent untill they change or context is destroyed. I found a logic error when same dri context is used for multiple drawables which caused readable and drawable to fall out of sync in special case. Fix is simple just updating drawables more often than in original patch. Signed-off-by: Pauli Nieminen --- src/mesa/drivers/dri/common/dri_util.c | 121 ++++++++++++++++++++++----------- 1 file changed, 80 insertions(+), 41 deletions(-) (limited to 'src/mesa/drivers/dri/common/dri_util.c') diff --git a/src/mesa/drivers/dri/common/dri_util.c b/src/mesa/drivers/dri/common/dri_util.c index e48e10d7c0..d7bcd565d7 100644 --- a/src/mesa/drivers/dri/common/dri_util.c +++ b/src/mesa/drivers/dri/common/dri_util.c @@ -82,6 +82,46 @@ 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 */ /*****************************************************************/ @@ -106,8 +146,6 @@ driIntersectArea( drm_clip_rect_t rect1, drm_clip_rect_t rect2 ) static int driUnbindContext(__DRIcontext *pcp) { __DRIscreen *psp; - __DRIdrawable *pdp; - __DRIdrawable *prp; /* ** Assume error checking is done properly in glXMakeCurrent before @@ -118,38 +156,10 @@ static int driUnbindContext(__DRIcontext *pcp) 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 */ + /* 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; @@ -171,17 +181,44 @@ static int driBindContext(__DRIcontext *pcp, /* Bind the drawable to the context */ - 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); + 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; + + } } - } /* ** Now that we have a context associated with this drawable, we can @@ -542,6 +579,7 @@ static void driDestroyContext(__DRIcontext *pcp) { if (pcp) { + driFreeDrawable(pcp); (*pcp->driScreenPriv->DriverAPI.DestroyContext)(pcp); _mesa_free(pcp); } @@ -579,6 +617,7 @@ 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. -- cgit v1.2.3 From 418cdc66ec10c1f3005320ab46404b907c30e37d Mon Sep 17 00:00:00 2001 From: Pauli Nieminen Date: Tue, 25 Aug 2009 05:03:58 +0300 Subject: 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. --- src/mesa/drivers/dri/common/dri_util.c | 121 +++++++++++---------------------- 1 file changed, 41 insertions(+), 80 deletions(-) (limited to 'src/mesa/drivers/dri/common/dri_util.c') 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. -- cgit v1.2.3