summaryrefslogtreecommitdiffstats
path: root/src/egl/drivers/glx
diff options
context:
space:
mode:
authorChia-I Wu <olvaffe@gmail.com>2010-01-28 16:57:49 +0800
committerChia-I Wu <olvaffe@gmail.com>2010-01-28 17:28:48 +0800
commit6baa2c8d022e5dd1e305e7da2925c1e6f9370f35 (patch)
treec354b4fb532e992c42563bec2b63b668bf453e85 /src/egl/drivers/glx
parent45ba53324341234144ca02122bf2c0b5ef58c361 (diff)
downloadexternal_mesa3d-6baa2c8d022e5dd1e305e7da2925c1e6f9370f35.zip
external_mesa3d-6baa2c8d022e5dd1e305e7da2925c1e6f9370f35.tar.gz
external_mesa3d-6baa2c8d022e5dd1e305e7da2925c1e6f9370f35.tar.bz2
egl: Migrate drivers to use _eglBindContext.
_eglMakeCurrent is a big hammer that is not easy to use. Migrate drivers to use _eglBindContext and un-export _eglMakeCurrent.
Diffstat (limited to 'src/egl/drivers/glx')
-rw-r--r--src/egl/drivers/glx/egl_glx.c20
1 files changed, 16 insertions, 4 deletions
diff --git a/src/egl/drivers/glx/egl_glx.c b/src/egl/drivers/glx/egl_glx.c
index 5efb72e..1c38db6 100644
--- a/src/egl/drivers/glx/egl_glx.c
+++ b/src/egl/drivers/glx/egl_glx.c
@@ -660,8 +660,10 @@ GLX_eglMakeCurrent(_EGLDriver *drv, _EGLDisplay *disp, _EGLSurface *dsurf,
struct GLX_egl_context *GLX_ctx = GLX_egl_context(ctx);
GLXDrawable ddraw, rdraw;
GLXContext cctx;
+ EGLBoolean ret = EGL_FALSE;
- if (!_eglMakeCurrent(drv, disp, dsurf, rsurf, ctx))
+ /* bind the new context and return the "orphaned" one */
+ if (!_eglBindContext(&ctx, &dsurf, &rsurf))
return EGL_FALSE;
ddraw = (GLX_dsurf) ? GLX_dsurf->glx_drawable : None;
@@ -669,11 +671,21 @@ GLX_eglMakeCurrent(_EGLDriver *drv, _EGLDisplay *disp, _EGLSurface *dsurf,
cctx = (GLX_ctx) ? GLX_ctx->context : NULL;
if (GLX_dpy->have_make_current_read)
- return glXMakeContextCurrent(GLX_dpy->dpy, ddraw, rdraw, cctx);
+ ret = glXMakeContextCurrent(GLX_dpy->dpy, ddraw, rdraw, cctx);
else if (ddraw == rdraw)
- return glXMakeCurrent(GLX_dpy->dpy, ddraw, cctx);
+ ret = glXMakeCurrent(GLX_dpy->dpy, ddraw, cctx);
- return EGL_FALSE;
+ if (ret) {
+ if (dsurf && !_eglIsSurfaceLinked(dsurf))
+ destroy_surface(disp, dsurf);
+ if (rsurf && rsurf != dsurf && !_eglIsSurfaceLinked(rsurf))
+ destroy_surface(disp, rsurf);
+ }
+ else {
+ _eglBindContext(&ctx, &dsurf, &rsurf);
+ }
+
+ return ret;
}
/** Get size of given window */