[Mesa-dev] [PATCH] Releasing a surfaceless EGL context doesn't release underlying DRI context.

Kalyan Kondapally kondapallykalyancontribute at gmail.com
Fri Oct 24 03:03:13 PDT 2014


From: Alexandros Frantzis <Alexandros.Frantzis at canonical.com>

driUnbindContext() checks for valid drawables before calling the driver
unbind function. In case of Surfaceless contexts, the drawables are always
Null and we end up not releasing the underlying DRI context. Moving the
call to the driver function before the drawable validity checks fixes things.

Signed-off-by: Alexandros Frantzis <Alexandros.Frantzis at canonical.com>
Signed-off-by: Kalyan Kondapally <kalyan.kondapally at intel.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=74563
---
 src/mesa/drivers/dri/common/dri_util.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/src/mesa/drivers/dri/common/dri_util.c b/src/mesa/drivers/dri/common/dri_util.c
index 6c78928..02499f2 100644
--- a/src/mesa/drivers/dri/common/dri_util.c
+++ b/src/mesa/drivers/dri/common/dri_util.c
@@ -569,6 +569,12 @@ static int driUnbindContext(__DRIcontext *pcp)
     if (pcp == NULL)
 	return GL_FALSE;
 
+    /*
+    ** Call driUnbindContext before checking for valid drawables
+    ** to handle surfaceless contexts properly.
+    */
+    pcp->driScreenPriv->driver->UnbindContext(pcp);
+
     pdp = pcp->driDrawablePriv;
     prp = pcp->driReadablePriv;
 
@@ -576,8 +582,6 @@ static int driUnbindContext(__DRIcontext *pcp)
     if (!pdp && !prp)
 	return GL_TRUE;
 
-    pcp->driScreenPriv->driver->UnbindContext(pcp);
-
     assert(pdp);
     if (pdp->refcount == 0) {
 	/* ERROR!!! */
-- 
1.9.1



More information about the mesa-dev mailing list