Backout 09d66d9ccb2e (bug 818060) for build failures on Windows

This commit is contained in:
Ed Morley 2012-12-13 17:17:12 +00:00
parent d32e31945b
commit 9befd7d8b0
6 changed files with 3 additions and 120 deletions

View File

@ -3108,8 +3108,6 @@ protected:
}
};
uint32_t GetBitsPerTexel(GLenum format, GLenum type);
} /* namespace gl */
} /* namespace mozilla */

View File

@ -419,63 +419,6 @@ GLContext::BlitTextureToTexture(GLuint srcTex, GLuint 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 */

View File

@ -21,7 +21,9 @@ TiledLayerBufferOGL::~TiledLayerBufferOGL()
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);
}
}
@ -32,8 +34,6 @@ TiledLayerBufferOGL::ReleaseTile(TiledTexture aTile)
if (aTile == GetPlaceholderTile())
return;
mContext->fDeleteTextures(1, &aTile.mTextureHandle);
gfxPlatform::UpdateTiledThebesLayerTextureUsage(eMemoryUse_free, aTile.mFormat, GetTileType(aTile), GetTileLength());
}
void
@ -59,13 +59,6 @@ TiledLayerBufferOGL::Upload(const BasicTiledLayerBuffer* aMainMemoryTiledBuffer,
#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,
@ -98,9 +91,6 @@ TiledLayerBufferOGL::ValidateTile(TiledTexture aTile,
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();
@ -112,8 +102,6 @@ TiledLayerBufferOGL::ValidateTile(TiledTexture aTile,
GetTileLength(), GetTileLength(), 0,
format, type, buf);
gfxPlatform::UpdateTiledThebesLayerTextureUsage(eMemoryUse_alloc, format, type, GetTileLength());
aTile.mFormat = format;
#ifdef GFX_TILEDLAYER_PREF_WARNINGS

View File

@ -100,7 +100,6 @@ private:
const BasicTiledLayerBuffer* mMainMemoryTiledBuffer;
gfxSize mFrameResolution;
GLenum GetTileType(TiledTexture aTile);
void GetFormatAndTileForImageFormat(gfxASurface::gfxImageFormat aFormat,
GLenum& aOutFormat,
GLenum& aOutType);

View File

@ -70,7 +70,6 @@
#include "mozilla/Attributes.h"
#include "nsIGfxInfo.h"
#include "nsIMemoryReporter.h"
using namespace mozilla;
using namespace mozilla::layers;
@ -214,33 +213,6 @@ static const char *gPrefLangNames[] = {
"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)
{
@ -257,8 +229,6 @@ gfxPlatform::gfxPlatform()
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*

View File

@ -20,7 +20,6 @@
#include "gfx2DGlue.h"
#include "mozilla/RefPtr.h"
#include "GfxInfoCollector.h"
#include "GLContext.h"
#ifdef XP_OS2
#undef OS2EMX_PLAIN_CHAR
@ -105,13 +104,6 @@ enum eGfxLog {
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;
@ -424,13 +416,6 @@ public:
// 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();
/**