Backed out changeset 79d65a1bbb01 (bug 1039883) for assertion failures on a CLOSED TREE
authorCarsten "Tomcat" Book <cbook@mozilla.com>
Fri, 18 Jul 2014 16:09:15 +0200
changeset 216811 18138d562325084d5eda18da7d27de8e933f4950
parent 216810 79d65a1bbb01d1a72d26b8aa68415a1408314bfc
child 216812 ecdb409898a63ce33b71eb92446ffcec8c42f0bc
push id515
push userraliiev@mozilla.com
push dateMon, 06 Oct 2014 12:51:51 +0000
treeherdermozilla-release@267c7a481bef [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1039883
milestone33.0a1
backs out79d65a1bbb01d1a72d26b8aa68415a1408314bfc
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
Backed out changeset 79d65a1bbb01 (bug 1039883) for assertion failures on a CLOSED TREE
gfx/layers/client/ClientTiledThebesLayer.cpp
gfx/layers/client/TiledContentClient.cpp
gfx/layers/client/TiledContentClient.h
gfx/layers/composite/CompositableHost.h
gfx/layers/composite/TiledContentHost.cpp
gfx/layers/composite/TiledContentHost.h
gfx/layers/ipc/ISurfaceAllocator.cpp
gfx/layers/ipc/ISurfaceAllocator.h
gfx/layers/ipc/SharedBufferManagerChild.cpp
gfx/layers/ipc/SharedBufferManagerChild.h
gfx/layers/opengl/GrallocTextureClient.cpp
--- a/gfx/layers/client/ClientTiledThebesLayer.cpp
+++ b/gfx/layers/client/ClientTiledThebesLayer.cpp
@@ -42,17 +42,16 @@ ClientTiledThebesLayer::~ClientTiledTheb
 }
 
 void
 ClientTiledThebesLayer::ClearCachedResources()
 {
   if (mContentClient) {
     mContentClient->ClearCachedResources();
   }
-  mValidRegion.SetEmpty();
 }
 
 void
 ClientTiledThebesLayer::FillSpecificAttributes(SpecificLayerAttributes& aAttrs)
 {
   aAttrs = ThebesLayerAttributes(GetValidRegion());
 }
 
--- a/gfx/layers/client/TiledContentClient.cpp
+++ b/gfx/layers/client/TiledContentClient.cpp
@@ -96,18 +96,18 @@ TiledContentClient::TiledContentClient(C
                                                     &mSharedFrameMetricsHelper);
 
   mLowPrecisionTiledBuffer.SetResolution(gfxPrefs::LowPrecisionResolution());
 }
 
 void
 TiledContentClient::ClearCachedResources()
 {
-  mTiledBuffer.DiscardBuffers();
-  mLowPrecisionTiledBuffer.DiscardBuffers();
+  mTiledBuffer.DiscardBackBuffers();
+  mLowPrecisionTiledBuffer.DiscardBackBuffers();
 }
 
 void
 TiledContentClient::UseTiledLayerBuffer(TiledBufferType aType)
 {
   ClientTiledLayerBuffer* buffer = aType == LOW_PRECISION_TILED_BUFFER
     ? &mLowPrecisionTiledBuffer
     : &mTiledBuffer;
@@ -673,21 +673,20 @@ ClientTiledLayerBuffer::Release()
 {
   for (size_t i = 0; i < mRetainedTiles.Length(); i++) {
     if (mRetainedTiles[i].IsPlaceholderTile()) continue;
     mRetainedTiles[i].Release();
   }
 }
 
 void
-ClientTiledLayerBuffer::DiscardBuffers()
+ClientTiledLayerBuffer::DiscardBackBuffers()
 {
   for (size_t i = 0; i < mRetainedTiles.Length(); i++) {
     if (mRetainedTiles[i].IsPlaceholderTile()) continue;
-    mRetainedTiles[i].DiscardFrontBuffer();
     mRetainedTiles[i].DiscardBackBuffer();
   }
 }
 
 SurfaceDescriptorTiles
 ClientTiledLayerBuffer::GetSurfaceDescriptorTiles()
 {
   InfallibleTArray<TileDescriptor> tiles;
--- a/gfx/layers/client/TiledContentClient.h
+++ b/gfx/layers/client/TiledContentClient.h
@@ -375,17 +375,17 @@ public:
                    void* aCallbackData);
 
   void ReadUnlock();
 
   void ReadLock();
 
   void Release();
 
-  void DiscardBuffers();
+  void DiscardBackBuffers();
 
   const CSSToParentLayerScale& GetFrameResolution() { return mFrameResolution; }
 
   void SetFrameResolution(const CSSToParentLayerScale& aResolution) { mFrameResolution = aResolution; }
 
   bool HasFormatChanged() const;
 
   /**
--- a/gfx/layers/composite/CompositableHost.h
+++ b/gfx/layers/composite/CompositableHost.h
@@ -230,17 +230,17 @@ public:
   // Detach this compositable host from its layer.
   // If we are used for async video, then it is not safe to blindly detach since
   // we might be re-attached to a different layer. aLayer is the layer which the
   // caller expects us to be attached to, we will only detach if we are in fact
   // attached to that layer. If we are part of a normal layer, then we will be
   // detached in any case. if aLayer is null, then we will only detach if we are
   // not async.
   // Only force detach if the IPDL tree is being shutdown.
-  virtual void Detach(Layer* aLayer = nullptr, AttachFlags aFlags = NO_FLAGS)
+  void Detach(Layer* aLayer = nullptr, AttachFlags aFlags = NO_FLAGS)
   {
     if (!mKeepAttached ||
         aLayer == mLayer ||
         aFlags & FORCE_DETACH) {
       SetLayer(nullptr);
       mAttached = false;
       mKeepAttached = false;
       if (mBackendData) {
--- a/gfx/layers/composite/TiledContentHost.cpp
+++ b/gfx/layers/composite/TiledContentHost.cpp
@@ -228,29 +228,16 @@ TiledContentHost::Attach(Layer* aLayer,
                          Compositor* aCompositor,
                          AttachFlags aFlags /* = NO_FLAGS */)
 {
   CompositableHost::Attach(aLayer, aCompositor, aFlags);
   static_cast<ThebesLayerComposite*>(aLayer)->EnsureTiled();
 }
 
 void
