From 6baa2c8d022e5dd1e305e7da2925c1e6f9370f35 Mon Sep 17 00:00:00 2001 From: Chia-I Wu Date: Thu, 28 Jan 2010 16:57:49 +0800 Subject: 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. --- src/gallium/state_trackers/egl/common/egl_g3d.c | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) (limited to 'src/gallium/state_trackers/egl/common') diff --git a/src/gallium/state_trackers/egl/common/egl_g3d.c b/src/gallium/state_trackers/egl/common/egl_g3d.c index 657c771a6b..f8334217c4 100644 --- a/src/gallium/state_trackers/egl/common/egl_g3d.c +++ b/src/gallium/state_trackers/egl/common/egl_g3d.c @@ -856,18 +856,14 @@ egl_g3d_make_current(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *draw, _EGLSurface *read, _EGLContext *ctx) { struct egl_g3d_context *gctx = egl_g3d_context(ctx); + struct egl_g3d_surface *gdraw = egl_g3d_surface(draw); struct egl_g3d_context *old_gctx; - EGLint api; EGLBoolean ok = EGL_TRUE; - /* find the old context */ - api = (gctx) ? gctx->base.ClientAPI : eglQueryAPI(); - old_gctx = egl_g3d_get_current_context(api); - if (old_gctx && !_eglIsContextLinked(&old_gctx->base)) - old_gctx = NULL; - - if (!_eglMakeCurrent(drv, dpy, draw, read, ctx)) + /* bind the new context and return the "orphaned" one */ + if (!_eglBindContext(&ctx, &draw, &read)) return EGL_FALSE; + old_gctx = egl_g3d_context(ctx); if (old_gctx) { /* flush old context */ @@ -883,8 +879,6 @@ egl_g3d_make_current(_EGLDriver *drv, _EGLDisplay *dpy, } if (gctx) { - struct egl_g3d_surface *gdraw = egl_g3d_surface(draw); - ok = egl_g3d_realloc_context(dpy, &gctx->base); if (ok) { ok = gctx->stapi->st_make_current(gctx->st_ctx, @@ -904,6 +898,13 @@ egl_g3d_make_current(_EGLDriver *drv, _EGLDisplay *dpy, old_gctx->base.WindowRenderBuffer = EGL_NONE; } + if (ctx && !_eglIsContextLinked(ctx)) + destroy_context(dpy, ctx); + if (draw && !_eglIsSurfaceLinked(draw)) + destroy_surface(dpy, draw); + if (read && read != draw && !_eglIsSurfaceLinked(read)) + destroy_surface(dpy, read); + return ok; } -- cgit v1.2.3