backout of rev 1a52e0063440 b=979489
authorVladimir Vukicevic <vladimir@pobox.com>
Mon, 10 Mar 2014 21:03:02 -0400
changeset 191115 38ecb36a4f528db1ab062b2c7f99f0730bf05886
parent 191114 1a52e0063440dd6f35a0834760784a21d2e6ec4f
child 191116 da877497bf3edefb4169d0dc4aef84d1522d94d6
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)
bugs979489
milestone30.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
backout of rev 1a52e0063440 b=979489
b2g/chrome/content/settings.js
gfx/layers/AtomicRefCountedWithFinalize.h
gfx/layers/CompositorTypes.h
gfx/layers/client/ClientLayerManager.cpp
gfx/layers/client/ClientLayerManager.h
gfx/layers/client/ClientThebesLayer.cpp
gfx/layers/client/SimpleTextureClientPool.cpp
gfx/layers/client/SimpleTextureClientPool.h
gfx/layers/client/SimpleTiledContentClient.cpp
gfx/layers/client/SimpleTiledContentClient.h
gfx/layers/client/TextureClient.cpp
gfx/layers/client/TextureClient.h
gfx/layers/composite/CompositableHost.cpp
gfx/layers/composite/TextureHost.cpp
gfx/layers/composite/TextureHost.h
gfx/layers/composite/TiledContentHost.cpp
gfx/layers/composite/TiledContentHost.h
gfx/layers/ipc/PTexture.ipdl
gfx/layers/moz.build
gfx/thebes/gfxPrefs.h
--- a/b2g/chrome/content/settings.js
+++ b/b2g/chrome/content/settings.js
@@ -660,18 +660,17 @@ let settingsToObserve = {
   'wap.UAProf.url': '',
   'wap.UAProf.tagname': 'x-wap-profile',
   'devtools.eventlooplag.threshold': 100,
   'privacy.donottrackheader.enabled': false,
   'apz.force-enable': {
     prefName: 'dom.browser_frames.useAsyncPanZoom',
     defaultValue: false
   },
-  'layers.enable-tiles': true,
-  'layers.simple-tiles': false,
+  'layers.enable-tiles': false,
   'layers.progressive-paint': false,
   'layers.draw-tile-borders': false,
   'layers.dump': false,
   'debug.fps.enabled': {
     prefName: 'layers.acceleration.draw-fps',
     defaultValue: false
   },
   'debug.paint-flashing.enabled': {
--- a/gfx/layers/AtomicRefCountedWithFinalize.h
+++ b/gfx/layers/AtomicRefCountedWithFinalize.h
@@ -2,69 +2,46 @@
  * This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef MOZILLA_ATOMICREFCOUNTEDWITHFINALIZE_H_
 #define MOZILLA_ATOMICREFCOUNTEDWITHFINALIZE_H_
 
 #include "mozilla/RefPtr.h"
-#include "mozilla/NullPtr.h"
 
 namespace mozilla {
 
 template<typename T>
 class AtomicRefCountedWithFinalize
 {
   protected:
     AtomicRefCountedWithFinalize()
-      : mRecycleCallback(nullptr)
-      , mRefCount(0)
+      : mRefCount(0)
     {}
 
     ~AtomicRefCountedWithFinalize() {}
 
   public:
     void AddRef() {
       MOZ_ASSERT(mRefCount >= 0);
       ++mRefCount;
     }
 
     void Release() {
       MOZ_ASSERT(mRefCount > 0);
-      int currCount = --mRefCount;
-      if (0 == currCount) {
-        // Recycle listeners must call ClearRecycleCallback
-        // before releasing their strong reference.
-        MOZ_ASSERT(mRecycleCallback == nullptr);
+      if (0 == --mRefCount) {
 #ifdef DEBUG
         mRefCount = detail::DEAD;
 #endif
         T* derived = static_cast<T*>(this);
         derived->Finalize();
         delete derived;
-      } else if (1 == currCount && mRecycleCallback) {
-        T* derived = static_cast<T*>(this);
-        mRecycleCallback(derived, mClosure);
       }
     }
 
-    typedef void (*RecycleCallback)(T* aObject, void* aClosure);
-    /**
-     * Set a callback responsible for recycling this object
-     * before it is finalized.
-     */
-    void SetRecycleCallback(RecycleCallback aCallback, void* aClosure)
-    {
-      mRecycleCallback = aCallback;
-      mClosure = aClosure;
-    }
-    void ClearRecycleCallback() { SetRecycleCallback(nullptr, nullptr); }
-
 private:
-    RecycleCallback mRecycleCallback;
-    void *mClosure;
     Atomic<int> mRefCount;
 };
 
 }
 
 #endif
--- a/gfx/layers/CompositorTypes.h
+++ b/gfx/layers/CompositorTypes.h
@@ -50,18 +50,16 @@ const TextureFlags TEXTURE_RB_SWAPPED   
 
 const TextureFlags TEXTURE_FRONT              = 1 << 12;
 // A texture host on white for component alpha
 const TextureFlags TEXTURE_ON_WHITE           = 1 << 13;
  // A texture host on black for component alpha
 const TextureFlags TEXTURE_ON_BLACK           = 1 << 14;
 // A texture host that supports tiling
 const TextureFlags TEXTURE_TILE               = 1 << 15;
-// A texture should be recycled when no longer in used
-const TextureFlags TEXTURE_RECYCLE            = 1 << 16;
 // Texture contents should be initialized
 // from the previous texture.
 const TextureFlags TEXTURE_COPY_PREVIOUS      = 1 << 24;
 // Who is responsible for deallocating the shared data.
 // if TEXTURE_DEALLOCATE_CLIENT is set, the shared data is deallocated on the
 // client side and requires some extra synchronizaion to ensure race-free
 // deallocation.
 // The default behaviour is to deallocate on the host side.
@@ -161,19 +159,17 @@ enum CompositableType
   // the deprecated compositable types
   BUFFER_IMAGE_SINGLE,    // image/canvas with a single texture, single buffered
   BUFFER_IMAGE_BUFFERED,  // canvas, double buffered
   BUFFER_BRIDGE,          // image bridge protocol
   BUFFER_CONTENT,         // thebes layer interface, single buffering
   BUFFER_CONTENT_DIRECT,  // thebes layer interface, double buffering
   BUFFER_CONTENT_INC,     // thebes layer interface, only sends incremental
                           // updates to a texture on the compositor side.
-  // somewhere in the middle
   BUFFER_TILED,           // tiled thebes layer
-  BUFFER_SIMPLE_TILED,
   // the new compositable types
   COMPOSITABLE_IMAGE,     // image with single buffering
   COMPOSITABLE_CONTENT_SINGLE,  // thebes layer interface, single buffering
   COMPOSITABLE_CONTENT_DOUBLE,  // thebes layer interface, double buffering
   BUFFER_COUNT
 };
 
 /**
--- a/gfx/layers/client/ClientLayerManager.cpp
+++ b/gfx/layers/client/ClientLayerManager.cpp
@@ -16,17 +16,16 @@
 #include "mozilla/layers/CompositableClient.h"  // for CompositableChild, etc
 #include "mozilla/layers/ContentClient.h"  // for ContentClientRemote
 #include "mozilla/layers/ISurfaceAllocator.h"
 #include "mozilla/layers/LayersMessages.h"  // for EditReply, etc
 #include "mozilla/layers/LayersSurfaces.h"  // for SurfaceDescriptor
 #include "mozilla/layers/PLayerChild.h"  // for PLayerChild
 #include "mozilla/layers/LayerTransactionChild.h"
 #include "mozilla/layers/TextureClientPool.h" // for TextureClientPool
-#include "mozilla/layers/SimpleTextureClientPool.h" // for SimpleTextureClientPool
 #include "nsAString.h"
 #include "nsIWidget.h"                  // for nsIWidget
 #include "nsTArray.h"                   // for AutoInfallibleTArray
 #include "nsXULAppAPI.h"                // for XRE_GetProcessType, etc
 #include "TiledLayerBuffer.h"
 #ifdef MOZ_WIDGET_ANDROID
 #include "AndroidBridge.h"
 #endif
@@ -470,31 +469,16 @@ ClientLayerManager::GetTexturePool(Surfa
       new TextureClientPool(aFormat, IntSize(TILEDLAYERBUFFER_TILE_SIZE,
                                              TILEDLAYERBUFFER_TILE_SIZE),
                             mForwarder));
   mTexturePools.insertBack(texturePoolMember);
 
   return texturePoolMember->mTexturePool;
 }
 
-SimpleTextureClientPool*
-ClientLayerManager::GetSimpleTileTexturePool(SurfaceFormat aFormat)
-{
-  int index = (int) aFormat;
-  mSimpleTilePools.EnsureLengthAtLeast(index+1);
-
-  if (mSimpleTilePools[index].get() == nullptr) {
-    mSimpleTilePools[index] = new SimpleTextureClientPool(aFormat, IntSize(TILEDLAYERBUFFER_TILE_SIZE,
-                                                                           TILEDLAYERBUFFER_TILE_SIZE),
-                                                          mForwarder);
-  }
-
-  return mSimpleTilePools[index];
-}
-
 void
 ClientLayerManager::ClearCachedResources(Layer* aSubtree)
 {
   MOZ_ASSERT(!HasShadowManager() || !aSubtree);
   if (LayerTransactionChild* manager = mForwarder->GetShadowManager()) {
     manager->SendClearCachedResources();
   }
   if (aSubtree) {
--- a/gfx/layers/client/ClientLayerManager.h
+++ b/gfx/layers/client/ClientLayerManager.h
@@ -29,17 +29,16 @@ class nsIWidget;
 namespace mozilla {
 namespace layers {
 
 class ClientThebesLayer;
 class CompositorChild;
 class ImageLayer;
 class PLayerChild;
 class TextureClientPool;
-class SimpleTextureClientPool;
 
 class TextureClientPoolMember
   : public LinkedListElement<TextureClientPoolMember> {
 public:
   TextureClientPoolMember(gfx::SurfaceFormat aFormat, TextureClientPool* aTexturePool);
 
   gfx::SurfaceFormat mFormat;
   RefPtr<TextureClientPool> mTexturePool;
@@ -104,17 +103,16 @@ public:
   bool HasShadowManager() const { return mForwarder->HasShadowManager(); }
 
   virtual bool IsCompositingCheap();
   virtual bool HasShadowManagerInternal() const { return HasShadowManager(); }
 
   virtual void SetIsFirstPaint() MOZ_OVERRIDE;
 
   TextureClientPool *GetTexturePool(gfx::SurfaceFormat aFormat);
-  SimpleTextureClientPool *GetSimpleTileTexturePool(gfx::SurfaceFormat aFormat);
 
   // Drop cached resources and ask our shadow manager to do the same,
   // if we have one.
   virtual void ClearCachedResources(Layer* aSubtree = nullptr) MOZ_OVERRIDE;
 
   void SetRepeatTransaction() { mRepeatTransaction = true; }
   bool GetRepeatTransaction() { return mRepeatTransaction; }
 
@@ -225,19 +223,16 @@ private:
   bool mRepeatTransaction;
   bool mIsRepeatTransaction;
   bool mTransactionIncomplete;
   bool mCompositorMightResample;
   bool mNeedsComposite;
 
   RefPtr<ShadowLayerForwarder> mForwarder;
   LinkedList<TextureClientPoolMember> mTexturePools;
-
-  // indexed by gfx::SurfaceFormat
-  nsTArray<RefPtr<SimpleTextureClientPool> > mSimpleTilePools;
 };
 
 class ClientLayer : public ShadowableLayer
 {
 public:
   ClientLayer()
   {
     MOZ_COUNT_CTOR(ClientLayer);
--- a/gfx/layers/client/ClientThebesLayer.cpp
+++ b/gfx/layers/client/ClientThebesLayer.cpp
@@ -1,16 +1,15 @@
 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
  * This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "ClientThebesLayer.h"
 #include "ClientTiledThebesLayer.h"     // for ClientTiledThebesLayer
-#include "SimpleTiledContentClient.h"
 #include <stdint.h>                     // for uint32_t
 #include "GeckoProfiler.h"              // for PROFILER_LABEL
 #include "client/ClientLayerManager.h"  // for ClientLayerManager, etc
 #include "gfxASurface.h"                // for gfxASurface, etc
 #include "gfxContext.h"                 // for gfxContext
 #include "gfxRect.h"                    // for gfxRect
 #include "gfxPrefs.h"                   // for gfxPrefs
 #include "mozilla/Assertions.h"         // for MOZ_ASSERT, etc
@@ -172,27 +171,20 @@ ClientLayerManager::CreateThebesLayerWit
   if (
 #ifdef MOZ_B2G
       aHint == SCROLLABLE &&
 #endif
       gfxPrefs::LayersTilesEnabled() &&
       (AsShadowForwarder()->GetCompositorBackendType() == LayersBackend::LAYERS_OPENGL ||
        AsShadowForwarder()->GetCompositorBackendType() == LayersBackend::LAYERS_D3D9 ||
        AsShadowForwarder()->GetCompositorBackendType() == LayersBackend::LAYERS_D3D11)) {
-    if (gfxPrefs::LayersUseSimpleTiles()) {
-      nsRefPtr<SimpleClientTiledThebesLayer> layer =
-        new SimpleClientTiledThebesLayer(this);
-      CREATE_SHADOW(Thebes);
-      return layer.forget();
-    } else {
-      nsRefPtr<ClientTiledThebesLayer> layer =
-        new ClientTiledThebesLayer(this);
-      CREATE_SHADOW(Thebes);
-      return layer.forget();
-    }
+    nsRefPtr<ClientTiledThebesLayer> layer =
+      new ClientTiledThebesLayer(this);
+    CREATE_SHADOW(Thebes);
+    return layer.forget();
   } else
   {
     nsRefPtr<ClientThebesLayer> layer =
       new ClientThebesLayer(this);
     CREATE_SHADOW(Thebes);
     return layer.forget();
   }
 }
deleted file mode 100644
--- a/gfx/layers/client/SimpleTextureClientPool.cpp
+++ /dev/null
@@ -1,137 +0,0 @@
-/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*-
-* This Source Code Form is subject to the terms of the Mozilla Public
-* License, v. 2.0. If a copy of the MPL was not distributed with this
-* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#include "SimpleTextureClientPool.h"
-#include "CompositableClient.h"
-#include "mozilla/layers/ISurfaceAllocator.h"
-
-#include "gfxPrefs.h"
-
-#include "nsComponentManagerUtils.h"
-
-#if 0
-#define RECYCLE_LOG(...) printf_stderr(__VA_ARGS__)
-#else
-#define RECYCLE_LOG(...) do { } while (0)
-#endif
-
-namespace mozilla {
-namespace layers {
-
-using gfx::SurfaceFormat;
-
-/* static */ void
-SimpleTextureClientPool::ShrinkCallback(nsITimer *aTimer, void *aClosure)
-{
-  static_cast<SimpleTextureClientPool*>(aClosure)->ShrinkToMinimumSize();
-}
-
-/* static */ void
-SimpleTextureClientPool::RecycleCallback(TextureClient* aClient, void* aClosure)
-{
-  SimpleTextureClientPool* pool =
-    static_cast<SimpleTextureClientPool*>(aClosure);
-
-  aClient->ClearRecycleCallback();
-  pool->ReturnTextureClient(aClient);
-}
-
-/* static */ void
-SimpleTextureClientPool::WaitForCompositorRecycleCallback(TextureClient* aClient, void* aClosure)
-{
-  // This will grab a reference that will be released once the compositor
-  // acknowledges the remote recycle. Once it is received the object
-  // will be fully recycled.
-  aClient->WaitForCompositorRecycle();
-  aClient->SetRecycleCallback(SimpleTextureClientPool::RecycleCallback, aClosure);
-}
-
-SimpleTextureClientPool::SimpleTextureClientPool(gfx::SurfaceFormat aFormat, gfx::IntSize aSize,
-                                                 ISurfaceAllocator *aAllocator)
-  : mFormat(aFormat)
-  , mSize(aSize)
-  , mSurfaceAllocator(aAllocator)
-{
-  mTimer = do_CreateInstance("@mozilla.org/timer;1");
-}
-
-TemporaryRef<TextureClient>
-SimpleTextureClientPool::GetTextureClient(bool aAutoRecycle)
-{
-  // Try to fetch a client from the pool
-  RefPtr<TextureClient> textureClient;
-  if (mAvailableTextureClients.size()) {
-    textureClient = mAvailableTextureClients.top();
-    mAvailableTextureClients.pop();
-    RECYCLE_LOG("%s Skip allocate (%i left), returning %p\n", (mFormat == SurfaceFormat::B8G8R8A8?"poolA":"poolX"), mAvailableTextureClients.size(), textureClient.get());
-
-  } else {
-    // No unused clients in the pool, create one
-    if (gfxPrefs::ForceShmemTiles()) {
-      textureClient = TextureClient::CreateBufferTextureClient(mSurfaceAllocator, mFormat, TEXTURE_IMMEDIATE_UPLOAD | TEXTURE_RECYCLE);
-    } else {
-      textureClient = TextureClient::CreateTextureClientForDrawing(mSurfaceAllocator, mFormat, TEXTURE_FLAGS_DEFAULT | TEXTURE_RECYCLE);
-    }
-    if (!textureClient->AsTextureClientDrawTarget()->AllocateForSurface(mSize, ALLOC_DEFAULT)) {
-      NS_WARNING("TextureClient::AllocateForSurface failed!");
-    }
-    RECYCLE_LOG("%s Must allocate (0 left), returning %p\n", (mFormat == SurfaceFormat::B8G8R8A8?"poolA":"poolX"), textureClient.get());
-  }
-
-  if (aAutoRecycle) {
-    mOutstandingTextureClients.push_back(textureClient);
-    textureClient->SetRecycleCallback(SimpleTextureClientPool::WaitForCompositorRecycleCallback, this);
-  }
-
-  return textureClient;
-}
-
-void
-SimpleTextureClientPool::ReturnTextureClient(TextureClient *aClient)
-{
-  if (!aClient) {
-    return;
-  }
-
-  // If we haven't hit our max cached client limit, add this one
-  if (mAvailableTextureClients.size() < sMaxTextureClients) {
-    mAvailableTextureClients.push(aClient);
-    RECYCLE_LOG("%s recycled %p (have %d)\n", (mFormat == SurfaceFormat::B8G8R8A8?"poolA":"poolX"), aClient, mAvailableTextureClients.size());
-  } else {
-    RECYCLE_LOG("%s did not recycle %p (have %d)\n", (mFormat == SurfaceFormat::B8G8R8A8?"poolA":"poolX"), aClient, mAvailableTextureClients.size());
-  }
-
-  // Kick off the pool shrinking timer if there are still more unused texture
-  // clients than our desired minimum cache size.
-  if (mAvailableTextureClients.size() > sMinCacheSize) {
-    mTimer->InitWithFuncCallback(SimpleTextureClientPool::ShrinkCallback, this, sShrinkTimeout,
-                                 nsITimer::TYPE_ONE_SHOT);
-  }
-
-  mOutstandingTextureClients.remove(aClient);
-}
-
-void
-SimpleTextureClientPool::ShrinkToMinimumSize()
-{
-  RECYCLE_LOG("%s ShrinkToMinimumSize, removing %d clients", (mFormat == SurfaceFormat::B8G8R8A8?"poolA":"poolX"), mAvailableTextureClients.size() > sMinCacheSize ? mAvailableTextureClients.size() - sMinCacheSize : 0);
-
-  mTimer->Cancel();
-
-  while (mAvailableTextureClients.size() > sMinCacheSize) {
-    mAvailableTextureClients.pop();
-  }
-}
-
-void
-SimpleTextureClientPool::Clear()
-{
-  while (!mAvailableTextureClients.empty()) {
-    mAvailableTextureClients.pop();
-  }
-}
-
-}
-}
deleted file mode 100644
--- a/gfx/layers/client/SimpleTextureClientPool.h
+++ /dev/null
@@ -1,91 +0,0 @@
-/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*-
-* This Source Code Form is subject to the terms of the Mozilla Public
-* License, v. 2.0. If a copy of the MPL was not distributed with this
-* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#ifndef MOZILLA_GFX_SIMPLETEXTURECLIENTPOOL_H
-#define MOZILLA_GFX_SIMPLETEXTURECLIENTPOOL_H
-
-#include "mozilla/gfx/Types.h"
-#include "mozilla/gfx/Point.h"
-#include "mozilla/RefPtr.h"
-#include "TextureClient.h"
-#include "nsITimer.h"
-#include <stack>
-#include <list>
-
-namespace mozilla {
-namespace layers {
-
-class ISurfaceAllocator;
-
-class SimpleTextureClientPool : public RefCounted<SimpleTextureClientPool>
-{
-public:
-  MOZ_DECLARE_REFCOUNTED_TYPENAME(SimpleTextureClientPool)
-
-  SimpleTextureClientPool(gfx::SurfaceFormat aFormat, gfx::IntSize aSize,
-                          ISurfaceAllocator *aAllocator);
-
-  ~SimpleTextureClientPool()
-  {
-    for (auto it = mOutstandingTextureClients.begin(); it != mOutstandingTextureClients.end(); ++it) {
-      (*it)->ClearRecycleCallback();
-    }
-  }
-
-  /**
-   * If a TextureClient is AutoRecycled, when the last reference is
-   * released this object will be automatically return to the pool as
-   * soon as the compositor informs us it is done with it.
-   */
-  TemporaryRef<TextureClient> GetTextureClient(bool aAutoRecycle = false);
-  TemporaryRef<TextureClient> GetTextureClientWithAutoRecycle() { return GetTextureClient(true); }
-
-  void ReturnTextureClient(TextureClient *aClient);
-
-  void ShrinkToMinimumSize();
-
-  void Clear();
-
-private:
-  // The time in milliseconds before the pool will be shrunk to the minimum
-  // size after returning a client.
-  static const uint32_t sShrinkTimeout = 3000;
-
-  // The minimum size of the pool (the number of tiles that will be kept after
-  // shrinking).
-  static const uint32_t sMinCacheSize = 16;
-
-  // This is the number of cached texture clients we don't want to exceed, even
-  // temporarily (pre-shrink)
-  static const uint32_t sMaxTextureClients = 50;
-
-  static void ShrinkCallback(nsITimer *aTimer, void *aClosure);
-  static void RecycleCallback(TextureClient* aClient, void* aClosure);
-  static void WaitForCompositorRecycleCallback(TextureClient* aClient, void* aClosure);
-
-  gfx::SurfaceFormat mFormat;
-  gfx::IntSize mSize;
-
-  // We use a std::stack and make sure to use it the following way:
-  //   new (available to be used) elements are push()'d to the front
-  //   requests are served from the front via pop()
-  //     -- the thinking is that recently-used elements are most likely
-  //     to be in any data cache, so we can get some wins there
-  //     -- the converse though is that if there is some GPU locking going on
-  //     the most recently used elements may also have the most contention;
-  //     if we see that, then we should use push_back() to add new elements
-  //   when we shrink this list, we use pop(), but should use pop_back() to
-  //   nuke the oldest.
-  // We may need to switch to a std::deque
-  std::stack<RefPtr<TextureClient> > mAvailableTextureClients;
-  std::list<RefPtr<TextureClient> > mOutstandingTextureClients;
-
-  nsRefPtr<nsITimer> mTimer;
-  RefPtr<ISurfaceAllocator> mSurfaceAllocator;
-};
-
-}
-}
-#endif /* MOZILLA_GFX_SIMPLETEXTURECLIENTPOOL_H */
deleted file mode 100644
--- a/gfx/layers/client/SimpleTiledContentClient.cpp
+++ /dev/null
@@ -1,470 +0,0 @@
-/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*-
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#include "mozilla/layers/SimpleTiledContentClient.h"
-
-#include <math.h>                       // for ceil, ceilf, floor
-#include "ClientTiledThebesLayer.h"     // for ClientTiledThebesLayer
-#include "GeckoProfiler.h"              // for PROFILER_LABEL
-#include "ClientLayerManager.h"         // for ClientLayerManager
-#include "CompositorChild.h"            // for CompositorChild
-#include "gfxContext.h"                 // for gfxContext, etc
-#include "gfxPlatform.h"                // for gfxPlatform
-#include "gfxRect.h"                    // for gfxRect
-#include "mozilla/Attributes.h"         // for MOZ_THIS_IN_INITIALIZER_LIST
-#include "mozilla/MathAlgorithms.h"     // for Abs
-#include "mozilla/gfx/Point.h"          // for IntSize
-#include "mozilla/gfx/Rect.h"           // for Rect
-#include "mozilla/layers/CompositableForwarder.h"
-#include "mozilla/layers/ShadowLayers.h"  // for ShadowLayerForwarder
-#include "SimpleTextureClientPool.h"
-#include "nsDebug.h"                    // for NS_ASSERTION
-#include "nsISupportsImpl.h"            // for gfxContext::AddRef, etc
-#include "nsSize.h"                     // for nsIntSize
-#include "gfxReusableSharedImageSurfaceWrapper.h"
-#include "nsMathUtils.h"               // for NS_roundf
-#include "gfx2DGlue.h"
-
-#define ALOG(...)  __android_log_print(ANDROID_LOG_INFO, "SimpleTiles", __VA_ARGS__)
-
-using namespace mozilla::gfx;
-
-namespace mozilla {
-namespace layers {
-
-void
-SimpleTiledLayerBuffer::PaintThebes(const nsIntRegion& aNewValidRegion,
-                                    const nsIntRegion& aPaintRegion,
-                                    LayerManager::DrawThebesLayerCallback aCallback,
-                                    void* aCallbackData)
-{
-  mCallback = aCallback;
-  mCallbackData = aCallbackData;
-
-#ifdef GFX_TILEDLAYER_PREF_WARNINGS
-  long start = PR_IntervalNow();
-#endif
-
-  // If this region is empty XMost() - 1 will give us a negative value.
-  NS_ASSERTION(!aPaintRegion.GetBounds().IsEmpty(), "Empty paint region\n");
-
-  PROFILER_LABEL("SimpleTiledLayerBuffer", "PaintThebesUpdate");
-
-  Update(aNewValidRegion, aPaintRegion);
-
-#ifdef GFX_TILEDLAYER_PREF_WARNINGS
-  if (PR_IntervalNow() - start > 10) {
-    const nsIntRect bounds = aPaintRegion.GetBounds();
-    printf_stderr("Time to tile [%i, %i, %i, %i] -> %i\n", bounds.x, bounds.y, bounds.width, bounds.height, PR_IntervalNow() - start);
-  }
-#endif
-
-  mLastPaintOpaque = mThebesLayer->CanUseOpaqueSurface();
-  mCallback = nullptr;
-  mCallbackData = nullptr;
-}
-
-SimpleTiledLayerTile
-SimpleTiledLayerBuffer::ValidateTile(SimpleTiledLayerTile aTile,
-                                     const nsIntPoint& aTileOrigin,
-                                     const nsIntRegion& aDirtyRegion)
-{
-  PROFILER_LABEL("SimpleTiledLayerBuffer", "ValidateTile");
-  static gfx::IntSize kTileSize(TILEDLAYERBUFFER_TILE_SIZE, TILEDLAYERBUFFER_TILE_SIZE);
-
-  gfx::SurfaceFormat tileFormat = gfxPlatform::GetPlatform()->Optimal2DFormatForContent(GetContentType());
-
-  // if this is true, we're using a separate buffer to do our drawing first
-  bool doBufferedDrawing = true;
-  bool fullPaint = false;
-
-  RefPtr<TextureClient> textureClient = mManager->GetSimpleTileTexturePool(tileFormat)->GetTextureClientWithAutoRecycle();
-
-  if (!textureClient) {
-    NS_WARNING("TextureClient allocation failed");
-    return SimpleTiledLayerTile();
-  }
-
-  if (!textureClient->Lock(OPEN_WRITE)) {
-    NS_WARNING("TextureClient lock failed");
-    return SimpleTiledLayerTile();
-  }
-
-  TextureClientSurface *textureClientSurf = textureClient->AsTextureClientSurface();
-  if (!textureClientSurf) {
-    doBufferedDrawing = false;
-  }
-
-  RefPtr<DrawTarget> drawTarget;
-
-  nsRefPtr<gfxImageSurface> clientAsImageSurface;
-  unsigned char *bufferData = nullptr;
-
-  // these are set/updated differently based on doBufferedDrawing
-  nsIntRect drawBounds;
-  nsIntRegion drawRegion;
-  nsIntRegion invalidateRegion;
-
-  if (doBufferedDrawing) {
-    // try to obtain the TextureClient as an ImageSurface, so that we can
-    // access the pixels directly
-    nsRefPtr<gfxASurface> asurf = textureClientSurf->GetAsSurface();
-    clientAsImageSurface = asurf ? asurf->GetAsImageSurface() : nullptr;
-    if (clientAsImageSurface) {
-      int32_t bufferStride = clientAsImageSurface->Stride();
-
-      if (!aTile.mCachedBuffer) {
-        aTile.mCachedBuffer = SharedBuffer::Create(clientAsImageSurface->GetDataSize());
-        fullPaint = true;
-      }
-      bufferData = (unsigned char*) aTile.mCachedBuffer->Data();
-
-      drawTarget = gfxPlatform::GetPlatform()->CreateDrawTargetForData(bufferData,
-                                                                       kTileSize,
-                                                                       bufferStride,
-                                                                       tileFormat);
-
-      if (fullPaint) {
-        drawBounds = nsIntRect(aTileOrigin.x, aTileOrigin.y, GetScaledTileLength(), GetScaledTileLength());
-        drawRegion = nsIntRegion(drawBounds);
-      } else {
-        drawBounds = aDirtyRegion.GetBounds();
-        drawRegion = nsIntRegion(drawBounds);
-        if (GetContentType() == gfxContentType::COLOR_ALPHA)
-          drawTarget->ClearRect(Rect(drawBounds.x - aTileOrigin.x, drawBounds.y - aTileOrigin.y,
-                                     drawBounds.width, drawBounds.height));
-      }
-    } else {
-      // failed to obtain the client as an ImageSurface
-      doBufferedDrawing = false;
-    }
-  }
-
-  // this might get set above if we couldn't extract out a buffer
-  if (!doBufferedDrawing) {
-    drawTarget = textureClient->AsTextureClientDrawTarget()->GetAsDrawTarget();
-
-    fullPaint = true;
-    drawBounds = nsIntRect(aTileOrigin.x, aTileOrigin.y, GetScaledTileLength(), GetScaledTileLength());
-    drawRegion = nsIntRegion(drawBounds);
-
-    if (GetContentType() == gfxContentType::COLOR_ALPHA)
-      drawTarget->ClearRect(Rect(0, 0, drawBounds.width, drawBounds.height));
-  }
-
-  // do the drawing
-  RefPtr<gfxContext> ctxt = new gfxContext(drawTarget);
-
-  ctxt->Scale(mResolution, mResolution);
-  ctxt->Translate(gfxPoint(-aTileOrigin.x, -aTileOrigin.y));
-
-  mCallback(mThebesLayer, ctxt,
-            drawRegion,
-            fullPaint ? DrawRegionClip::CLIP_NONE : DrawRegionClip::DRAW_SNAPPED, // XXX DRAW or DRAW_SNAPPED?
-            invalidateRegion,
-            mCallbackData);
-
-  ctxt = nullptr;
-  drawTarget = nullptr;
-
-  if (doBufferedDrawing) {
-    memcpy(clientAsImageSurface->Data(), bufferData, clientAsImageSurface->GetDataSize());
-    clientAsImageSurface = nullptr;
-    bufferData = nullptr;
-  }
-
-  textureClient->Unlock();
-
-  if (!mCompositableClient->AddTextureClient(textureClient)) {
-    NS_WARNING("Failed to add tile TextureClient [simple]");
-    return SimpleTiledLayerTile();
-  }
-
-  // aTile.mCachedBuffer was set earlier
-  aTile.mTileBuffer = textureClient;
-  aTile.mManager = mManager;
-  aTile.mLastUpdate = TimeStamp::Now();
-
-  return aTile;
-}
-
-SurfaceDescriptorTiles
-SimpleTiledLayerBuffer::GetSurfaceDescriptorTiles()
-{
-  InfallibleTArray<TileDescriptor> tiles;
-
-  for (size_t i = 0; i < mRetainedTiles.Length(); i++) {
-    tiles.AppendElement(mRetainedTiles[i].GetTileDescriptor());
-  }
-
-  return SurfaceDescriptorTiles(mValidRegion, mPaintedRegion,
-                                tiles, mRetainedWidth, mRetainedHeight,
-                                mResolution);
-}
-
-bool
-SimpleTiledLayerBuffer::HasFormatChanged() const
-{
-  return mThebesLayer->CanUseOpaqueSurface() != mLastPaintOpaque;
-}
-
-gfxContentType
-SimpleTiledLayerBuffer::GetContentType() const
-{
-  if (mThebesLayer->CanUseOpaqueSurface())
-    return gfxContentType::COLOR;
-
-  return gfxContentType::COLOR_ALPHA;
-}
-
-SimpleTiledContentClient::SimpleTiledContentClient(SimpleClientTiledThebesLayer* aThebesLayer,
-                                                   ClientLayerManager* aManager)
-  : CompositableClient(aManager->AsShadowForwarder())
-  , mTiledBuffer(aThebesLayer, MOZ_THIS_IN_INITIALIZER_LIST(), aManager)
-{
-  MOZ_COUNT_CTOR(SimpleTiledContentClient);
-}
-
-SimpleTiledContentClient::~SimpleTiledContentClient()
-{
-  MOZ_COUNT_DTOR(SimpleTiledContentClient);
-  mTiledBuffer.Release();
-}
-
-void
-SimpleTiledContentClient::UseTiledLayerBuffer()
-{
-  mForwarder->UseTiledLayerBuffer(this, mTiledBuffer.GetSurfaceDescriptorTiles());
-  mTiledBuffer.ClearPaintedRegion();
-}
-
-SimpleClientTiledThebesLayer::SimpleClientTiledThebesLayer(ClientLayerManager* aManager)
-  : ThebesLayer(aManager,
-                static_cast<ClientLayer*>(MOZ_THIS_IN_INITIALIZER_LIST()))
-  , mContentClient()
-{
-  MOZ_COUNT_CTOR(SimpleClientTiledThebesLayer);
-
-  mPaintData.mLastScrollOffset = ScreenPoint(0, 0);
-  mPaintData.mFirstPaint = true;
-}
-
-SimpleClientTiledThebesLayer::~SimpleClientTiledThebesLayer()
-{
-  MOZ_COUNT_DTOR(SimpleClientTiledThebesLayer);
-}
-
-void
-SimpleClientTiledThebesLayer::FillSpecificAttributes(SpecificLayerAttributes& aAttrs)
-{
-  aAttrs = ThebesLayerAttributes(GetValidRegion());
-}
-
-static LayoutDeviceRect
-ApplyScreenToLayoutTransform(const gfx3DMatrix& aTransform, const ScreenRect& aScreenRect)
-{
-  gfxRect input(aScreenRect.x, aScreenRect.y, aScreenRect.width, aScreenRect.height);
-  gfxRect output = aTransform.TransformBounds(input);
-  return LayoutDeviceRect(output.x, output.y, output.width, output.height);
-}
-
-void
-SimpleClientTiledThebesLayer::BeginPaint()
-{
-  if (ClientManager()->IsRepeatTransaction()) {
-    return;
-  }
-
-  mPaintData.mLowPrecisionPaintCount = 0;
-  mPaintData.mPaintFinished = false;
-
-  // Get the metrics of the nearest scroll container.
-  ContainerLayer* scrollParent = nullptr;
-  for (ContainerLayer* parent = GetParent(); parent; parent = parent->GetParent()) {
-    const FrameMetrics& metrics = parent->GetFrameMetrics();
-    if (metrics.mScrollId != FrameMetrics::NULL_SCROLL_ID) {
-      scrollParent = parent;
-      break;
-    }
-  }
-
-  if (!scrollParent) {
-    // XXX I don't think this can happen, but if it does, warn and set the
-    //     composition bounds to empty so that progressive updates are disabled.
-    NS_WARNING("Tiled Thebes layer with no scrollable container parent");
-    mPaintData.mCompositionBounds.SetEmpty();
-    return;
-  }
-
-  const FrameMetrics& metrics = scrollParent->GetFrameMetrics();
-
-  // Calculate the transform required to convert screen space into transformed
-  // layout device space.
-  gfx::Matrix4x4 effectiveTransform = GetEffectiveTransform();
-  for (ContainerLayer* parent = GetParent(); parent; parent = parent->GetParent()) {
-    if (parent->UseIntermediateSurface()) {
-      effectiveTransform = effectiveTransform * parent->GetEffectiveTransform();
-    }
-  }
-  gfx3DMatrix layoutToScreen;
-  gfx::To3DMatrix(effectiveTransform, layoutToScreen);
-  layoutToScreen.ScalePost(metrics.mCumulativeResolution.scale,
-                           metrics.mCumulativeResolution.scale,
-                           1.f);
-
-  mPaintData.mTransformScreenToLayout = layoutToScreen.Inverse();
-
-  // Compute the critical display port in layer space.
-  mPaintData.mLayoutCriticalDisplayPort.SetEmpty();
-  if (!metrics.mCriticalDisplayPort.IsEmpty()) {
-    // Convert the display port to screen space first so that we can transform
-    // it into layout device space.
-    const ScreenRect& criticalDisplayPort = metrics.mCriticalDisplayPort * metrics.mZoom;
-    LayoutDeviceRect transformedCriticalDisplayPort =
-      ApplyScreenToLayoutTransform(mPaintData.mTransformScreenToLayout, criticalDisplayPort);
-    mPaintData.mLayoutCriticalDisplayPort =
-      LayoutDeviceIntRect::ToUntyped(RoundedOut(transformedCriticalDisplayPort));
-  }
-
-  // Calculate the frame resolution. Because this is Gecko-side, before any
-  // async transforms have occurred, we can use mZoom for this.
-  mPaintData.mResolution = metrics.mZoom;
-
-  // Calculate the scroll offset since the last transaction, and the
-  // composition bounds.
-  mPaintData.mCompositionBounds.SetEmpty();
-  mPaintData.mScrollOffset.MoveTo(0, 0);
-  Layer* primaryScrollable = ClientManager()->GetPrimaryScrollableLayer();
-  if (primaryScrollable) {
-    const FrameMetrics& metrics = primaryScrollable->AsContainerLayer()->GetFrameMetrics();
-    mPaintData.mScrollOffset = metrics.mScrollOffset * metrics.mZoom;
-    mPaintData.mCompositionBounds =
-      ApplyScreenToLayoutTransform(mPaintData.mTransformScreenToLayout,
-                                   ScreenRect(metrics.mCompositionBounds));
-  }
-}
-
-void
-SimpleClientTiledThebesLayer::EndPaint(bool aFinish)
-{
-  if (!aFinish && !mPaintData.mPaintFinished) {
-    return;
-  }
-
-  mPaintData.mLastScrollOffset = mPaintData.mScrollOffset;
-  mPaintData.mPaintFinished = true;
-  mPaintData.mFirstPaint = false;
-}
-
-void
-SimpleClientTiledThebesLayer::RenderLayer()
-{
-  LayerManager::DrawThebesLayerCallback callback =
-    ClientManager()->GetThebesLayerCallback();
-  void *data = ClientManager()->GetThebesLayerCallbackData();
-  if (!callback) {
-    ClientManager()->SetTransactionIncomplete();
-    return;
-  }
-
-  // First time? Create a content client.
-  if (!mContentClient) {
-    mContentClient = new SimpleTiledContentClient(this, ClientManager());
-
-    mContentClient->Connect();
-    ClientManager()->AsShadowForwarder()->Attach(mContentClient, this);
-    MOZ_ASSERT(mContentClient->GetForwarder());
-  }
-
-  // If the format changed, nothing is valid
-  if (mContentClient->mTiledBuffer.HasFormatChanged()) {
-    mValidRegion = nsIntRegion();
-  }
-
-  nsIntRegion invalidRegion = mVisibleRegion;
-  invalidRegion.Sub(invalidRegion, mValidRegion);
-  if (invalidRegion.IsEmpty()) {
-    EndPaint(true);
-    return;
-  }
-
-  const FrameMetrics& parentMetrics = GetParent()->GetFrameMetrics();
-
-  nsIntRegion wantToPaintRegion = mVisibleRegion;
-
-  // Only paint the mask layer on the first transaction.
-  if (GetMaskLayer() && !ClientManager()->IsRepeatTransaction()) {
-    ToClientLayer(GetMaskLayer())->RenderLayer();
-  }
-
-  // Fast path for no progressive updates, no low-precision updates and no
-  // critical display-port set, or no display-port set.
-  if (parentMetrics.mCriticalDisplayPort.IsEmpty() ||
-      parentMetrics.mDisplayPort.IsEmpty())
-  {
-    mValidRegion = wantToPaintRegion;
-
-    NS_ASSERTION(!ClientManager()->IsRepeatTransaction(), "Didn't paint our mask layer");
-
-    mContentClient->mTiledBuffer.PaintThebes(mValidRegion, invalidRegion,
-                                             callback, data);
-
-    ClientManager()->Hold(this);
-
-    mContentClient->UseTiledLayerBuffer();
-
-    return;
-  }
-
-  // Calculate everything we need to perform the paint.
-  BeginPaint();
-
-  if (mPaintData.mPaintFinished) {
-    return;
-  }
-
-  // Make sure that tiles that fall outside of the visible region are
-  // discarded on the first update.
-  if (!ClientManager()->IsRepeatTransaction()) {
-    mValidRegion.And(mValidRegion, wantToPaintRegion);
-    if (!mPaintData.mLayoutCriticalDisplayPort.IsEmpty()) {
-      // Make sure that tiles that fall outside of the critical displayport are
-      // discarded on the first update.
-      mValidRegion.And(mValidRegion, mPaintData.mLayoutCriticalDisplayPort);
-    }
-  }
-
-  nsIntRegion lowPrecisionInvalidRegion;
-  if (!mPaintData.mLayoutCriticalDisplayPort.IsEmpty()) {
-    // Clip the invalid region to the critical display-port
-    invalidRegion.And(invalidRegion, mPaintData.mLayoutCriticalDisplayPort);
-    if (invalidRegion.IsEmpty() && lowPrecisionInvalidRegion.IsEmpty()) {
-      EndPaint(true);
-      return;
-    }
-  }
-
-  if (!invalidRegion.IsEmpty()) {
-    mValidRegion = wantToPaintRegion;
-    if (!mPaintData.mLayoutCriticalDisplayPort.IsEmpty()) {
-      mValidRegion.And(mValidRegion, mPaintData.mLayoutCriticalDisplayPort);
-    }
-    mContentClient->mTiledBuffer.SetFrameResolution(mPaintData.mResolution);
-    mContentClient->mTiledBuffer.PaintThebes(mValidRegion, invalidRegion,
-                                             callback, data);
-
-    ClientManager()->Hold(this);
-    mContentClient->UseTiledLayerBuffer();
-
-    EndPaint(false);
-    return;
-  }
-
-  EndPaint(false);
-}
-
-
-}
-}
deleted file mode 100644
--- a/gfx/layers/client/SimpleTiledContentClient.h
+++ /dev/null
@@ -1,193 +0,0 @@
-/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*-
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#ifndef MOZILLA_GFX_SIMPLETILEDCONTENTCLIENT_H
-#define MOZILLA_GFX_SIMPLETILEDCONTENTCLIENT_H
-
-// We include this header here so that we don't need to
-// duplicate BasicTiledLayerPaintData
-#include "TiledContentClient.h"
-
-#include "SharedBuffer.h"
-
-namespace mozilla {
-namespace layers {
-
-class ClientTiledThebesLayer;
-
-class SimpleTiledLayerTile;
-class SimpleTiledLayerBuffer;
-class SimpleClientTiledThebesLayer;
-class SimpleTiledLayerBuffer;
-
-#define GFX_SIMP_TILEDLAYER_DEBUG_OVERLAY
-
-struct SimpleTiledLayerTile
-{
-  RefPtr<TextureClient> mTileBuffer;
-  RefPtr<ClientLayerManager> mManager;
-  nsRefPtr<SharedBuffer> mCachedBuffer;
-  TimeStamp mLastUpdate;
-
-  SimpleTiledLayerTile() { }
-
-  SimpleTiledLayerTile(ClientLayerManager *aManager, TextureClient *aBuffer)
-    : mTileBuffer(aBuffer)
-    , mManager(aManager)
-  { }
-
-  bool operator== (const SimpleTiledLayerTile& o) const
-  {
-    return mTileBuffer == o.mTileBuffer;
-  }
-
-  bool operator!= (const SimpleTiledLayerTile& o) const
-  {
-    return mTileBuffer != o.mTileBuffer;
-  }
-
-  void SetLayerManager(ClientLayerManager *aManager)
-  {
-    mManager = aManager;
-  }
-
-  bool IsPlaceholderTile()
-  {
-    return mTileBuffer == nullptr;
-  }
-
-  TileDescriptor GetTileDescriptor()
-  {
-    if (mTileBuffer)
-      return TexturedTileDescriptor(nullptr, mTileBuffer->GetIPDLActor(), 0);
-
-    NS_NOTREACHED("Unhandled SimpleTiledLayerTile type");
-    return PlaceholderTileDescriptor();
-  }
-
-  void Release()
-  {
-    mTileBuffer = nullptr;
-    mCachedBuffer = nullptr;
-  }
-};
-
-class SimpleTiledLayerBuffer
-  : public TiledLayerBuffer<SimpleTiledLayerBuffer, SimpleTiledLayerTile>
-{
-  friend class TiledLayerBuffer<SimpleTiledLayerBuffer, SimpleTiledLayerTile>;
-
-public:
-  SimpleTiledLayerBuffer(SimpleClientTiledThebesLayer* aThebesLayer,
-                         CompositableClient* aCompositableClient,
-                         ClientLayerManager* aManager)
-    : mThebesLayer(aThebesLayer)
-    , mCompositableClient(aCompositableClient)
-    , mManager(aManager)
-    , mLastPaintOpaque(false)
-  {}
-
-  SimpleTiledLayerBuffer()
-    : mLastPaintOpaque(false)
-  {}
-
-  void PaintThebes(const nsIntRegion& aNewValidRegion,
-                   const nsIntRegion& aPaintRegion,
-                   LayerManager::DrawThebesLayerCallback aCallback,
-                   void* aCallbackData);
-
-  SurfaceDescriptorTiles GetSurfaceDescriptorTiles();
-
-  void Release() {
-    for (size_t i = 0; i < mRetainedTiles.Length(); i++) {
-      mRetainedTiles[i].Release();
-    }
-  }
-
-  const CSSToScreenScale& GetFrameResolution() const { return mFrameResolution; }
-  void SetFrameResolution(const CSSToScreenScale& aResolution) { mFrameResolution = aResolution; }
-
-  bool HasFormatChanged() const;
-private:
-  SimpleClientTiledThebesLayer* mThebesLayer;
-  CompositableClient* mCompositableClient;
-  ClientLayerManager* mManager;
-  LayerManager::DrawThebesLayerCallback mCallback;
-  void* mCallbackData;
-  CSSToScreenScale mFrameResolution;
-  bool mLastPaintOpaque;
-
-  gfxContentType GetContentType() const;
-
-  SimpleTiledLayerTile ValidateTile(SimpleTiledLayerTile aTile,
-                                    const nsIntPoint& aTileOrigin,
-                                    const nsIntRegion& aDirtyRect);
-
-  SimpleTiledLayerTile GetPlaceholderTile() const { return SimpleTiledLayerTile(); }
-
-  void ReleaseTile(SimpleTiledLayerTile aTile) { aTile.Release(); }
-
-  void SwapTiles(SimpleTiledLayerTile& aTileA, SimpleTiledLayerTile& aTileB) { std::swap(aTileA, aTileB); }
-};
-
-class SimpleTiledContentClient : public CompositableClient
-{
-  friend class SimpleClientTiledThebesLayer;
-
-public:
-  SimpleTiledContentClient(SimpleClientTiledThebesLayer* aThebesLayer,
-                           ClientLayerManager* aManager);
-
-  ~SimpleTiledContentClient();
-
-  virtual TextureInfo GetTextureInfo() const MOZ_OVERRIDE
-  {
-    return TextureInfo(BUFFER_SIMPLE_TILED);
-  }
-
-  void UseTiledLayerBuffer();
-
-private:
-  SimpleTiledLayerBuffer mTiledBuffer;
-};
-
-class SimpleClientTiledThebesLayer : public ThebesLayer,
-                                     public ClientLayer
-{
-  typedef ThebesLayer Base;
-
-public:
-  SimpleClientTiledThebesLayer(ClientLayerManager* const aManager);
-  ~SimpleClientTiledThebesLayer();
-
-  // Thebes Layer
-  virtual Layer* AsLayer() { return this; }
-  virtual void InvalidateRegion(const nsIntRegion& aRegion) {
-    mInvalidRegion.Or(mInvalidRegion, aRegion);
-    mValidRegion.Sub(mValidRegion, aRegion);
-  }
-
-  // Shadow methods
-  virtual void FillSpecificAttributes(SpecificLayerAttributes& aAttrs);
-  virtual ShadowableLayer* AsShadowableLayer() { return this; }
-
-  virtual void Disconnect() { ClientLayer::Disconnect(); }
-
-  virtual void RenderLayer();
-
-protected:
-  ClientLayerManager* ClientManager() { return static_cast<ClientLayerManager*>(mManager); }
-
-  void BeginPaint();
-  void EndPaint(bool aFinish);
-
-  RefPtr<SimpleTiledContentClient> mContentClient;
-  BasicTiledLayerPaintData mPaintData;
-};
-
-} // mozilla
-} // layers
-
-#endif
--- a/gfx/layers/client/TextureClient.cpp
+++ b/gfx/layers/client/TextureClient.cpp
@@ -47,22 +47,16 @@
 #ifdef MOZ_ANDROID_OMTC
 #  include "gfxReusableImageSurfaceWrapper.h"
 #  include "gfxImageSurface.h"
 #else
 #  include "gfxReusableSharedImageSurfaceWrapper.h"
 #  include "gfxSharedImageSurface.h"
 #endif
 
