Bug 992218 - Don't flag texture clients for reuse if they're actually still being used. r=nical a=lsblakk
authorKartikaya Gupta <kgupta@mozilla.com>
Fri, 25 Apr 2014 09:39:20 -0400
changeset 193138 10a8ef2b96c7b3fda6e9f27bac80da0122e97629
parent 193137 ec1d3e26a17292c34045f915993b57d932879060
child 193139 f19024e5e5d53ea3dc1bdee2eccaf1fd9f6992ba
push id474
push userasasaki@mozilla.com
push dateMon, 02 Jun 2014 21:01:02 +0000
treeherdermozilla-release@967f4cf1b31c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersnical, lsblakk
bugs992218
milestone30.0a2
Bug 992218 - Don't flag texture clients for reuse if they're actually still being used. r=nical a=lsblakk
gfx/layers/client/TiledContentClient.cpp
--- a/gfx/layers/client/TiledContentClient.cpp
+++ b/gfx/layers/client/TiledContentClient.cpp
@@ -479,17 +479,24 @@ TileClient::DiscardFrontBuffer()
   }
 }
 
 void
 TileClient::DiscardBackBuffer()
 {
   if (mBackBuffer) {
     MOZ_ASSERT(mBackLock);
-    mManager->GetTexturePool(mBackBuffer->AsTextureClientDrawTarget()->GetFormat())->ReturnTextureClient(mBackBuffer);
+    if (!mBackBuffer->ImplementsLocking() && mBackLock->GetReadCount() > 1) {
+      // Our current back-buffer is still locked by the compositor. This can occur
+      // when the client is producing faster than the compositor can consume. In
+      // this case we just want to drop it and not return it to the pool.
+      mManager->GetTexturePool(mBackBuffer->AsTextureClientDrawTarget()->GetFormat())->ReportClientLost();
+    } else {
+      mManager->GetTexturePool(mBackBuffer->AsTextureClientDrawTarget()->GetFormat())->ReturnTextureClient(mBackBuffer);
+    }
     mBackLock->ReadUnlock();
     mBackBuffer = nullptr;
     mBackLock = nullptr;
   }
 }
 
 TextureClient*
 TileClient::GetBackBuffer(const nsIntRegion& aDirtyRegion, TextureClientPool *aPool, bool *aCreatedTextureClient, bool aCanRerasterizeValidRegion)