Bug 1264365 - Disable hardware acceleration for small popup widgets. r=dvander
authorNicolas Silva <nsilva@mozilla.com>
Thu, 21 Apr 2016 12:20:31 +0200
changeset 302071 e9723c6c6136e2311374e5e6d4ea9cdc9f42b6b3
parent 302070 4517cfdd7f7997324aacf013102334b4aab1b09a
child 302072 de10fb9ec9e53855b1770530c184fc4be3ad03de
push id78573
push usernsilva@mozilla.com
push dateMon, 20 Jun 2016 09:24:37 +0000
treeherdermozilla-inbound@e9723c6c6136 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdvander
bugs1264365
milestone50.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 1264365 - Disable hardware acceleration for small popup widgets. r=dvander
widget/nsBaseWidget.cpp
widget/nsBaseWidget.h
--- a/widget/nsBaseWidget.cpp
+++ b/widget/nsBaseWidget.cpp
@@ -926,20 +926,30 @@ nsBaseWidget::AutoLayerManagerSetup::~Au
   if (mLayerManager) {
     NS_ASSERTION(mLayerManager->GetBackendType() == LayersBackend::LAYERS_BASIC,
       "AutoLayerManagerSetup instantiated for non-basic layer backend!");
     mLayerManager->SetDefaultTarget(nullptr);
     mLayerManager->SetDefaultTargetConfiguration(mozilla::layers::BufferMode::BUFFER_NONE, ROTATION_0);
   }
 }
 
+bool nsBaseWidget::IsSmallPopup() const
+{
+  return mWindowType == eWindowType_popup && mPopupType != ePopupTypePanel;
+}
+
 bool
 nsBaseWidget::ComputeShouldAccelerate()
 {
-  return gfx::gfxConfig::IsEnabled(gfx::Feature::HW_COMPOSITING);
+  bool enabled = gfx::gfxConfig::IsEnabled(gfx::Feature::HW_COMPOSITING);
+#ifdef MOZ_WIDGET_GTK
+  return enabled && !IsSmallPopup();
+#else
+  return enabled;
+#endif
 }
 
 bool
 nsBaseWidget::UseAPZ()
 {
   return (gfxPlatform::AsyncPanZoomEnabled() &&
           (WindowType() == eWindowType_toplevel || WindowType() == eWindowType_child));
 }
--- a/widget/nsBaseWidget.h
+++ b/widget/nsBaseWidget.h
@@ -288,16 +288,20 @@ public:
   void NotifyUIStateChanged(UIStateChangeType aShowAccelerators,
                             UIStateChangeType aShowFocusRings);
 
 #ifdef ACCESSIBILITY
   // Get the accessible for the window.
   mozilla::a11y::Accessible* GetRootAccessible();
 #endif
 
+  // Return true if this is a simple widget (that is typically not worth
+  // accelerating)
+  bool IsSmallPopup() const;
+
   nsPopupLevel PopupLevel() { return mPopupLevel; }
 
   virtual LayoutDeviceIntSize
   ClientToWindowSize(const LayoutDeviceIntSize& aClientSize) override
   {
     return aClientSize;
   }