egl: Initialize display resources with their display.
authorChia-I Wu <olvaffe@gmail.com>
Sun, 31 Jan 2010 05:33:57 +0000 (13:33 +0800)
committerChia-I Wu <olvaffe@gmail.com>
Sun, 31 Jan 2010 06:46:14 +0000 (14:46 +0800)
Change _eglInitSurface, _eglInitContext, and _eglInitImage to take an
_EGLDisplay instead of an _EGLDriver.  This is a more natural form, and
plus, the display encodes information such as the extensions supported
that might be required for attribute list parsing.

src/egl/drivers/glx/egl_glx.c
src/egl/drivers/xdri/egl_xdri.c
src/egl/main/eglcontext.c
src/egl/main/eglcontext.h
src/egl/main/eglimage.c
src/egl/main/eglimage.h
src/egl/main/eglsurface.c
src/egl/main/eglsurface.h
src/gallium/state_trackers/egl/common/egl_g3d.c

index af653b86eee532895074f0f1526e53669a7f3866..82d256c52d7ff91dd8f4a82d4fd9d1d7fcef17d4 100644 (file)
@@ -605,7 +605,7 @@ GLX_eglCreateContext(_EGLDriver *drv, _EGLDisplay *disp, _EGLConfig *conf,
       return NULL;
    }
 
