diff options
author | Chia-I Wu <[email protected]> | 2009-08-13 13:38:24 +0800 |
---|---|---|
committer | Brian Paul <[email protected]> | 2009-08-18 08:49:09 -0600 |
commit | 5a2c9372a0d9fa1efd924f9386a4e3df47c17d0e (patch) | |
tree | 2dee512255194f0eb3eefe2a9064ece8da3b3885 /src/gallium/winsys | |
parent | 0eaa02c836821556c1e8d0141f49f57e23f2548d (diff) |
egl: Some per-driver data should be per-display.
Move some fields of _EGLDriver to _EGLDisplay. It also becomes
unnecessary to pass _EGLDisplay to drivers when _eglMain is called.
Signed-off-by: Chia-I Wu <[email protected]>
Diffstat (limited to 'src/gallium/winsys')
-rw-r--r-- | src/gallium/winsys/egl_xlib/egl_xlib.c | 36 |
1 files changed, 26 insertions, 10 deletions
diff --git a/src/gallium/winsys/egl_xlib/egl_xlib.c b/src/gallium/winsys/egl_xlib/egl_xlib.c index ed7eab50dda..7a667568b8f 100644 --- a/src/gallium/winsys/egl_xlib/egl_xlib.c +++ b/src/gallium/winsys/egl_xlib/egl_xlib.c @@ -62,6 +62,7 @@ struct xlib_egl_driver { _EGLDriver Base; /**< base class */ + EGLint apis; struct pipe_winsys *winsys; struct pipe_screen *screen; }; @@ -194,9 +195,15 @@ static EGLBoolean xlib_eglInitialize(_EGLDriver *drv, _EGLDisplay *dpy, EGLint *minor, EGLint *major) { + struct xlib_egl_driver *xdrv = xlib_egl_driver(drv); + create_configs(drv, dpy); - drv->Initialized = EGL_TRUE; + if (!dpy->Xdpy) { + dpy->Xdpy = XOpenDisplay(NULL); + } + + dpy->ClientAPIsMask = xdrv->apis; /* we're supporting EGL 1.4 */ *minor = 1; @@ -212,6 +219,8 @@ xlib_eglInitialize(_EGLDriver *drv, _EGLDisplay *dpy, static EGLBoolean xlib_eglTerminate(_EGLDriver *drv, _EGLDisplay *dpy) { + _eglReleaseDisplayResources(drv, dpy); + _eglCleanupDisplay(dpy); return EGL_TRUE; } @@ -744,12 +753,22 @@ find_supported_apis(void) } +static void +xlib_Unload(_EGLDriver *drv) +{ + struct xlib_egl_driver *xdrv = xlib_egl_driver(drv); + xdrv->screen->destroy(xdrv->screen); + free(xdrv->winsys); + free(xdrv); +} + + /** * This is the main entrypoint into the driver. * Called by libEGL to instantiate an _EGLDriver object. */ _EGLDriver * -_eglMain(_EGLDisplay *dpy, const char *args) +_eglMain(const char *args) { struct xlib_egl_driver *xdrv; @@ -759,10 +778,6 @@ _eglMain(_EGLDisplay *dpy, const char *args) if (!xdrv) return NULL; - if (!dpy->Xdpy) { - dpy->Xdpy = XOpenDisplay(NULL); - } - _eglInitDriverFallbacks(&xdrv->Base); xdrv->Base.API.Initialize = xlib_eglInitialize; xdrv->Base.API.Terminate = xlib_eglTerminate; @@ -777,16 +792,17 @@ _eglMain(_EGLDisplay *dpy, const char *args) xdrv->Base.API.MakeCurrent = xlib_eglMakeCurrent; xdrv->Base.API.SwapBuffers = xlib_eglSwapBuffers; - xdrv->Base.ClientAPIsMask = find_supported_apis(); - if (xdrv->Base.ClientAPIsMask == 0x0) { + xdrv->apis = find_supported_apis(); + if (xdrv->apis == 0x0) { /* the app isn't directly linked with any EGL-supprted APIs * (such as libGLESv2.so) so use an EGL utility to see what * APIs might be loaded dynamically on this system. */ - xdrv->Base.ClientAPIsMask = _eglFindAPIs(); - } + xdrv->apis = _eglFindAPIs(); + } xdrv->Base.Name = "Xlib/softpipe"; + xdrv->Base.Unload = xlib_Unload; /* create one winsys and use it for all contexts/surfaces */ xdrv->winsys = create_sw_winsys(); |