From e7fd3de9277a0c5efe52966908da8e4e7f1995ee Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Mon, 14 Jul 2008 12:09:07 -0600 Subject: [PATCH] egl: set EGL_CONFORMANT, EGL_RENDERABLE_TYPE config fields, fix null ptr crashes in MakeCurrent --- src/egl/drivers/xdri/egl_xdri.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/egl/drivers/xdri/egl_xdri.c b/src/egl/drivers/xdri/egl_xdri.c index dfb491958b8..2471c0425cf 100644 --- a/src/egl/drivers/xdri/egl_xdri.c +++ b/src/egl/drivers/xdri/egl_xdri.c @@ -181,6 +181,10 @@ get_drawable_size(Display *dpy, Drawable d, uint *width, uint *height) static void create_configs(_EGLDisplay *disp, __GLXdisplayPrivate *glx_priv) { + static const EGLint all_apis = (EGL_OPENGL_ES_BIT | + EGL_OPENGL_ES2_BIT | + EGL_OPENVG_BIT | + EGL_OPENGL_BIT); __GLXscreenConfigs *scrn = glx_priv->screenConfigs; const __GLcontextModes *m; int id = 1; @@ -201,6 +205,8 @@ create_configs(_EGLDisplay *disp, __GLXdisplayPrivate *glx_priv) SET_CONFIG_ATTRIB(&config->Base, EGL_STENCIL_SIZE, m->stencilBits); SET_CONFIG_ATTRIB(&config->Base, EGL_NATIVE_VISUAL_ID, m->visualID); SET_CONFIG_ATTRIB(&config->Base, EGL_NATIVE_VISUAL_TYPE, m->visualType); + SET_CONFIG_ATTRIB(&config->Base, EGL_CONFORMANT, all_apis); + SET_CONFIG_ATTRIB(&config->Base, EGL_RENDERABLE_TYPE, all_apis); /* XXX only window rendering allowed ATM */ SET_CONFIG_ATTRIB(&config->Base, EGL_SURFACE_TYPE, EGL_WINDOW_BIT); @@ -654,7 +660,9 @@ xdri_eglTerminate(_EGLDriver *drv, EGLDisplay dpy) _eglLog(_EGL_DEBUG, "XDRI: eglTerminate"); _eglLog(_EGL_DEBUG, "XDRI: Closing %s", xdri_drv->dri_driver_name); +#if 0 dlclose(xdri_drv->dri_driver_handle); +#endif xdri_drv->dri_driver_handle = NULL; free((void*) xdri_drv->dri_driver_name); @@ -748,15 +756,16 @@ xdri_eglMakeCurrent(_EGLDriver *drv, EGLDisplay dpy, EGLSurface d, struct xdri_egl_context *xdri_ctx = lookup_context(context); struct xdri_egl_surface *xdri_draw = lookup_surface(d); struct xdri_egl_surface *xdri_read = lookup_surface(r); - __DRIid draw = xdri_draw->driDrawable; - __DRIid read = xdri_read->driDrawable; + __DRIid draw = xdri_draw ? xdri_draw->driDrawable : 0; + __DRIid read = xdri_read ? xdri_read->driDrawable : 0; int scrn = DefaultScreen(disp->Xdpy); if (!_eglMakeCurrent(drv, dpy, d, r, context)) return EGL_FALSE; - if (!xdri_ctx->driContext.bindContext(disp->Xdpy, scrn, draw, read, + if (xdri_ctx && + !xdri_ctx->driContext.bindContext(disp->Xdpy, scrn, draw, read, &xdri_ctx->driContext)) { return EGL_FALSE; } -- 2.30.2