-TiledContentHost::Detach(Layer* aLayer,
-                         AttachFlags aFlags /* = NO_FLAGS */)
-{
-  if (!mKeepAttached || aLayer == mLayer || aFlags & FORCE_DETACH) {
-    mTiledBuffer = TiledLayerBufferComposite();
-    mLowPrecisionTiledBuffer = TiledLayerBufferComposite();
-    mOldTiledBuffer = TiledLayerBufferComposite();
-    mOldLowPrecisionTiledBuffer = TiledLayerBufferComposite();
-  }
-  CompositableHost::Detach(aLayer,aFlags);
-}
-
-void
 TiledContentHost::UseTiledLayerBuffer(ISurfaceAllocator* aAllocator,
                                       const SurfaceDescriptorTiles& aTiledDescriptor)
 {
   if (aTiledDescriptor.resolution() < 1) {
     if (mPendingLowPrecisionUpload) {
       mLowPrecisionTiledBuffer.ReadUnlock();
     } else {
       mPendingLowPrecisionUpload = true;
--- a/gfx/layers/composite/TiledContentHost.h
+++ b/gfx/layers/composite/TiledContentHost.h
@@ -224,19 +224,16 @@ public:
   virtual CompositableType GetType() { return CompositableType::BUFFER_TILED; }
 
   virtual TiledLayerComposer* AsTiledLayerComposer() MOZ_OVERRIDE { return this; }
 
   virtual void Attach(Layer* aLayer,
                       Compositor* aCompositor,
                       AttachFlags aFlags = NO_FLAGS) MOZ_OVERRIDE;
 
-  virtual void Detach(Layer* aLayer = nullptr,
-                      AttachFlags aFlags = NO_FLAGS) MOZ_OVERRIDE;
-
 #ifdef MOZ_DUMP_PAINTING
   virtual void Dump(std::stringstream& aStream,
                     const char* aPrefix="",
                     bool aDumpHtml=false) MOZ_OVERRIDE;
 #endif
 
   virtual void PrintInfo(std::stringstream& aStream, const char* aPrefix);
 
--- a/gfx/layers/ipc/ISurfaceAllocator.cpp
+++ b/gfx/layers/ipc/ISurfaceAllocator.cpp
@@ -322,16 +322,10 @@ ISurfaceAllocator::AllocGrallocBuffer(co
 }
 
 void
 ISurfaceAllocator::DeallocGrallocBuffer(MaybeMagicGrallocBufferHandle* aHandle)
 {
   SharedBufferManagerChild::GetSingleton()->DeallocGrallocBuffer(*aHandle);
 }
 
-void
-ISurfaceAllocator::DropGrallocBuffer(MaybeMagicGrallocBufferHandle* aHandle)
-{
-  SharedBufferManagerChild::GetSingleton()->DropGrallocBuffer(*aHandle);
-}
-
 } // namespace layers
 } // namespace mozilla
--- a/gfx/layers/ipc/ISurfaceAllocator.h
+++ b/gfx/layers/ipc/ISurfaceAllocator.h
@@ -157,18 +157,16 @@ public:
   // method that does the actual allocation work
   bool AllocGrallocBuffer(const gfx::IntSize& aSize,
                           uint32_t aFormat,
                           uint32_t aUsage,
                           MaybeMagicGrallocBufferHandle* aHandle);
 
   void DeallocGrallocBuffer(MaybeMagicGrallocBufferHandle* aHandle);
 
-  void DropGrallocBuffer(MaybeMagicGrallocBufferHandle* aHandle);
-
   virtual bool IPCOpen() const { return true; }
   virtual bool IsSameProcess() const = 0;
 
   virtual bool IsImageBridgeChild() const { return false; }
 
   virtual MessageLoop * GetMessageLoop() const
   {
     return mDefaultMessageLoop;
--- a/gfx/layers/ipc/SharedBufferManagerChild.cpp
+++ b/gfx/layers/ipc/SharedBufferManagerChild.cpp
@@ -312,39 +312,28 @@ SharedBufferManagerChild::DeallocGralloc
     mBuffers.erase(aBuffer.get_GrallocBufferRef().mKey);
   }
   SendDropGrallocBuffer(aBuffer);
 #else
   NS_RUNTIMEABORT("No GrallocBuffer for you");
 #endif
 }
 
