Bug 1289105 - Don't use use PersistentBufferProviderShared if the canvas layer is unlikely to be chared with the compositor process. r=jnicol
authorNicolas Silva <nsilva@mozilla.com>
Tue, 26 Jul 2016 12:57:03 +0200
changeset 331773 64900003b7cc5cc029f9b77110cf778056851589
parent 331772 a99dade5a9b61bab222daaf033229a237e882659
child 331774 1b0a671de425ccad3460a9e9d02935a4472f04df
push id9858
push userjlund@mozilla.com
push dateMon, 01 Aug 2016 14:37:10 +0000
treeherdermozilla-aurora@203106ef6cb6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjnicol
bugs1289105
milestone50.0a1
Bug 1289105 - Don't use use PersistentBufferProviderShared if the canvas layer is unlikely to be chared with the compositor process. r=jnicol
gfx/layers/client/ClientLayerManager.cpp
--- a/gfx/layers/client/ClientLayerManager.cpp
+++ b/gfx/layers/client/ClientLayerManager.cpp
@@ -844,17 +844,22 @@ ClientLayerManager::DependsOnStaleDevice
   return gfxPlatform::GetPlatform()->GetDeviceCounter() != mDeviceCounter;
 }
 
 
 already_AddRefed<PersistentBufferProvider>
 ClientLayerManager::CreatePersistentBufferProvider(const gfx::IntSize& aSize,
                                                    gfx::SurfaceFormat aFormat)
 {
-  if (gfxPrefs::PersistentBufferProviderSharedEnabled()) {
+  // Don't use a shared buffer provider if compositing is considered "not cheap"
+  // because the canvas will most likely be flattened into a thebes layer instead
+  // of being sent to the compositor, in which case rendering into shared memory
+  // is wasteful.
+  if (IsCompositingCheap() &&
+      gfxPrefs::PersistentBufferProviderSharedEnabled()) {
     RefPtr<PersistentBufferProvider> provider
       = PersistentBufferProviderShared::Create(aSize, aFormat, AsShadowForwarder());
     if (provider) {
       return provider.forget();
     }
   }
 
   return LayerManager::CreatePersistentBufferProvider(aSize, aFormat);