Module: Mesa
Branch: master
Commit: 1f4c55128b7e4a2aa08600ae9338071a97cee8fa
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=1f4c55128b7e4a2aa08600ae9338071a97cee8fa

Author: Chia-I Wu <[email protected]>
Date:   Wed Nov 24 13:42:06 2010 +0800

egl_dri2: Fix one context, multiple surfaces.

When a context was made current to another surface, the old code did
this

  dri2_dpy->core->bindContext(cctx, ddraw, rdraw);
  dri2_dpy->core->unbindContext(old_cctx);

and there will be no current context due to the second line.

unbindContext should be called only when bindContext is not.  This fixes
a regression since d19afc57.  Thanks to Neil Roberts for noticing the
issue and creating a test case.

---

 src/egl/drivers/dri2/egl_dri2.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c
index a83f32b..6f40ab9 100644
--- a/src/egl/drivers/dri2/egl_dri2.c
+++ b/src/egl/drivers/dri2/egl_dri2.c
@@ -1648,7 +1648,11 @@ dri2_make_current(_EGLDriver *drv, _EGLDisplay *disp, 
_EGLSurface *dsurf,
       dri2_destroy_surface(drv, disp, old_dsurf);
       dri2_destroy_surface(drv, disp, old_rsurf);
       if (old_ctx) {
-        dri2_dpy->core->unbindContext(dri2_egl_context(old_ctx)->dri_context);
+         /* unbind the old context only when there is no new context bound */
+         if (!ctx) {
+            __DRIcontext *old_cctx = dri2_egl_context(old_ctx)->dri_context;
+            dri2_dpy->core->unbindContext(old_cctx);
+         }
          /* no destroy? */
          _eglPutContext(old_ctx);
       }

_______________________________________________
mesa-commit mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/mesa-commit

Reply via email to