From 17330479b39409a63a06ec9e6b0f8e28b585db12 Mon Sep 17 00:00:00 2001 From: Chia-I Wu Date: Wed, 27 Jan 2010 23:51:54 +0800 Subject: egl: eglMakeCurrent should accept an uninitialized display. When no context or surface are given, the display is allowed to be uninitialized. Most drivers cannot handle an uninitialized display. But they are updated to at least throw a fatal message. --- src/egl/main/eglapi.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) (limited to 'src/egl/main/eglapi.c') diff --git a/src/egl/main/eglapi.c b/src/egl/main/eglapi.c index 2c26dfada8..d0f9749f84 100644 --- a/src/egl/main/eglapi.c +++ b/src/egl/main/eglapi.c @@ -394,9 +394,19 @@ eglMakeCurrent(EGLDisplay dpy, EGLSurface draw, EGLSurface read, _EGLSurface *read_surf = _eglLookupSurface(read, disp); _EGLDriver *drv; - drv = _eglCheckDisplay(disp, __FUNCTION__); + if (!disp) + return _eglError(EGL_BAD_DISPLAY, __FUNCTION__); + drv = disp->Driver; + + /* display is allowed to be uninitialized under certain condition */ + if (!disp->Initialized) { + if (draw != EGL_NO_SURFACE || read != EGL_NO_SURFACE || + ctx != EGL_NO_CONTEXT) + return _eglError(EGL_BAD_DISPLAY, __FUNCTION__); + } if (!drv) - return EGL_FALSE; + return EGL_TRUE; + if (!context && ctx != EGL_NO_CONTEXT) return _eglError(EGL_BAD_CONTEXT, __FUNCTION__); if ((!draw_surf && draw != EGL_NO_SURFACE) || @@ -994,9 +1004,7 @@ eglReleaseThread(void) if (ctx) { _EGLDisplay *disp = ctx->Resource.Display; _EGLDriver *drv = disp->Driver; - /* what if display is not initialized? */ - if (disp->Initialized) - (void) drv->API.MakeCurrent(drv, disp, NULL, NULL, NULL); + (void) drv->API.MakeCurrent(drv, disp, NULL, NULL, NULL); } } } -- cgit v1.2.3