diff options
author | Chia-I Wu <olvaffe@gmail.com> | 2009-08-13 13:38:24 +0800 |
---|---|---|
committer | Brian Paul <brianp@vmware.com> | 2009-08-18 08:49:09 -0600 |
commit | 5a2c9372a0d9fa1efd924f9386a4e3df47c17d0e (patch) | |
tree | 2dee512255194f0eb3eefe2a9064ece8da3b3885 /src/gallium/state_trackers/egl/egl_tracker.c | |
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 <olvaffe@gmail.com>
Diffstat (limited to 'src/gallium/state_trackers/egl/egl_tracker.c')
-rw-r--r-- | src/gallium/state_trackers/egl/egl_tracker.c | 25 |
1 files changed, 16 insertions, 9 deletions
diff --git a/src/gallium/state_trackers/egl/egl_tracker.c b/src/gallium/state_trackers/egl/egl_tracker.c index 107f45cbcb..ced002c535 100644 --- a/src/gallium/state_trackers/egl/egl_tracker.c +++ b/src/gallium/state_trackers/egl/egl_tracker.c @@ -21,12 +21,20 @@ extern const struct dri_extension card_extensions[]; * Exported functions */ +static void +drm_unload(_EGLDriver *drv) +{ + struct drm_device *dev = (struct drm_device *)drv; + dev->api->destroy(dev->api); + free(dev); +} + /** * The bootstrap function. Return a new drm_driver object and * plug in API functions. */ _EGLDriver * -_eglMain(_EGLDisplay *dpy, const char *args) +_eglMain(const char *args) { struct drm_device *drm; @@ -53,12 +61,8 @@ _eglMain(_EGLDisplay *dpy, const char *args) drm->base.API.ShowScreenSurfaceMESA = drm_show_screen_surface_mesa; drm->base.API.SwapBuffers = drm_swap_buffers; - drm->base.ClientAPIsMask = EGL_OPENGL_BIT /*| EGL_OPENGL_ES_BIT*/; drm->base.Name = "DRM/Gallium/Win"; - - /* enable supported extensions */ - drm->base.Extensions.MESA_screen_surface = EGL_TRUE; - drm->base.Extensions.MESA_copy_context = EGL_TRUE; + drm->base.Unload = drm_unload; return &drm->base; } @@ -199,7 +203,10 @@ drm_initialize(_EGLDriver *drv, _EGLDisplay *disp, EGLint *major, EGLint *minor) _eglSetConfigAttrib(config, EGL_SURFACE_TYPE, EGL_PBUFFER_BIT); _eglAddConfig(disp, config); - drv->Initialized = EGL_TRUE; + disp->ClientAPIsMask = EGL_OPENGL_BIT /*| EGL_OPENGL_ES_BIT*/; + /* enable supported extensions */ + disp->Extensions.MESA_screen_surface = EGL_TRUE; + disp->Extensions.MESA_copy_context = EGL_TRUE; *major = 1; *minor = 4; @@ -219,6 +226,8 @@ drm_terminate(_EGLDriver *drv, _EGLDisplay *dpy) struct drm_screen *screen; int i = 0; + _eglReleaseDisplayResources(drv, dpy); + drmFreeVersion(dev->version); for (i = 0; i < dev->count_screens; i++) { @@ -235,12 +244,10 @@ drm_terminate(_EGLDriver *drv, _EGLDisplay *dpy) dev->screen->destroy(dev->screen); dev->winsys = NULL; - dev->api->destroy(dev->api); drmClose(dev->drmFD); _eglCleanupDisplay(dpy); - free(dev); return EGL_TRUE; } |