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 346739 64900003b7cc5cc029f9b77110cf778056851589
parent 346738 a99dade5a9b61bab222daaf033229a237e882659
child 346740 1b0a671de425ccad3460a9e9d02935a4472f04df
push id6389
push userraliiev@mozilla.com
push dateMon, 19 Sep 2016 13:38:22 +0000
treeherdermozilla-beta@01d67bfe6c81 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjnicol
bugs1289105
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 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);