Backout 09d66d9ccb2e (bug 818060) for build failures on Windows
authorEd Morley <emorley@mozilla.com>
Thu, 13 Dec 2012 17:17:12 +0000
changeset 125044 2aae75e86935f2bec86fef0826c095600620b905
parent 125043 2e34b7c8a339ae3e092e918bd6e16e6ea7eb9bb0
child 125045 021a624ea78ecc94177156d48a10f1d741a91768
push id2151
push userlsblakk@mozilla.com
push dateTue, 19 Feb 2013 18:06:57 +0000
treeherdermozilla-beta@4952e88741ec [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs818060
milestone20.0a1
backs out09d66d9ccb2ed41c822c44b70693aa72dd8db46c
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 09d66d9ccb2e (bug 818060) for build failures on Windows
gfx/gl/GLContext.h
gfx/gl/GLContextUtils.cpp
gfx/layers/opengl/TiledThebesLayerOGL.cpp
gfx/layers/opengl/TiledThebesLayerOGL.h
gfx/thebes/gfxPlatform.cpp
gfx/thebes/gfxPlatform.h
--- a/gfx/gl/GLContext.h
+++ b/gfx/gl/GLContext.h
@@ -3103,14 +3103,12 @@ public:
 
 protected:
     void UnwrapImpl() {
         MOZ_ASSERT(mGL->IsCurrent());
         mGL->BindUserFBO(mOldState);
     }
 };
 
-uint32_t GetBitsPerTexel(GLenum format, GLenum type);
-
 } /* namespace gl */
 } /* namespace mozilla */
 
 #endif /* GLCONTEXT_H_ */
--- a/gfx/gl/GLContextUtils.cpp
+++ b/gfx/gl/GLContextUtils.cpp
@@ -414,68 +414,11 @@ GLContext::BlitTextureToTexture(GLuint s
     // Generally, just use the CopyTexSubImage path
     ScopedFramebufferTexture srcWrapper(this, srcTex);
     MOZ_ASSERT(srcWrapper.IsComplete());
 
     BlitFramebufferToTexture(srcWrapper.FB(), destTex,
                              srcSize, destSize);
 }
 
-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;
-    }
-
-    if (format == LOCAL_GL_DEPTH_COMPONENT) {
-        if (type == LOCAL_GL_UNSIGNED_SHORT)
-            return 2;
-        else if (type == LOCAL_GL_UNSIGNED_INT)
-            return 4;
-    } else if (format == LOCAL_GL_DEPTH_STENCIL) {
-        if (type == LOCAL_GL_UNSIGNED_INT_24_8_EXT)
-            return 4;
-    }
-
-    if (type == LOCAL_GL_UNSIGNED_BYTE || type == LOCAL_GL_FLOAT) {
-        int multiplier = type == LOCAL_GL_FLOAT ? 32 : 8;
-        switch (format) {
-            case LOCAL_GL_ALPHA:
-            case LOCAL_GL_LUMINANCE:
-                return 1 * multiplier;
-            case LOCAL_GL_LUMINANCE_ALPHA:
-                return 2 * multiplier;
-            case LOCAL_GL_RGB:
-                return 3 * multiplier;
-            case LOCAL_GL_RGBA:
-                return 4 * multiplier;
-            case LOCAL_GL_COMPRESSED_RGB_PVRTC_2BPPV1:
-            case LOCAL_GL_COMPRESSED_RGBA_PVRTC_2BPPV1:
-                return 2;
-            case LOCAL_GL_COMPRESSED_RGB_S3TC_DXT1_EXT:
-            case LOCAL_GL_COMPRESSED_RGBA_S3TC_DXT1_EXT:
-            case LOCAL_GL_ATC_RGB:
-            case LOCAL_GL_COMPRESSED_RGB_PVRTC_4BPPV1:
-            case LOCAL_GL_COMPRESSED_RGBA_PVRTC_4BPPV1:
-                return 4;
-            case LOCAL_GL_COMPRESSED_RGBA_S3TC_DXT3_EXT:
-            case LOCAL_GL_COMPRESSED_RGBA_S3TC_DXT5_EXT:
-            case LOCAL_GL_ATC_RGBA_EXPLICIT_ALPHA:
-            case LOCAL_GL_ATC_RGBA_INTERPOLATED_ALPHA:
-                return 8;
-            default:
-                break;
-        }
-    } else if (type == LOCAL_GL_UNSIGNED_SHORT_4_4_4_4 ||
-               type == LOCAL_GL_UNSIGNED_SHORT_5_5_5_1 ||
-               type == LOCAL_GL_UNSIGNED_SHORT_5_6_5)
-    {
-        return 16;
-    }
-
-    MOZ_ASSERT(false);
-    return 0;
-}
-
 
 } /* namespace gl */
 } /* namespace mozilla */
