Backed out changeset d5607eeaa106 (bug 1036654) for Windows build bustage on a CLOSED TREE
authorWes Kocher <wkocher@mozilla.com>
Wed, 16 Jul 2014 13:16:40 -0700
changeset 205387 4829189e79992e30acad478cab3025c8455d853e
parent 205385 44dd7343b2c11ec5635c344041daba77b60a3566
child 205390 fea261bd38e8f3e9f06bec50c96349fdcd28a6cb
push idunknown
push userunknown
push dateunknown
bugs1036654
milestone33.0a1
backs outd5607eeaa106932f3d9b0e6c8af0c44b23ef9c60
Backed out changeset d5607eeaa106 (bug 1036654) for Windows build bustage on a CLOSED TREE
gfx/gl/GfxTexturesReporter.cpp
gfx/gl/GfxTexturesReporter.h
gfx/layers/client/TextureClient.h
gfx/layers/client/TiledContentClient.cpp
--- a/gfx/gl/GfxTexturesReporter.cpp
+++ b/gfx/gl/GfxTexturesReporter.cpp
@@ -7,18 +7,17 @@
 #include "GfxTexturesReporter.h"
 #include "GLDefs.h"
 
 using namespace mozilla;
 using namespace mozilla::gl;
 
 NS_IMPL_ISUPPORTS(GfxTexturesReporter, nsIMemoryReporter)
 
