Bug 885573 - Stop forcing layers acceleration when we have OMTC enabled. r=nrc
authorMatt Woodrow <mwoodrow@mozilla.com>
Mon, 24 Jun 2013 17:27:29 +1200
changeset 147710 3d1618de1190c9a75d3167f852be85a468926d32
parent 147709 1501850aa8ae4b57113bbd03c077481b8e7a0e3c
child 147711 5ac656c40652e04ef462da379197d9d4efb0a78e
push id2697
push userbbajaj@mozilla.com
push dateMon, 05 Aug 2013 18:49:53 +0000
treeherdermozilla-beta@dfec938c7b63 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersnrc
bugs885573
milestone24.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 885573 - Stop forcing layers acceleration when we have OMTC enabled. r=nrc
gfx/thebes/gfxPlatform.cpp
widget/cocoa/nsChildView.h
widget/cocoa/nsChildView.mm
widget/xpwidgets/nsBaseWidget.cpp
--- a/gfx/thebes/gfxPlatform.cpp
+++ b/gfx/thebes/gfxPlatform.cpp
@@ -1820,18 +1820,17 @@ static bool sPrefLayersPreferD3D9 = fals
 void InitLayersAccelerationPrefs()
 {
   static bool sLayersAccelerationPrefsInitialized = false;
   if (!sLayersAccelerationPrefsInitialized)
   {
     sPrefLayersOffMainThreadCompositionEnabled = Preferences::GetBool("layers.offmainthreadcomposition.enabled", false);
     sPrefLayersOffMainThreadCompositionTestingEnabled = Preferences::GetBool("layers.offmainthreadcomposition.testing.enabled", false);
     sPrefLayersOffMainThreadCompositionForceEnabled = Preferences::GetBool("layers.offmainthreadcomposition.force-enabled", false);
-    sPrefLayersAccelerationForceEnabled = Preferences::GetBool("layers.acceleration.force-enabled", false) ||
-                                          Preferences::GetBool("browser.tabs.remote", false);
+    sPrefLayersAccelerationForceEnabled = Preferences::GetBool("layers.acceleration.force-enabled", false);
     sPrefLayersAccelerationDisabled = Preferences::GetBool("layers.acceleration.disabled", false);
     sPrefLayersPreferOpenGL = Preferences::GetBool("layers.prefer-opengl", false);
     sPrefLayersPreferD3D9 = Preferences::GetBool("layers.prefer-d3d9", false);
 
     sLayersAccelerationPrefsInitialized = true;
   }
 }
 
--- a/widget/cocoa/nsChildView.h
+++ b/widget/cocoa/nsChildView.h
@@ -443,17 +443,17 @@ public:
   virtual nsIntPoint      WidgetToScreenOffset();
   virtual bool            ShowsResizeIndicator(nsIntRect* aResizerRect);
 
   static  bool            ConvertStatus(nsEventStatus aStatus)
                           { return aStatus == nsEventStatus_eConsumeNoDefault; }
   NS_IMETHOD              DispatchEvent(nsGUIEvent* event, nsEventStatus & aStatus);
 
   virtual bool            ComputeShouldAccelerate(bool aDefault);
-  virtual bool            ShouldUseOffMainThreadCompositing();
+  virtual bool            ShouldUseOffMainThreadCompositing() MOZ_OVERRIDE;
 
   NS_IMETHOD        SetCursor(nsCursor aCursor);
   NS_IMETHOD        SetCursor(imgIContainer* aCursor, uint32_t aHotspotX, uint32_t aHotspotY);
 
   NS_IMETHOD        CaptureRollupEvents(nsIRollupListener * aListener, bool aDoCapture);
   NS_IMETHOD        SetTitle(const nsAString& title);
 
   NS_IMETHOD        GetAttention(int32_t aCycleCount);
--- a/widget/cocoa/nsChildView.mm
+++ b/widget/cocoa/nsChildView.mm
@@ -1416,17 +1416,18 @@ nsChildView::ComputeShouldAccelerate(boo
 }
 
 bool
 nsChildView::ShouldUseOffMainThreadCompositing()
 {
   // OMTC doesn't work with Basic Layers on OS X right now. Once it works, we'll
   // still want to disable it for certain kinds of windows (e.g. popups).
   return nsBaseWidget::ShouldUseOffMainThreadCompositing() &&
-         ComputeShouldAccelerate(mUseLayersAcceleration);
+         (ComputeShouldAccelerate(mUseLayersAcceleration) ||
+          Preferences::GetBool("layers.offmainthreadcomposition.prefer-basic", false));
 }
 
 inline uint16_t COLOR8TOCOLOR16(uint8_t color8)
 {
   // return (color8 == 0xFF ? 0xFFFF : (color8 << 8));
   return (color8 << 8) | color8;  /* (color8 * 257) == (color8 * 0x0101) */
 }
 
--- a/widget/xpwidgets/nsBaseWidget.cpp
+++ b/widget/xpwidgets/nsBaseWidget.cpp
@@ -905,25 +905,21 @@ void nsBaseWidget::CreateCompositor()
   nsIntRect rect;
   GetBounds(rect);
   CreateCompositor(rect.width, rect.height);
 }
 
 mozilla::layers::LayersBackend
 nsBaseWidget::GetPreferredCompositorBackend()
 {
-  // We need a separate preference here (instead of using mUseLayersAcceleration)
-  // because we force enable accelerated layers with e10s. Once the BasicCompositor
-  // is stable enough to be used for Ripc/Cipc, then we can remove that and this
-  // pref.
-  if (Preferences::GetBool("layers.offmainthreadcomposition.prefer-basic", false)) {
-    return mozilla::layers::LAYERS_BASIC;
+  if (mUseLayersAcceleration) {
+    return mozilla::layers::LAYERS_OPENGL;
   }
 
-  return mozilla::layers::LAYERS_OPENGL;
+  return mozilla::layers::LAYERS_BASIC;
 }
 
 void nsBaseWidget::CreateCompositor(int aWidth, int aHeight)
 {
   // Recreating this is tricky, as we may still have an old and we need
   // to make sure it's properly destroyed by calling DestroyCompositor!
 
   // If we've already received a shutdown notification, don't try