--- a/gfx/layers/opengl/TiledThebesLayerOGL.cpp
+++ b/gfx/layers/opengl/TiledThebesLayerOGL.cpp
@@ -16,29 +16,29 @@ using mozilla::gl::GLContext;
 
 TiledLayerBufferOGL::~TiledLayerBufferOGL()
 {
   if (mRetainedTiles.Length() == 0)
     return;
 
   mContext->MakeCurrent();
   for (size_t i = 0; i < mRetainedTiles.Length(); i++) {
-    ReleaseTile(mRetainedTiles[i]);
+    if (mRetainedTiles[i] == GetPlaceholderTile())
+      continue;
+    mContext->fDeleteTextures(1, &mRetainedTiles[i].mTextureHandle);
   }
 }
 
 void
 TiledLayerBufferOGL::ReleaseTile(TiledTexture aTile)
 {
   // We've made current prior to calling TiledLayerBufferOGL::Update
   if (aTile == GetPlaceholderTile())
     return;
   mContext->fDeleteTextures(1, &aTile.mTextureHandle);
-
-  gfxPlatform::UpdateTiledThebesLayerTextureUsage(eMemoryUse_free, aTile.mFormat, GetTileType(aTile), GetTileLength());
 }
 
 void
 TiledLayerBufferOGL::Upload(const BasicTiledLayerBuffer* aMainMemoryTiledBuffer,
                             const nsIntRegion& aNewValidRegion,
                             const nsIntRegion& aInvalidateRegion,
                             const gfxSize& aResolution)
 {
@@ -54,23 +54,16 @@ TiledLayerBufferOGL::Upload(const BasicT
   mMainMemoryTiledBuffer = nullptr;
 #ifdef GFX_TILEDLAYER_PREF_WARNINGS
   if (PR_IntervalNow() - start > 10) {
     printf_stderr("Time to upload %i\n", PR_IntervalNow() - start);
   }
 #endif
 }
 
-GLenum
-TiledLayerBufferOGL::GetTileType(TiledTexture aTile)
-{
-  // Deduce the type that was assigned in GetFormatAndTileForImageFormat
-  return aTile.mFormat == LOCAL_GL_RGB ? LOCAL_GL_UNSIGNED_SHORT_5_6_5 : LOCAL_GL_UNSIGNED_BYTE;
-}
-
 void
 TiledLayerBufferOGL::GetFormatAndTileForImageFormat(gfxASurface::gfxImageFormat aFormat,
                                                     GLenum& aOutFormat,
                                                     GLenum& aOutType)
 {
   if (aFormat == gfxASurface::ImageFormatRGB16_565) {
     aOutFormat = LOCAL_GL_RGB;
     aOutType = LOCAL_GL_UNSIGNED_SHORT_5_6_5;
@@ -93,32 +86,27 @@ TiledLayerBufferOGL::ValidateTile(TiledT
     mContext->fGenTextures(1, &aTile.mTextureHandle);
     mContext->fBindTexture(LOCAL_GL_TEXTURE_2D, aTile.mTextureHandle);
     mContext->fTexParameteri(LOCAL_GL_TEXTURE_2D, LOCAL_GL_TEXTURE_MIN_FILTER, LOCAL_GL_LINEAR);
     mContext->fTexParameteri(LOCAL_GL_TEXTURE_2D, LOCAL_GL_TEXTURE_MAG_FILTER, LOCAL_GL_LINEAR);
     mContext->fTexParameteri(LOCAL_GL_TEXTURE_2D, LOCAL_GL_TEXTURE_WRAP_S, LOCAL_GL_CLAMP_TO_EDGE);
     mContext->fTexParameteri(LOCAL_GL_TEXTURE_2D, LOCAL_GL_TEXTURE_WRAP_T, LOCAL_GL_CLAMP_TO_EDGE);
   } else {
     mContext->fBindTexture(LOCAL_GL_TEXTURE_2D, aTile.mTextureHandle);
-    // We're re-using a texture, but the format may change. Update the memory
-    // reporter with a free and alloc (below) using the old and new formats.
-    gfxPlatform::UpdateTiledThebesLayerTextureUsage(eMemoryUse_free, aTile.mFormat, GetTileType(aTile), GetTileLength());
   }
 
   nsRefPtr<gfxReusableSurfaceWrapper> reusableSurface = mMainMemoryTiledBuffer->GetTile(aTileOrigin).mSurface.get();
   GLenum format, type;
   GetFormatAndTileForImageFormat(reusableSurface->Format(), format, type);
 
   const unsigned char* buf = reusableSurface->GetReadOnlyData();
   mContext->fTexImage2D(LOCAL_GL_TEXTURE_2D, 0, format,
                        GetTileLength(), GetTileLength(), 0,
                        format, type, buf);
 
-  gfxPlatform::UpdateTiledThebesLayerTextureUsage(eMemoryUse_alloc, format, type, GetTileLength());
-
   aTile.mFormat = format;
 
 #ifdef GFX_TILEDLAYER_PREF_WARNINGS
   if (PR_IntervalNow() - start > 1) {
     printf_stderr("Tile Time to upload %i\n", PR_IntervalNow() - start);
   }
 #endif
   return aTile;
--- a/gfx/layers/opengl/TiledThebesLayerOGL.h
+++ b/gfx/layers/opengl/TiledThebesLayerOGL.h
@@ -95,17 +95,16 @@ protected:
     std::swap(aTileA, aTileB);
   }
 
 private:
   nsRefPtr<gl::GLContext> mContext;
   const BasicTiledLayerBuffer* mMainMemoryTiledBuffer;
   gfxSize mFrameResolution;
 
-  GLenum GetTileType(TiledTexture aTile);
   void GetFormatAndTileForImageFormat(gfxASurface::gfxImageFormat aFormat,
                                       GLenum& aOutFormat,
                                       GLenum& aOutType);
 };
 
 class TiledThebesLayerOGL : public ShadowThebesLayer,
                             public LayerOGL,
                             public TiledLayerComposer
--- a/gfx/thebes/gfxPlatform.cpp
+++ b/gfx/thebes/gfxPlatform.cpp
@@ -65,17 +65,16 @@
 #include "TexturePoolOGL.h"
 #endif
 
 #include "mozilla/Preferences.h"
 #include "mozilla/Assertions.h"
 #include "mozilla/Attributes.h"
 
 #include "nsIGfxInfo.h"
-#include "nsIMemoryReporter.h"
 
 using namespace mozilla;
 using namespace mozilla::layers;
 
 gfxPlatform *gPlatform = nullptr;
 static bool gEverInitialized = false;
 
 // These two may point to the same profile
@@ -209,61 +208,32 @@ static const char *gPrefLangNames[] = {
     "x-telu",
     "x-knda",
     "x-sinh",
     "x-tibt",
     "x-unicode",
     "x-user-def"
 };
 
-static int64_t sTiledThebesLayerTextureUsage = 0;
-
-static int64_t
-GetTiledThebesLayerTextureUsage()
-{
-    return sTiledThebesLayerTextureUsage;
-}
-
-void
-gfxPlatform::UpdateTiledThebesLayerTextureUsage(eMemoryUse action, GLenum format, GLenum type, uint16_t tileSize)
-{
-    uint32_t bytesPerTexel = mozilla::gl::GetBitsPerTexel(format, type) / 8;
-    int64_t bytes = (int64_t)(tileSize * tileSize * bytesPerTexel);
-    if (action == eMemoryUse_free) {
-        sTiledThebesLayerTextureUsage -= bytes;
-    } else {
-        sTiledThebesLayerTextureUsage += bytes;
-    }
-}
-
-NS_MEMORY_REPORTER_IMPLEMENT(TiledThebesLayer,
-    "gfx-tiled-thebes-layer-textures",
-    KIND_OTHER,
-    UNITS_BYTES,
-    GetTiledThebesLayerTextureUsage,
-    "Texture memory used by TiledThebesLayer.");
-
 gfxPlatform::gfxPlatform()
   : mAzureCanvasBackendCollector(this, &gfxPlatform::GetAzureBackendInfo)
 {
     mUseHarfBuzzScripts = UNINITIALIZED_VALUE;
     mAllowDownloadableFonts = UNINITIALIZED_VALUE;
     mDownloadableFontsSanitize = UNINITIALIZED_VALUE;
     mFallbackUsesCmaps = UNINITIALIZED_VALUE;
 
 #ifdef MOZ_GRAPHITE
     mGraphiteShapingEnabled = UNINITIALIZED_VALUE;
 #endif
     mBidiNumeralOption = UNINITIALIZED_VALUE;
 
     uint32_t canvasMask = (1 << BACKEND_CAIRO) | (1 << BACKEND_SKIA);
     uint32_t contentMask = 0;
     InitBackendPrefs(canvasMask, contentMask);
-
-    NS_RegisterMemoryReporter(new NS_MEMORY_REPORTER_NAME(TiledThebesLayer));
 }
 
 gfxPlatform*
 gfxPlatform::GetPlatform()
 {
     if (!gPlatform) {
         Init();
     }
--- a/gfx/thebes/gfxPlatform.h
+++ b/gfx/thebes/gfxPlatform.h
@@ -15,17 +15,16 @@
 #include "gfxASurface.h"
 #include "gfxColor.h"
 
 #include "qcms.h"
 
 #include "gfx2DGlue.h"
 #include "mozilla/RefPtr.h"
 #include "GfxInfoCollector.h"
-#include "GLContext.h"
 
 #ifdef XP_OS2
 #undef OS2EMX_PLAIN_CHAR
 #endif
 
 class gfxImageSurface;
 class gfxFont;
 class gfxFontGroup;
@@ -100,23 +99,16 @@ enum eGfxLog {
     // dump text runs, font matching, system fallback for content
     eGfxLog_textrun          = 2,
     // dump text runs, font matching, system fallback for chrome
     eGfxLog_textrunui        = 3,
     // dump cmap coverage data as they are loaded
     eGfxLog_cmapdata         = 4
 };
 
-enum eMemoryUse {
-    // when memory being allocated is reported to a memory reporter
-    eMemoryUse_alloc    = 0,
-    // when memory being freed is reported to a memory reporter
-    eMemoryUse_free     = 1
-};
-
 // when searching through pref langs, max number of pref langs
 const uint32_t kMaxLenPrefLangList = 32;
 
 #define UNINITIALIZED_VALUE  (-1)
 
 typedef gfxASurface::gfxImageFormat gfxImageFormat;
 
 inline const char*
@@ -419,23 +411,16 @@ public:
 
     // Retrieve the resolution that a low precision buffer should render at.
     static float GetLowPrecisionResolution();
 
     // Retain some invalid tiles when the valid region of a layer changes and
     // excludes previously valid tiles.
     static bool UseReusableTileStore();
 
-    // When memory is used/freed for tile textures, call this method
-    // to update the value reported by the memory reporter.
-    static void UpdateTiledThebesLayerTextureUsage(eMemoryUse action,
-                                                   GLenum format,
-                                                   GLenum type,
-                                                   uint16_t tileSize);
-
     static bool OffMainThreadCompositingEnabled();
 
     /**
      * Are we going to try color management?
      */
     static eCMSMode GetCMSMode();
 
     /**