summaryrefslogtreecommitdiff
path: root/src/egl/drivers/glx/egl_glx.c
diff options
context:
space:
mode:
authorChia-I Wu <olvaffe@gmail.com>2009-07-17 11:53:03 -0600
committerBrian Paul <brianp@vmware.com>2009-07-17 11:53:03 -0600
commitcca31340b5a9c0b941946753a31236c7201ca87c (patch)
treecdd0c35eb777b16cd8dcd3d9442d0e9861acc07f /src/egl/drivers/glx/egl_glx.c
parent18457cb263e3e062e12314e7b3d5c81a7f2ba048 (diff)
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>
Diffstat (limited to 'src/egl/drivers/glx/egl_glx.c')
-rw-r--r--src/egl/drivers/glx/egl_glx.c42
1 files changed, 27 insertions, 15 deletions
diff --git a/src/egl/drivers/glx/egl_glx.c b/src/egl/drivers/glx/egl_glx.c
index 155caa413c..661b313ae2 100644
--- a/src/egl/drivers/glx/egl_glx.c
+++ b/src/egl/drivers/glx/egl_glx.c
@@ -532,7 +532,10 @@ GLX_eglCreateContext(_EGLDriver *drv, EGLDisplay dpy, EGLConfig config,
if (!GLX_ctx)
return EGL_NO_CONTEXT;
- if (!_eglInitContext(drv, dpy, &GLX_ctx->Base, config, attrib_list)) {
+ conf = _eglLookupConfig(drv, dpy, config);
+ assert(conf);
+
+ if (!_eglInitContext(drv, &GLX_ctx->Base, conf, attrib_list)) {
free(GLX_ctx);
return EGL_NO_CONTEXT;
}
@@ -546,9 +549,6 @@ GLX_eglCreateContext(_EGLDriver *drv, EGLDisplay dpy, EGLConfig config,
GLX_ctx_shared = GLX_egl_context(shareCtx);
}
- conf = _eglLookupConfig(drv, dpy, config);
- assert(conf);
-
#ifdef GLX_VERSION_1_3
if (GLX_drv->fbconfigs)
GLX_ctx->context = glXCreateNewContext(disp->Xdpy, GLX_drv->fbconfigs[(int)config-1], GLX_RGBA_TYPE, GLX_ctx_shared ? GLX_ctx_shared->context : NULL, GL_TRUE);
@@ -564,7 +564,7 @@ GLX_eglCreateContext(_EGLDriver *drv, EGLDisplay dpy, EGLConfig config,
return EGL_FALSE;
#endif
- return _eglGetContextHandle(&GLX_ctx->Base);
+ return _eglLinkContext(&GLX_ctx->Base, disp);
}
@@ -619,18 +619,22 @@ GLX_eglCreateWindowSurface(_EGLDriver *drv, EGLDisplay dpy, EGLConfig config,
_EGLDisplay *disp = _eglLookupDisplay(dpy);
struct GLX_egl_surface *GLX_surf;
uint width, height;
+ _EGLConfig *conf;
+
+ conf = _eglLookupConfig(drv, dpy, config);
+ assert(conf);
GLX_surf = CALLOC_STRUCT(GLX_egl_surface);
if (!GLX_surf)
return EGL_NO_SURFACE;
- if (!_eglInitSurface(drv, dpy, &GLX_surf->Base, EGL_WINDOW_BIT,
- config, attrib_list)) {
+ if (!_eglInitSurface(drv, &GLX_surf->Base, EGL_WINDOW_BIT,
+ conf, attrib_list)) {
free(GLX_surf);
return EGL_FALSE;
}
- _eglSaveSurface(&GLX_surf->Base);
+ _eglLinkSurface(&GLX_surf->Base, disp);
GLX_surf->drawable = window;
get_drawable_size(disp->Xdpy, window, &width, &height);
@@ -648,19 +652,23 @@ GLX_eglCreatePixmapSurface(_EGLDriver *drv, EGLDisplay dpy, EGLConfig config,
struct GLX_egl_driver *GLX_drv = GLX_egl_driver(drv);
_EGLDisplay *disp = _eglLookupDisplay(dpy);
struct GLX_egl_surface *GLX_surf;
+ _EGLConfig *conf;
int i;
+ conf = _eglLookupConfig(drv, dpy, config);
+ assert(conf);
+
GLX_surf = CALLOC_STRUCT(GLX_egl_surface);
if (!GLX_surf)
return EGL_NO_SURFACE;
- if (!_eglInitSurface(drv, dpy, &GLX_surf->Base, EGL_PIXMAP_BIT,
- config, attrib_list)) {
+ if (!_eglInitSurface(drv, &GLX_surf->Base, EGL_PIXMAP_BIT,
+ conf, attrib_list)) {
free(GLX_surf);
return EGL_FALSE;
}
- _eglSaveSurface(&GLX_surf->Base);
+ _eglLinkSurface(&GLX_surf->Base, disp);
for (i = 0; attrib_list && attrib_list[i] != EGL_NONE; i++) {
switch (attrib_list[i]) {
@@ -683,20 +691,24 @@ GLX_eglCreatePbufferSurface(_EGLDriver *drv, EGLDisplay dpy, EGLConfig config,
struct GLX_egl_driver *GLX_drv = GLX_egl_driver(drv);
_EGLDisplay *disp = _eglLookupDisplay(dpy);
struct GLX_egl_surface *GLX_surf;
+ _EGLConfig *conf;
int attribs[5];
int i = 0, j = 0;
+ conf = _eglLookupConfig(drv, dpy, config);
+ assert(conf);
+
GLX_surf = CALLOC_STRUCT(GLX_egl_surface);
if (!GLX_surf)
return EGL_NO_SURFACE;
- if (!_eglInitSurface(drv, dpy, &GLX_surf->Base, EGL_PBUFFER_BIT,
- config, attrib_list)) {
+ if (!_eglInitSurface(drv, &GLX_surf->Base, EGL_PBUFFER_BIT,
+ conf, attrib_list)) {
free(GLX_surf);
return EGL_NO_SURFACE;
}
- _eglSaveSurface(&GLX_surf->Base);
+ _eglLinkSurface(&GLX_surf->Base, disp);
while(attrib_list[i] != EGL_NONE) {
switch (attrib_list[i]) {
@@ -726,7 +738,7 @@ GLX_eglDestroySurface(_EGLDriver *drv, EGLDisplay dpy, EGLSurface surface)
_EGLSurface *surf = _eglLookupSurface(surface);
return EGL_TRUE;
if (surf) {
- _eglHashRemove(_eglGlobal.Surfaces, (EGLuint) surface);
+ _eglUnlinkSurface(surf);
if (surf->IsBound) {
surf->DeletePending = EGL_TRUE;
}