-#if 0
-#define RECYCLE_LOG(...) printf_stderr(__VA_ARGS__)
-#else
-#define RECYCLE_LOG(...) do { } while (0)
-#endif
-
 using namespace mozilla::gl;
 using namespace mozilla::gfx;
 
 namespace mozilla {
 namespace layers {
 
 /**
  * TextureChild is the content-side incarnation of the PTexture IPDL actor.
@@ -91,30 +85,16 @@ public:
 
   ~TextureChild()
   {
     MOZ_COUNT_DTOR(TextureChild);
   }
 
   bool Recv__delete__() MOZ_OVERRIDE;
 
-  bool RecvCompositorRecycle()
-  {
-    RECYCLE_LOG("Receive recycle %p (%p)\n", mTextureClient, mWaitForRecycle.get());
-    mWaitForRecycle = nullptr;
-    return true;
-  }
-
-  void WaitForCompositorRecycle()
-  {
-    mWaitForRecycle = mTextureClient;
-    RECYCLE_LOG("Wait for recycle %p\n", mWaitForRecycle.get());
-    SendClientRecycle();
-  }
-
   /**
    * Only used during the deallocation phase iff we need synchronization between
    * the client and host side for deallocation (that is, when the data is going
    * to be deallocated or recycled on the client side).
    */
   void SetTextureData(TextureClientData* aData)
   {
     mTextureData = aData;
@@ -143,28 +123,26 @@ private:
   }
   void ReleaseIPDLReference() {
     MOZ_ASSERT(mIPCOpen == true);
     mIPCOpen = false;
     Release();
   }
 
   RefPtr<CompositableForwarder> mForwarder;
-  RefPtr<TextureClient> mWaitForRecycle;
   TextureClientData* mTextureData;
   TextureClient* mTextureClient;
   bool mIPCOpen;
 
   friend class TextureClient;
 };
 
 void
 TextureChild::DeleteTextureData()
 {
-  mWaitForRecycle = nullptr;
   if (mTextureData) {
     mTextureData->DeallocateSharedData(GetAllocator());
     delete mTextureData;
     mTextureData = nullptr;
   }
 }
 
 bool
@@ -175,17 +153,16 @@ TextureChild::Recv__delete__()
 }
 
 void
 TextureChild::ActorDestroy(ActorDestroyReason why)
 {
   if (mTextureClient) {
     mTextureClient->mActor = nullptr;
   }
-  mWaitForRecycle = nullptr;
 }
 
 // static
 PTextureChild*
 TextureClient::CreateIPDLActor()
 {
   TextureChild* c = new TextureChild();
   c->AddIPDLReference();
@@ -199,23 +176,17 @@ TextureClient::DestroyIPDLActor(PTexture
   static_cast<TextureChild*>(actor)->ReleaseIPDLReference();
   return true;
 }
 
 // static
 TextureClient*
 TextureClient::AsTextureClient(PTextureChild* actor)
 {
-  return actor ? static_cast<TextureChild*>(actor)->mTextureClient : nullptr;
-}
-
-void
-TextureClient::WaitForCompositorRecycle()
-{
-  mActor->WaitForCompositorRecycle();
+  return actor? static_cast<TextureChild*>(actor)->mTextureClient : nullptr;
 }
 
 bool
 TextureClient::InitIPDLActor(CompositableForwarder* aForwarder)
 {
   MOZ_ASSERT(aForwarder);
   if (mActor && mActor->GetForwarder() == aForwarder) {
     return true;
--- a/gfx/layers/client/TextureClient.h
+++ b/gfx/layers/client/TextureClient.h
@@ -274,25 +274,16 @@ public:
    * TextureFlags contain important information about various aspects
    * of the texture, like how its liferime is managed, and how it
    * should be displayed.
    * See TextureFlags in CompositorTypes.h.
    */
   TextureFlags GetFlags() const { return mFlags; }
 
   /**
-   * valid only for TEXTURE_RECYCLE TextureClient.
-   * When called this texture client will grab a strong reference and release
-   * it once the compositor notifies that it is done with the texture.
-   * NOTE: In this stage the texture client can no longer be used by the
-   * client in a transaction.
-   */
-  void WaitForCompositorRecycle();
-
-  /**
    * After being shared with the compositor side, an immutable texture is never
    * modified, it can only be read. It is safe to not Lock/Unlock immutable
    * textures.
    */
   bool IsImmutable() const { return mFlags & TEXTURE_IMMUTABLE; }
 
   void MarkImmutable() { AddFlags(TEXTURE_IMMUTABLE); }
 
--- a/gfx/layers/composite/CompositableHost.cpp
+++ b/gfx/layers/composite/CompositableHost.cpp
@@ -155,17 +155,16 @@ CompositableHost::Create(const TextureIn
     break;
   case BUFFER_CONTENT_DIRECT:
     result = new DeprecatedContentHostDoubleBuffered(aTextureInfo);
     break;
   case BUFFER_CONTENT_INC:
     result = new ContentHostIncremental(aTextureInfo);
     break;
   case BUFFER_TILED:
-  case BUFFER_SIMPLE_TILED:
     result = new TiledContentHost(aTextureInfo);
     break;
   case COMPOSITABLE_IMAGE:
     result = new ImageHost(aTextureInfo);
     break;
   case COMPOSITABLE_CONTENT_SINGLE:
     result = new ContentHostSingleBuffered(aTextureInfo);
     break;
--- a/gfx/layers/composite/TextureHost.cpp
+++ b/gfx/layers/composite/TextureHost.cpp
@@ -17,25 +17,18 @@
 #ifdef MOZ_X11
 #include "mozilla/layers/X11TextureHost.h"
 #endif
 #include "mozilla/layers/YCbCrImageDataSerializer.h"
 #include "nsAString.h"
 #include "nsAutoPtr.h"                  // for nsRefPtr
 #include "nsPrintfCString.h"            // for nsPrintfCString
 #include "mozilla/layers/PTextureParent.h"
-#include "mozilla/unused.h"
 #include <limits>
 
-#if 0
-#define RECYCLE_LOG(...) printf_stderr(__VA_ARGS__)
-#else
-#define RECYCLE_LOG(...) do { } while (0)
-#endif
-
 struct nsIntPoint;
 
 namespace mozilla {
 namespace layers {
 
 /**
  * TextureParent is the host-side IPDL glue between TextureClient and TextureHost.
  * It is an IPDL actor just like LayerParent, CompositableParent, etc.
@@ -45,29 +38,25 @@ class TextureParent : public PTexturePar
 public:
   TextureParent(ISurfaceAllocator* aAllocator);
 
   ~TextureParent();
 
   bool Init(const SurfaceDescriptor& aSharedData,
             const TextureFlags& aFlags);
 
-  void CompositorRecycle();
-  virtual bool RecvClientRecycle() MOZ_OVERRIDE;
-
   virtual bool RecvRemoveTexture() MOZ_OVERRIDE;
 
   virtual bool RecvRemoveTextureSync() MOZ_OVERRIDE;
 
   TextureHost* GetTextureHost() { return mTextureHost; }
 
   void ActorDestroy(ActorDestroyReason why) MOZ_OVERRIDE;
 
   ISurfaceAllocator* mAllocator;
-  RefPtr<TextureHost> mWaitForClientRecycle;
   RefPtr<TextureHost> mTextureHost;
 };
 
 // static
 PTextureParent*
 TextureHost::CreateIPDLActor(ISurfaceAllocator* aAllocator,
                              const SurfaceDescriptor& aSharedData,
                              TextureFlags aFlags)
@@ -734,64 +723,27 @@ TextureParent::TextureParent(ISurfaceAll
 : mAllocator(aAllocator)
 {
   MOZ_COUNT_CTOR(TextureParent);
 }
 
 TextureParent::~TextureParent()
 {
   MOZ_COUNT_DTOR(TextureParent);
-  if (mTextureHost) {
-    mTextureHost->ClearRecycleCallback();
-  }
-}
-
-static void RecycleCallback(TextureHost* textureHost, void* aClosure) {
-  TextureParent* tp = reinterpret_cast<TextureParent*>(aClosure);
-  tp->CompositorRecycle();
-}
-
-void
-TextureParent::CompositorRecycle()
-{
-  mTextureHost->ClearRecycleCallback();
-  mozilla::unused << SendCompositorRecycle();
-
-  // Don't forget to prepare for the next reycle
-  mWaitForClientRecycle = mTextureHost;
-}
-
-bool
-TextureParent::RecvClientRecycle()
-{
-  // This will allow the RecycleCallback to be called once the compositor
-  // releases any external references to TextureHost.
-  mTextureHost->SetRecycleCallback(RecycleCallback, this);
-  if (!mWaitForClientRecycle) {
-    RECYCLE_LOG("Not a recycable tile");
-  }
-  mWaitForClientRecycle = nullptr;
-  return true;
+  mTextureHost = nullptr;
 }
 
 bool
 TextureParent::Init(const SurfaceDescriptor& aSharedData,
                     const TextureFlags& aFlags)
 {
   mTextureHost = TextureHost::Create(aSharedData,
                                      mAllocator,
                                      aFlags);
-  if (mTextureHost) {
-    mTextureHost->mActor = this;
-    if (aFlags & TEXTURE_RECYCLE) {
-      mWaitForClientRecycle = mTextureHost;
-      RECYCLE_LOG("Setup recycling for tile %p\n", this);
-    }
-  }
-
+  mTextureHost->mActor = this;
   return !!mTextureHost;
 }
 
 bool
 TextureParent::RecvRemoveTexture()
 {
   return PTextureParent::Send__delete__(this);
 }
@@ -816,20 +768,16 @@ TextureParent::ActorDestroy(ActorDestroy
   case Deletion:
   case NormalShutdown:
   case AbnormalShutdown:
     break;
   case FailedConstructor:
     NS_RUNTIMEABORT("FailedConstructor isn't possible in PTexture");
   }
 
-  if (mTextureHost->GetFlags() & TEXTURE_RECYCLE) {
-    RECYCLE_LOG("clear recycling for tile %p\n", this);
-    mTextureHost->ClearRecycleCallback();
-  }
   if (mTextureHost->GetFlags() & TEXTURE_DEALLOCATE_CLIENT) {
     mTextureHost->ForgetSharedData();
   }
 
   mTextureHost->mActor = nullptr;
   mTextureHost = nullptr;
 }
 
--- a/gfx/layers/composite/TextureHost.h
+++ b/gfx/layers/composite/TextureHost.h
@@ -270,16 +270,17 @@ class TextureHost
    * Called once, just before the destructor.
    *
    * Here goes the shut-down code that uses virtual methods.
    * Must only be called by Release().
    */
   void Finalize();
 
   friend class AtomicRefCountedWithFinalize<TextureHost>;
+
 public:
   TextureHost(TextureFlags aFlags);
 
   virtual ~TextureHost();
 
   /**
    * Factory method.
    */
--- a/gfx/layers/composite/TiledContentHost.cpp
+++ b/gfx/layers/composite/TiledContentHost.cpp
@@ -29,17 +29,16 @@ TiledLayerBufferComposite::TiledLayerBuf
   : mFrameResolution(1.0)
   , mHasDoubleBufferedTiles(false)
   , mUninitialized(true)
 {}
 
 TiledLayerBufferComposite::TiledLayerBufferComposite(ISurfaceAllocator* aAllocator,
                                                      const SurfaceDescriptorTiles& aDescriptor,
                                                      const nsIntRegion& aOldPaintedRegion)
-  : mFrameResolution(1.0)
 {
   mUninitialized = false;
   mHasDoubleBufferedTiles = false;
   mValidRegion = aDescriptor.validRegion();
   mPaintedRegion = aDescriptor.paintedRegion();
   mRetainedWidth = aDescriptor.retainedWidth();
   mRetainedHeight = aDescriptor.retainedHeight();
   mResolution = aDescriptor.resolution();
@@ -57,23 +56,23 @@ TiledLayerBufferComposite::TiledLayerBuf
       case TileDescriptor::TTexturedTileDescriptor : {
         texture = TextureHost::AsTextureHost(tileDesc.get_TexturedTileDescriptor().textureParent());
         const TileLock& ipcLock = tileDesc.get_TexturedTileDescriptor().sharedLock();
         nsRefPtr<gfxSharedReadLock> sharedLock;
         if (ipcLock.type() == TileLock::TShmem) {
           sharedLock = gfxShmSharedReadLock::Open(aAllocator, ipcLock.get_Shmem());
         } else {
           sharedLock = reinterpret_cast<gfxMemorySharedReadLock*>(ipcLock.get_uintptr_t());
-          if (sharedLock) {
-            // The corresponding AddRef is in TiledClient::GetTileDescriptor
-            sharedLock->Release();
-          }
+          // The corresponding AddRef is in TiledClient::GetTileDescriptor
+          sharedLock->Release();
         }
-
-        mRetainedTiles.AppendElement(TileHost(sharedLock, texture));
+        MOZ_ASSERT(sharedLock);
+        if (sharedLock) {
+          mRetainedTiles.AppendElement(TileHost(sharedLock, texture));
+        }
         break;
       }
       default:
         NS_WARNING("Unrecognised tile descriptor type");
         // Fall through
       case TileDescriptor::TPlaceholderTileDescriptor :
         mRetainedTiles.AppendElement(GetPlaceholderTile());
         break;
--- a/gfx/layers/composite/TiledContentHost.h
+++ b/gfx/layers/composite/TiledContentHost.h
@@ -83,16 +83,19 @@ public:
   }
   bool operator!= (const TileHost& o) const {
     return mTextureHost != o.mTextureHost;
   }
 
   bool IsPlaceholderTile() const { return mTextureHost == nullptr; }
 
   void ReadUnlock() {
+    // Warn if we have a texture host, but no corresponding lock.
+    NS_WARN_IF_FALSE(mTextureHost == nullptr || mSharedLock != nullptr,
+                     "ReadUnlock with no gfxSharedReadLock");
     if (mSharedLock) {
       mSharedLock->ReadUnlock();
     }
   }
 
   RefPtr<gfxSharedReadLock> mSharedLock;
   RefPtr<TextureHost> mTextureHost;
 };
@@ -255,16 +258,16 @@ private:
                          gfx::Matrix4x4 aTransform);
 
   void EnsureTileStore() {}
 
   TiledLayerBufferComposite    mTiledBuffer;
   TiledLayerBufferComposite    mLowPrecisionTiledBuffer;
   TiledLayerBufferComposite    mOldTiledBuffer;
   TiledLayerBufferComposite    mOldLowPrecisionTiledBuffer;
-  bool                         mPendingUpload;
-  bool                         mPendingLowPrecisionUpload;
+  bool                         mPendingUpload : 1;
+  bool                         mPendingLowPrecisionUpload : 1;
 };
 
 }
 }
 
 #endif
--- a/gfx/layers/ipc/PTexture.ipdl
+++ b/gfx/layers/ipc/PTexture.ipdl
@@ -20,22 +20,18 @@ namespace layers {
  * PTexture is the IPDL glue between a TextureClient and a TextureHost.
  */
 sync protocol PTexture {
     manager PImageBridge or PLayerTransaction;
 
 child:
     async __delete__();
 
-    async CompositorRecycle();
-
 parent:
 
-    async ClientRecycle();
-
     /**
      * Asynchronously tell the Compositor side to remove the texture.
      */
     async RemoveTexture();
 
     /**
      * Synchronously tell the compositor side to remove the texture.
      */
--- a/gfx/layers/moz.build
+++ b/gfx/layers/moz.build
@@ -100,18 +100,16 @@ EXPORTS.mozilla.layers += [
     'AtomicRefCountedWithFinalize.h',
     'basic/BasicCompositor.h',
     'basic/MacIOSurfaceTextureHostBasic.h',
     'basic/TextureHostBasic.h',
     'client/CanvasClient.h',
     'client/CompositableClient.h',
     'client/ContentClient.h',
     'client/ImageClient.h',
-    'client/SimpleTextureClientPool.h',
-    'client/SimpleTiledContentClient.h',
     'client/TextureClient.h',
     'client/TextureClientPool.h',
     'client/TiledContentClient.h',
     'composite/APZCTreeManager.h',
     'composite/AsyncCompositionManager.h',
     'composite/CanvasLayerComposite.h',
     'composite/ColorLayerComposite.h',
     'composite/ContainerLayerComposite.h',
@@ -231,18 +229,16 @@ UNIFIED_SOURCES += [
     'client/ClientContainerLayer.cpp',
     'client/ClientImageLayer.cpp',
     'client/ClientLayerManager.cpp',
     'client/ClientThebesLayer.cpp',
     'client/ClientTiledThebesLayer.cpp',
     'client/CompositableClient.cpp',
     'client/ContentClient.cpp',
     'client/ImageClient.cpp',
-    'client/SimpleTextureClientPool.cpp',
-    'client/SimpleTiledContentClient.cpp',
     'client/TextureClient.cpp',
     'client/TextureClientPool.cpp',
     'client/TiledContentClient.cpp',
     'composite/APZCTreeManager.cpp',
     'composite/AsyncCompositionManager.cpp',
     'composite/CanvasLayerComposite.cpp',
     'composite/ColorLayerComposite.cpp',
     'composite/CompositableHost.cpp',
--- a/gfx/thebes/gfxPrefs.h
+++ b/gfx/thebes/gfxPrefs.h
@@ -151,17 +151,16 @@ private:
   // preference value, defaulting to true.
   DECL_GFX_PREF(Once, "layers.componentalpha.enabled",         ComponentAlphaEnabled, bool, true);
 #endif
   DECL_GFX_PREF(Live, "layers.draw-bigimage-borders",          DrawBigImageBorders, bool, false);
   DECL_GFX_PREF(Live, "layers.draw-borders",                   DrawLayerBorders, bool, false);
   DECL_GFX_PREF(Live, "layers.draw-tile-borders",              DrawTileBorders, bool, false);
   DECL_GFX_PREF(Once, "layers.dump",                           LayersDump, bool, false);
   DECL_GFX_PREF(Once, "layers.enable-tiles",                   LayersTilesEnabled, bool, false);
-  DECL_GFX_PREF(Once, "layers.simple-tiles",                   LayersUseSimpleTiles, bool, false);
   DECL_GFX_PREF(Once, "layers.force-per-tile-drawing",         PerTileDrawing, bool, false);
   DECL_GFX_PREF(Once, "layers.overzealous-gralloc-unlocking",  OverzealousGrallocUnlocking, bool, false);
   DECL_GFX_PREF(Once, "layers.force-shmem-tiles",              ForceShmemTiles, bool, false);
   DECL_GFX_PREF(Live, "layers.frame-counter",                  DrawFrameCounter, bool, false);
   DECL_GFX_PREF(Live, "layers.low-precision-buffer",           UseLowPrecisionBuffer, bool, false);
   DECL_GFX_PREF(Live, "layers.low-precision-resolution",       LowPrecisionResolution, int32_t, 250);
   DECL_GFX_PREF(Once, "layers.offmainthreadcomposition.enabled", LayersOffMainThreadCompositionEnabled, bool, false);
   DECL_GFX_PREF(Live, "layers.offmainthreadcomposition.frame-rate", LayersCompositionFrameRate, int32_t,-1);