-   if (!_eglInitContext(drv, &GLX_ctx->Base, conf, attrib_list)) {
+   if (!_eglInitContext(&GLX_ctx->Base, disp, conf, attrib_list)) {
       free(GLX_ctx);
       return NULL;
    }
@@ -720,7 +720,7 @@ GLX_eglCreateWindowSurface(_EGLDriver *drv, _EGLDisplay *disp,
       return NULL;
    }
 
-   if (!_eglInitSurface(drv, &GLX_surf->Base, EGL_WINDOW_BIT,
+   if (!_eglInitSurface(&GLX_surf->Base, disp, EGL_WINDOW_BIT,
                         conf, attrib_list)) {
       free(GLX_surf);
       return NULL;
@@ -766,7 +766,7 @@ GLX_eglCreatePixmapSurface(_EGLDriver *drv, _EGLDisplay *disp,
       return NULL;
    }
 
-   if (!_eglInitSurface(drv, &GLX_surf->Base, EGL_PIXMAP_BIT,
+   if (!_eglInitSurface(&GLX_surf->Base, disp, EGL_PIXMAP_BIT,
                         conf, attrib_list)) {
       free(GLX_surf);
       return NULL;
@@ -826,7 +826,7 @@ GLX_eglCreatePbufferSurface(_EGLDriver *drv, _EGLDisplay *disp,
       return NULL;
    }
 
-   if (!_eglInitSurface(drv, &GLX_surf->Base, EGL_PBUFFER_BIT,
+   if (!_eglInitSurface(&GLX_surf->Base, disp, EGL_PBUFFER_BIT,
                         conf, attrib_list)) {
       free(GLX_surf);
       return NULL;
index 9c21576539ddec9a55cedb77101c6c7510f339b3..2d868cbeea687f82e4ce9208d13914111415df6b 100644 (file)
@@ -391,7 +391,7 @@ xdri_eglCreateContext(_EGLDriver *drv, _EGLDisplay *dpy, _EGLConfig *conf,
       return NULL;
    }
 
-   if (!_eglInitContext(drv, &xdri_ctx->Base, &xdri_config->Base, attrib_list)) {
+   if (!_eglInitContext(&xdri_ctx->Base, dpy, &xdri_config->Base, attrib_list)) {
       free(xdri_ctx->dummy_gc);
       free(xdri_ctx);
       return NULL;
@@ -529,7 +529,7 @@ xdri_eglCreateWindowSurface(_EGLDriver *drv, _EGLDisplay *dpy, _EGLConfig *conf,
       return NULL;
    }
 
-   if (!_eglInitSurface(drv, &xdri_surf->Base, EGL_WINDOW_BIT,
+   if (!_eglInitSurface(&xdri_surf->Base, dpy, EGL_WINDOW_BIT,
                         &xdri_config->Base, attrib_list)) {
       free(xdri_surf);
       return NULL;
index f73cf2d0b354c93319ce5753736c041ffea9d06b..012d8dfe1f4d78ae62bf98272239b9512b42ea4d 100644 (file)
@@ -101,8 +101,8 @@ _eglParseContextAttribList(_EGLContext *ctx, const EGLint *attrib_list)
  * in the attrib_list.
  */
 EGLBoolean
-_eglInitContext(_EGLDriver *drv, _EGLContext *ctx,
-                _EGLConfig *conf, const EGLint *attrib_list)
+_eglInitContext(_EGLContext *ctx, _EGLDisplay *dpy, _EGLConfig *conf,
+                const EGLint *attrib_list)
 {
    const EGLenum api = eglQueryAPI();
    EGLint err;
@@ -113,6 +113,7 @@ _eglInitContext(_EGLDriver *drv, _EGLContext *ctx,
    }
 
    memset(ctx, 0, sizeof(_EGLContext));
+   ctx->Resource.Display = dpy;
    ctx->ClientAPI = api;
    ctx->Config = conf;
    ctx->WindowRenderBuffer = EGL_NONE;
index ebb50aa60e679b9d9ea5ea874cb660fc10a880b3..14fce02c11b26e253b917cab6c2506bb44eef8e3 100644 (file)
@@ -30,7 +30,7 @@ struct _egl_context
 
 
 PUBLIC EGLBoolean
-_eglInitContext(_EGLDriver *drv, _EGLContext *ctx,
+_eglInitContext(_EGLContext *ctx, _EGLDisplay *dpy,
                 _EGLConfig *config, const EGLint *attrib_list);
 
 
index 5b27df0267daa892ae3c1c2ebc5625011447e43f..e7a293b3743a9cd5c1cfe8c4de7e40e267dce526 100644 (file)
@@ -44,11 +44,12 @@ _eglParseImageAttribList(_EGLImage *img, const EGLint *attrib_list)
 
 
 EGLBoolean
-_eglInitImage(_EGLDriver *drv, _EGLImage *img, const EGLint *attrib_list)
+_eglInitImage(_EGLImage *img, _EGLDisplay *dpy, const EGLint *attrib_list)
 {
    EGLint err;
 
    memset(img, 0, sizeof(_EGLImage));
+   img->Resource.Display = dpy;
 
    img->Preserved = EGL_FALSE;
 
index 43107c23e9fcd055f17a3aafacc2123cb87cee10..26bf054a07d4fb69668f5e3b8e1e0810b7248a21 100644 (file)
@@ -19,7 +19,7 @@ struct _egl_image
 
 
 PUBLIC EGLBoolean
-_eglInitImage(_EGLDriver *drv, _EGLImage *img, const EGLint *attrib_list);
+_eglInitImage(_EGLImage *img, _EGLDisplay *dpy, const EGLint *attrib_list);
 
 
 extern _EGLImage *
index 6d436cffc100402f741028217af68988e577e6a0..58a50e9ee7d951cd98d5caa75bbeb71c00afad0d 100644 (file)
@@ -167,7 +167,7 @@ _eglParseSurfaceAttribList(_EGLSurface *surf, const EGLint *attrib_list)
  * \return EGL_TRUE if no errors, EGL_FALSE otherwise.
  */
 EGLBoolean
-_eglInitSurface(_EGLDriver *drv, _EGLSurface *surf, EGLint type,
+_eglInitSurface(_EGLSurface *surf, _EGLDisplay *dpy, EGLint type,
                 _EGLConfig *conf, const EGLint *attrib_list)
 {
    const char *func;
@@ -201,6 +201,7 @@ _eglInitSurface(_EGLDriver *drv, _EGLSurface *surf, EGLint type,
    }
 
    memset(surf, 0, sizeof(_EGLSurface));
+   surf->Resource.Display = dpy;
    surf->Type = type;
    surf->Config = conf;
 
index 0d64d20dd4244b64da7ce7fbba202a4115f6137f..f054cb46d1a2ac0ce559a392a5be2507e30788c1 100644 (file)
@@ -40,7 +40,7 @@ struct _egl_surface
 
 
 PUBLIC EGLBoolean
-_eglInitSurface(_EGLDriver *drv, _EGLSurface *surf, EGLint type,
+_eglInitSurface(_EGLSurface *surf, _EGLDisplay *dpy, EGLint type,
                 _EGLConfig *config, const EGLint *attrib_list);
 
 
index 6c8f3b9f79cd5c30dc3868f2acb5efa93e3b467e..3fd775abe5af2c831defae87c6015a5cf6e9c574 100644 (file)
@@ -631,7 +631,7 @@ egl_g3d_create_context(_EGLDriver *drv, _EGLDisplay *dpy, _EGLConfig *conf,
       return NULL;
    }
 
-   if (!_eglInitContext(drv, &gctx->base, conf, attribs)) {
+   if (!_eglInitContext(&gctx->base, dpy, conf, attribs)) {
       free(gctx);
       return NULL;
    }
@@ -713,7 +713,7 @@ egl_g3d_create_window_surface(_EGLDriver *drv, _EGLDisplay *dpy,
       return NULL;
    }
 
-   if (!_eglInitSurface(drv, &gsurf->base, EGL_WINDOW_BIT, conf, attribs)) {
+   if (!_eglInitSurface(&gsurf->base, dpy, EGL_WINDOW_BIT, conf, attribs)) {
       free(gsurf);
       return NULL;
    }
@@ -753,7 +753,7 @@ egl_g3d_create_pixmap_surface(_EGLDriver *drv, _EGLDisplay *dpy,
       return NULL;
    }
 
-   if (!_eglInitSurface(drv, &gsurf->base, EGL_PIXMAP_BIT, conf, attribs)) {
+   if (!_eglInitSurface(&gsurf->base, dpy, EGL_PIXMAP_BIT, conf, attribs)) {
       free(gsurf);
       return NULL;
    }
@@ -790,7 +790,7 @@ egl_g3d_create_pbuffer_surface(_EGLDriver *drv, _EGLDisplay *dpy,
       return NULL;
    }
 
-   if (!_eglInitSurface(drv, &gsurf->base, EGL_PBUFFER_BIT, conf, attribs)) {
+   if (!_eglInitSurface(&gsurf->base, dpy, EGL_PBUFFER_BIT, conf, attribs)) {
       free(gsurf);
       return NULL;
    }
@@ -1180,7 +1180,7 @@ egl_g3d_create_screen_surface(_EGLDriver *drv, _EGLDisplay *dpy,
       return NULL;
    }
 
-   if (!_eglInitSurface(drv, &gsurf->base,
+   if (!_eglInitSurface(&gsurf->base, dpy,
             EGL_SCREEN_BIT_MESA, conf, attribs)) {
       free(gsurf);
       return NULL;