Bug 900033 - Don't rely on the driver to detect a bad MakeCurrent. r=jrmuizel
authorBenoit Girard <b56girard@gmail.com>
Fri, 17 Jan 2014 18:10:54 -0500
changeset 164106 cd4a9095e25cfc45a02b2d5b2e07388107cf7aad
parent 164105 811f4c3267b6c0026067160f0aaaafc42cd87fc7
child 164107 a0a1851773db6d8c5f91e9d63530e33f51416811
push id26026
push userphilringnalda@gmail.com
push dateSat, 18 Jan 2014 23:17:27 +0000
treeherdermozilla-central@61fd0f987cf2 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjrmuizel
bugs900033
milestone29.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 900033 - Don't rely on the driver to detect a bad MakeCurrent. r=jrmuizel
gfx/gl/GLContextProviderEGL.cpp
--- a/gfx/gl/GLContextProviderEGL.cpp
+++ b/gfx/gl/GLContextProviderEGL.cpp
@@ -361,16 +361,19 @@ GLContextEGL::MakeCurrentImpl(bool aForc
 
     // Assume that EGL has the same problem as WGL does,
     // where MakeCurrent with an already-current context is
     // still expensive.
     if (aForce || sEGLLibrary.fGetCurrentContext() != mContext) {
         EGLSurface surface = mSurfaceOverride != EGL_NO_SURFACE
                               ? mSurfaceOverride
                               : mSurface;
+        if (surface == EGL_NO_SURFACE) {
+            return false;
+        }
         succeeded = sEGLLibrary.fMakeCurrent(EGL_DISPLAY(),
                                               surface, surface,
                                               mContext);
         int eglError = sEGLLibrary.fGetError();
         if (!succeeded) {
             if (eglError == LOCAL_EGL_CONTEXT_LOST) {
                 mContextLost = true;
                 NS_WARNING("EGL context has been lost.");
@@ -409,17 +412,17 @@ GLContextEGL::RenewSurface() {
         return false;
     }
     return MakeCurrent(true);
 }
 
 void
 GLContextEGL::ReleaseSurface() {
     DestroySurface(mSurface);
-    mSurface = nullptr;
+    mSurface = EGL_NO_SURFACE;
 }
 
 bool
 GLContextEGL::SetupLookupFunction()
 {
     mLookupFunc = (PlatformLookupFunction)sEGLLibrary.mSymbols.fGetProcAddress;
     return true;
 }