From cca31340b5a9c0b941946753a31236c7201ca87c Mon Sep 17 00:00:00 2001
From: Chia-I Wu <olvaffe@gmail.com>
Date: Fri, 17 Jul 2009 11:53:03 -0600
Subject: egl: Use the link functions to manage resources.

This commit uses the newly introduced link functions to manage EGL
contexts and surfaces.  As a result of this, the API for drivers are
changed.  All drivers are updated for the change.

Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
---
 src/gallium/winsys/egl_xlib/egl_xlib.c | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

(limited to 'src/gallium/winsys')

diff --git a/src/gallium/winsys/egl_xlib/egl_xlib.c b/src/gallium/winsys/egl_xlib/egl_xlib.c
index c10e3c00ff..9914dff964 100644
--- a/src/gallium/winsys/egl_xlib/egl_xlib.c
+++ b/src/gallium/winsys/egl_xlib/egl_xlib.c
@@ -345,7 +345,7 @@ xlib_eglCreateContext(_EGLDriver *drv, EGLDisplay dpy, EGLConfig config,
       return EGL_NO_CONTEXT;
 
    /* let EGL lib init the common stuff */
-   if (!_eglInitContext(drv, dpy, &ctx->Base, config, attrib_list)) {
+   if (!_eglInitContext(drv, &ctx->Base, conf, attrib_list)) {
       free(ctx);
       return EGL_NO_CONTEXT;
    }
@@ -370,7 +370,7 @@ xlib_eglCreateContext(_EGLDriver *drv, EGLDisplay dpy, EGLConfig config,
       return EGL_NO_CONTEXT;
    }
 
-   _eglSaveContext(&ctx->Base);
+   _eglLinkContext(&ctx->Base, _eglLookupDisplay(dpy));
 
    return _eglGetContextHandle(&ctx->Base);
 }
@@ -381,6 +381,7 @@ xlib_eglDestroyContext(_EGLDriver *drv, EGLDisplay dpy, EGLContext ctx)
 {
    struct xlib_egl_context *context = lookup_context(ctx);
    if (context) {
+      _eglUnlinkContext(&context->Base);
       if (context->Base.IsBound) {
          context->Base.DeletePending = EGL_TRUE;
       }
@@ -491,13 +492,13 @@ xlib_eglCreateWindowSurface(_EGLDriver *drv, EGLDisplay dpy, EGLConfig config,
       return EGL_NO_SURFACE;
 
    /* Let EGL lib init the common stuff */
-   if (!_eglInitSurface(drv, dpy, &surf->Base, EGL_WINDOW_BIT,
-                        config, attrib_list)) {
+   if (!_eglInitSurface(drv, &surf->Base, EGL_WINDOW_BIT,
+                        conf, attrib_list)) {
       free(surf);
       return EGL_NO_SURFACE;
    }
 
-   _eglSaveSurface(&surf->Base);
+   _eglLinkSurface(&surf->Base, disp);
 
    /*
     * Now init the Xlib and gallium stuff
@@ -534,7 +535,7 @@ xlib_eglDestroySurface(_EGLDriver *drv, EGLDisplay dpy, EGLSurface surface)
 {
    struct xlib_egl_surface *surf = lookup_surface(surface);
    if (surf) {
-      _eglHashRemove(_eglGlobal.Surfaces, (EGLuint) surface);
+      _eglUnlinkSurface(&surf->Base);
       if (surf->Base.IsBound) {
          surf->Base.DeletePending = EGL_TRUE;
       }
-- 
cgit v1.2.3