-Atomic<size_t> GfxTexturesReporter::sAmount(0);
-Atomic<size_t> GfxTexturesReporter::sTileWasteAmount(0);
+int64_t GfxTexturesReporter::sAmount = 0;
 
 static uint32_t
 GetBitsPerTexel(GLenum format, GLenum type)
 {
     // If there is no defined format or type, we're not taking up any memory
     if (!format || !type) {
         return 0;
     }
--- a/gfx/gl/GfxTexturesReporter.h
+++ b/gfx/gl/GfxTexturesReporter.h
@@ -2,17 +2,16 @@
 /* vim: set ts=8 sts=4 et sw=4 tw=80: */
 /* 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 GFXTEXTURESREPORTER_H_
 #define GFXTEXTURESREPORTER_H_
 
-#include "mozilla/Atomics.h"
 #include "nsIMemoryReporter.h"
 #include "GLTypes.h"
 
 namespace mozilla {
 namespace gl {
 
 class GfxTexturesReporter MOZ_FINAL : public nsIMemoryReporter
 {
@@ -39,57 +38,24 @@ public:
         MemoryFreed
     };
 
     // When memory is used/freed for tile textures, call this method to update
     // the value reported by this memory reporter.
     static void UpdateAmount(MemoryUse action, GLenum format, GLenum type,
                              int32_t tileWidth, int32_t tileHeight);
 
-    static void UpdateWasteAmount(int delta) {
-      sTileWasteAmount += delta;
-    }
-
     NS_IMETHOD CollectReports(nsIHandleReportCallback* aHandleReport,
                               nsISupports* aData, bool aAnonymize)
     {
-        MOZ_COLLECT_REPORT("gfx-tiles-waste", KIND_OTHER, UNITS_BYTES,
-            sTileWasteAmount,
-            "Memory lost due to tiles extending past content boundaries");
         return MOZ_COLLECT_REPORT(
             "gfx-textures", KIND_OTHER, UNITS_BYTES, sAmount,
             "Memory used for storing GL textures.");
     }
 
 private:
-    static Atomic<size_t> sAmount;
-    // Count the amount of memory lost to tile waste
-    static Atomic<size_t> sTileWasteAmount;
-};
-
-class GfxTextureWasteTracker {
-public:
-  GfxTextureWasteTracker()
-    : mBytes(0)
-  {
-    MOZ_COUNT_CTOR(GfxTextureWasteTracker);
-  }
-
-  void Update(size_t aPixelArea, size_t aBytesPerPixel) {
-    GfxTexturesReporter::UpdateWasteAmount(-mBytes);
-    mBytes = aPixelArea * aBytesPerPixel;
-    GfxTexturesReporter::UpdateWasteAmount(mBytes);
-  }
-
-  ~GfxTextureWasteTracker() {
-    GfxTexturesReporter::UpdateWasteAmount(-mBytes);
-    MOZ_COUNT_DTOR(GfxTextureWasteTracker);
-  }
-private:
-  GfxTextureWasteTracker(const GfxTextureWasteTracker& aRef);
-
-  size_t mBytes;
+    static int64_t sAmount;
 };
 
 }
 }
 
 #endif // GFXTEXTURESREPORTER_H_
--- a/gfx/layers/client/TextureClient.h
+++ b/gfx/layers/client/TextureClient.h
@@ -21,17 +21,16 @@
 #include "mozilla/ipc/Shmem.h"          // for Shmem
 #include "mozilla/layers/AtomicRefCountedWithFinalize.h"
 #include "mozilla/layers/CompositorTypes.h"  // for TextureFlags, etc
 #include "mozilla/layers/LayersSurfaces.h"  // for SurfaceDescriptor
 #include "mozilla/mozalloc.h"           // for operator delete
 #include "nsAutoPtr.h"                  // for nsRefPtr
 #include "nsCOMPtr.h"                   // for already_AddRefed
 #include "nsISupportsImpl.h"            // for TextureImage::AddRef, etc
-#include "GfxTexturesReporter.h"
 
 class gfxReusableSurfaceWrapper;
 class gfxImageSurface;
 
 namespace mozilla {
 namespace gl {
 class GLContext;
 class SurfaceStream;
@@ -347,24 +346,16 @@ public:
    */
   virtual void SetRemoveFromCompositableTracker(AsyncTransactionTracker* aTracker) {}
 
   /**
    * This function waits until the buffer is no longer being used.
    */
   virtual void WaitForBufferOwnership() {}
 
-  /**
-   * Track how much of this texture is wasted.
-   * For example we might allocate a 256x256 tile but only use 10x10.
-   */
-   void SetWaste(int aWasteArea) {
-     mWasteTracker.Update(aWasteArea, BytesPerPixel(GetFormat()));
-   }
-
 private:
   /**
    * Called once, just before the destructor.
    *
    * Here goes the shut-down code that uses virtual methods.
    * Must only be called by Release().
    */
   void Finalize();
@@ -397,21 +388,20 @@ protected:
   ISurfaceAllocator* GetAllocator()
   {
     return mAllocator;
   }
 
   RefPtr<TextureChild> mActor;
   RefPtr<ISurfaceAllocator> mAllocator;
   TextureFlags mFlags;
+  bool mShared;
+  bool mValid;
   FenceHandle mReleaseFenceHandle;
   FenceHandle mAcquireFenceHandle;
-  gl::GfxTextureWasteTracker mWasteTracker;
-  bool mShared;
-  bool mValid;
 
   friend class TextureChild;
   friend class RemoveTextureFromCompositableTracker;
   friend void TestTextureClientSurface(TextureClient*, gfxImageSurface*);
   friend void TestTextureClientYCbCr(TextureClient*, PlanarYCbCrData&);
 };
 
 /**
--- a/gfx/layers/client/TiledContentClient.cpp
+++ b/gfx/layers/client/TiledContentClient.cpp
@@ -945,24 +945,16 @@ ClientTiledLayerBuffer::ValidateTile(Til
 #ifdef GFX_TILEDLAYER_DEBUG_OVERLAY
   DrawDebugOverlay(drawTarget, aTileOrigin.x * mResolution,
                    aTileOrigin.y * mResolution, GetTileLength(), GetTileLength());
 #endif
 
   ctxt = nullptr;
   drawTarget = nullptr;
 
-  nsIntRegion tileRegion =
-    nsIntRect(aTileOrigin.x, aTileOrigin.y,
-              GetScaledTileSize().width, GetScaledTileSize().height);
-  // Intersect this area with the portion that's invalid.
-  tileRegion = tileRegion.Sub(tileRegion, GetValidRegion());
-  tileRegion = tileRegion.Sub(tileRegion, aDirtyRegion); // Has now been validated
-
-  backBuffer->SetWaste(tileRegion.Area() * mResolution * mResolution);
   backBuffer->Unlock();
 
   if (createdTextureClient) {
     if (!mCompositableClient->AddTextureClient(backBuffer)) {
       NS_WARNING("Failed to add tile TextureClient.");
       aTile.DiscardFrontBuffer();
       aTile.DiscardBackBuffer();
       return aTile;