Bug 770440 - Make sure we only initialize sGLContext/sFramebufferOpen once. r=cjones
authorKan-Ru Chen <kanru@kanru.info>
Wed, 04 Jul 2012 08:30:59 -0400
changeset 98314 5c30c255b49079f948ad0ee4f0cb36be2c3f1a07
parent 98313 78353003288ed531ba2ddf00c65d3104cc2e4860
child 98315 8ca7a4f665a1ea213c51630a37a7f2483357161b
child 98329 f4a40f6773912e6fb4bcb05f7ee00fe930b29c80
push id11443
push userryanvm@gmail.com
push dateWed, 04 Jul 2012 12:30:52 +0000
treeherdermozilla-inbound@5c30c255b490 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerscjones
bugs770440
milestone16.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 770440 - Make sure we only initialize sGLContext/sFramebufferOpen once. r=cjones
widget/gonk/nsWindow.cpp
--- a/widget/gonk/nsWindow.cpp
+++ b/widget/gonk/nsWindow.cpp
@@ -475,24 +475,26 @@ nsWindow::GetLayerManager(PLayersChild* 
                           LayerManagerPersistence aPersistence,
                           bool* aAllowRetaining)
 {
     if (aAllowRetaining)
         *aAllowRetaining = true;
     if (mLayerManager)
         return mLayerManager;
 
-      // Set mUseAcceleratedRendering here to make it consistent with
-      // nsBaseWidget::GetLayerManager
+    // Set mUseAcceleratedRendering here to make it consistent with
+    // nsBaseWidget::GetLayerManager
     mUseAcceleratedRendering = GetShouldAccelerate();
     if (!mUseAcceleratedRendering) {
-        sFramebufferOpen = Framebuffer::Open();
         if (!sFramebufferOpen) {
-            LOG("Failed to mmap fb(?!?), aborting ...");
-            NS_RUNTIMEABORT("Can't open GL context and can't fall back on /dev/graphics/fb0 ...");
+            sFramebufferOpen = Framebuffer::Open();
+            if (!sFramebufferOpen) {
+                LOG("Failed to mmap fb(?!?), aborting ...");
+                NS_RUNTIMEABORT("Can't open GL context and can't fall back on /dev/graphics/fb0 ...");
+            }
         }
     }
 
     nsWindow *topWindow = sTopWindows[0];
 
     if (!topWindow) {
         LOG(" -- no topwindow\n");
         return nsnull;
@@ -500,17 +502,19 @@ nsWindow::GetLayerManager(PLayersChild* 
 
     if (sUsingOMTC) {
         CreateCompositor();
         if (mLayerManager)
             return mLayerManager;
     }
 
     DebugOnly<nsIntRect> fbBounds = gScreenBounds;
-    sGLContext = GLContextProvider::CreateForWindow(this);
+    if (!sGLContext) {
+      sGLContext = GLContextProvider::CreateForWindow(this);
+    }
     MOZ_ASSERT(fbBounds.value == gScreenBounds);
     if (sGLContext) {
         nsRefPtr<LayerManagerOGL> layerManager = new LayerManagerOGL(this);
 
         if (layerManager->Initialize(sGLContext)) {
             mLayerManager = layerManager;
             return mLayerManager;
         } else {