[Mesa-dev] [PATCH] dri: Properly unbind surfaceless contexts

Alexandros Frantzis alexandros.frantzis at canonical.com
Tue Feb 18 03:01:46 PST 2014


In driUnbindContext(), call the driver UnbindContext function even if
both the draw and read drawables are NULL, since we may be dealing with
a surfaceless context.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=74563
---
 src/mesa/drivers/dri/common/dri_util.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/src/mesa/drivers/dri/common/dri_util.c b/src/mesa/drivers/dri/common/dri_util.c
index d09d50a..20b2c0b 100644
--- a/src/mesa/drivers/dri/common/dri_util.c
+++ b/src/mesa/drivers/dri/common/dri_util.c
@@ -572,15 +572,19 @@ static int driUnbindContext(__DRIcontext *pcp)
     if (pcp == NULL)
 	return GL_FALSE;
 
+    /*
+     * Unbind the context even if pdp and prp are NULL, since
+     * the context may be surfaceless.
+     */
+    pcp->driScreenPriv->driver->UnbindContext(pcp);
+
     pdp = pcp->driDrawablePriv;
     prp = pcp->driReadablePriv;
 
-    /* already unbound */
+    /* already unbound or surfaceless */
     if (!pdp && !prp)
 	return GL_TRUE;
 
-    pcp->driScreenPriv->driver->UnbindContext(pcp);
-
     assert(pdp);
     if (pdp->refcount == 0) {
 	/* ERROR!!! */
-- 
1.9.rc1



More information about the mesa-dev mailing list