egl: Use the link functions to manage resources.
[mesa.git] / src / gallium / state_trackers / egl / egl_surface.c
index de8194a46aff40cb2615eb0c50128a08d6ca24f0..27b35052d1ceeee58b942dd6a47afb165c77c68e 100644 (file)
@@ -232,7 +232,7 @@ drm_create_pbuffer_surface(_EGLDriver *drv, EGLDisplay dpy, EGLConfig config,
        if (!surf)
                goto err;
 
-       if (!_eglInitSurface(drv, dpy, &surf->base, EGL_PBUFFER_BIT, config, attrib_list))
+       if (!_eglInitSurface(drv, &surf->base, EGL_PBUFFER_BIT, conf, attrib_list))
                goto err_surf;
 
        surf->w = width;
@@ -245,7 +245,7 @@ drm_create_pbuffer_surface(_EGLDriver *drv, EGLDisplay dpy, EGLConfig config,
                                            (void*)surf);
        drm_visual_modes_destroy(visual);
 
-       _eglSaveSurface(&surf->base);
+        _eglLinkSurface(&surf->base, _eglLookupDisplay(dpy));
        return surf->base.Handle;
 
 err_surf:
@@ -364,7 +364,8 @@ EGLBoolean
 drm_destroy_surface(_EGLDriver *drv, EGLDisplay dpy, EGLSurface surface)
 {
        struct drm_surface *surf = lookup_drm_surface(surface);
-       _eglRemoveSurface(&surf->base);
+       _eglUnlinkSurface(&surf->base);
+
        if (surf->base.IsBound) {
                surf->base.DeletePending = EGL_TRUE;
        } else {