-void
-SharedBufferManagerChild::DropGrallocBuffer(const mozilla::layers::MaybeMagicGrallocBufferHandle& aHandle)
+bool SharedBufferManagerChild::RecvDropGrallocBuffer(const mozilla::layers::MaybeMagicGrallocBufferHandle& handle)
 {
 #ifdef MOZ_HAVE_SURFACEDESCRIPTORGRALLOC
-  int64_t bufferKey = -1;
-  if (aHandle.type() == mozilla::layers::MaybeMagicGrallocBufferHandle::TMagicGrallocBufferHandle) {
-    bufferKey = aHandle.get_MagicGrallocBufferHandle().mRef.mKey;
-  } else if (aHandle.type() == mozilla::layers::MaybeMagicGrallocBufferHandle::TGrallocBufferRef) {
-    bufferKey = aHandle.get_GrallocBufferRef().mKey;
-  } else {
-    return;
-  }
+  NS_ASSERTION(handle.type() == mozilla::layers::MaybeMagicGrallocBufferHandle::TGrallocBufferRef, "shouldn't go this way");
+  int64_t bufferKey = handle.get_GrallocBufferRef().mKey;
 
   {
     MutexAutoLock lock(mBufferMutex);
+    NS_ASSERTION(mBuffers.count(bufferKey) != 0, "No such buffer");
     mBuffers.erase(bufferKey);
   }
 #endif
-}
-
-bool SharedBufferManagerChild::RecvDropGrallocBuffer(const mozilla::layers::MaybeMagicGrallocBufferHandle& aHandle)
-{
-  DropGrallocBuffer(aHandle);
   return true;
 }
 
 #ifdef MOZ_HAVE_SURFACEDESCRIPTORGRALLOC
 android::sp<android::GraphicBuffer>
 SharedBufferManagerChild::GetGraphicBuffer(int64_t key)
 {
   MutexAutoLock lock(mBufferMutex);
--- a/gfx/layers/ipc/SharedBufferManagerChild.h
+++ b/gfx/layers/ipc/SharedBufferManagerChild.h
@@ -99,20 +99,17 @@ public:
   /**
    * Deallocate a remotely allocated gralloc buffer.
    * As gralloc buffer life cycle controlled by sp, this just break the sharing status of the underlying buffer
    * and decrease the reference count on both side.
    */
   void
   DeallocGrallocBuffer(const mozilla::layers::MaybeMagicGrallocBufferHandle& aBuffer);
 
-  void
-  DropGrallocBuffer(const mozilla::layers::MaybeMagicGrallocBufferHandle& aHandle);
-
-  virtual bool RecvDropGrallocBuffer(const mozilla::layers::MaybeMagicGrallocBufferHandle& aHandle);
+  virtual bool RecvDropGrallocBuffer(const mozilla::layers::MaybeMagicGrallocBufferHandle& handle);
 
 #ifdef MOZ_HAVE_SURFACEDESCRIPTORGRALLOC
   android::sp<android::GraphicBuffer> GetGraphicBuffer(int64_t key);
 #endif
 
   bool IsValidKey(int64_t key);
 
   base::Thread* GetThread() const;
--- a/gfx/layers/opengl/GrallocTextureClient.cpp
+++ b/gfx/layers/opengl/GrallocTextureClient.cpp
@@ -42,21 +42,19 @@ GrallocTextureClientOGL::GrallocTextureC
 , mMediaBuffer(nullptr)
 {
   MOZ_COUNT_CTOR(GrallocTextureClientOGL);
 }
 
 GrallocTextureClientOGL::~GrallocTextureClientOGL()
 {
   MOZ_COUNT_DTOR(GrallocTextureClientOGL);
-  ISurfaceAllocator* allocator = GetAllocator();
-  if (ShouldDeallocateInDestructor()) {
+    if (ShouldDeallocateInDestructor()) {
+    ISurfaceAllocator* allocator = GetAllocator();
     allocator->DeallocGrallocBuffer(&mGrallocHandle);
-  } else {
-    allocator->DropGrallocBuffer(&mGrallocHandle);
   }
 }
 
 void
 GrallocTextureClientOGL::InitWith(MaybeMagicGrallocBufferHandle aHandle, gfx::IntSize aSize)
 {
   MOZ_ASSERT(!IsAllocated());
   MOZ_ASSERT(IsValid());