[Mesa-dev] dri: Properly unbind surfaceless contexts

Submitted by Alexandros Frantzis on Feb. 18, 2014, 11:01 a.m.

Details

Message ID 1392721306-6035-1-git-send-email-alexandros.frantzis@canonical.com
State New
Headers show

Not browsing as part of any series.

Commit Message

Alexandros Frantzis Feb. 18, 2014, 11:01 a.m.
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(-)

Patch hide | download patch | download mbox

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!!! */