diff options
author | Chia-I Wu <[email protected]> | 2010-01-28 16:57:49 +0800 |
---|---|---|
committer | Chia-I Wu <[email protected]> | 2010-01-28 17:28:48 +0800 |
commit | 6baa2c8d022e5dd1e305e7da2925c1e6f9370f35 (patch) | |
tree | c354b4fb532e992c42563bec2b63b668bf453e85 /src/gallium/state_trackers | |
parent | 45ba53324341234144ca02122bf2c0b5ef58c361 (diff) |
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/gallium/state_trackers')
-rw-r--r-- | src/gallium/state_trackers/egl/common/egl_g3d.c | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/src/gallium/state_trackers/egl/common/egl_g3d.c b/src/gallium/state_trackers/egl/common/egl_g3d.c index 657c771a6b1..f8334217c47 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; } |