From cca31340b5a9c0b941946753a31236c7201ca87c Mon Sep 17 00:00:00 2001 From: Chia-I Wu 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 --- src/egl/drivers/demo/demo.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) (limited to 'src/egl/drivers/demo/demo.c') diff --git a/src/egl/drivers/demo/demo.c b/src/egl/drivers/demo/demo.c index 1750e976b8..fa9efa5d35 100644 --- a/src/egl/drivers/demo/demo.c +++ b/src/egl/drivers/demo/demo.c @@ -146,12 +146,12 @@ demoCreateContext(_EGLDriver *drv, EGLDisplay dpy, EGLConfig config, EGLContext if (!c) return EGL_NO_CONTEXT; - _eglInitContext(drv, dpy, &c->Base, config, attrib_list); + _eglInitContext(drv, &c->Base, conf, attrib_list); c->DemoStuff = 1; printf("demoCreateContext\n"); - /* generate handle and insert into hash table */ - _eglSaveContext(&c->Base); + /* link to display */ + _eglLinkContext(&c->Base, _eglLookupDisplay(dpy)); assert(_eglGetContextHandle(&c->Base)); return _eglGetContextHandle(&c->Base); @@ -213,11 +213,14 @@ demoCreatePbufferSurface(_EGLDriver *drv, EGLDisplay dpy, EGLConfig config, const EGLint *attrib_list) { DemoSurface *surf = (DemoSurface *) calloc(1, sizeof(DemoSurface)); + _EGLConfig *conf; + if (!surf) return EGL_NO_SURFACE; - if (!_eglInitSurface(drv, dpy, &surf->Base, EGL_PBUFFER_BIT, - config, attrib_list)) { + conf = _eglLookupConfig(drv, dpy, config); + if (!_eglInitSurface(drv, &surf->Base, EGL_PBUFFER_BIT, + conf, attrib_list)) { free(surf); return EGL_NO_SURFACE; } @@ -232,7 +235,7 @@ static EGLBoolean demoDestroySurface(_EGLDriver *drv, EGLDisplay dpy, EGLSurface surface) { DemoSurface *fs = LookupDemoSurface(surface); - _eglRemoveSurface(&fs->Base); + _eglUnlinkSurface(&fs->Base); if (fs->Base.IsBound) { fs->Base.DeletePending = EGL_TRUE; } @@ -247,7 +250,7 @@ static EGLBoolean demoDestroyContext(_EGLDriver *drv, EGLDisplay dpy, EGLContext context) { DemoContext *fc = LookupDemoContext(context); - _eglRemoveContext(&fc->Base); + _eglUnlinkContext(&fc->Base); if (fc->Base.IsBound) { fc->Base.DeletePending = EGL_TRUE; } -- cgit v1.2.3