diff options
author | Teng-Hui Zhu <ztenghui@google.com> | 2011-09-27 15:38:35 -0700 |
---|---|---|
committer | Teng-Hui Zhu <ztenghui@google.com> | 2011-09-27 16:30:56 -0700 |
commit | ebcd36bcdbefb452a0be4e9e452a054ffdff4763 (patch) | |
tree | 3c9341dcfada9d4754d07ecb769bc32470ea5fe9 | |
parent | 494b1214559a0b6ddeff8e9b3eebc7f22cb2e951 (diff) | |
download | external_webkit-ebcd36bcdbefb452a0be4e9e452a054ffdff4763.zip external_webkit-ebcd36bcdbefb452a0be4e9e452a054ffdff4763.tar.gz external_webkit-ebcd36bcdbefb452a0be4e9e452a054ffdff4763.tar.bz2 |
Dynamically set the upper limit of layer tiles' texture number
Instead of using a static number, now the upper limit of the layer tiles is
also dependent on the viewport size.
At the same time, get rid of the old code only useful without tiled layer.
bug:5347539
Change-Id: Ie720449ea15043d42a56f4c8af57820fa7f6e93c
-rw-r--r-- | Source/WebCore/platform/graphics/android/TilesManager.cpp | 28 | ||||
-rw-r--r-- | Source/WebCore/platform/graphics/android/TilesManager.h | 2 |
2 files changed, 9 insertions, 21 deletions
diff --git a/Source/WebCore/platform/graphics/android/TilesManager.cpp b/Source/WebCore/platform/graphics/android/TilesManager.cpp index 2c7f09b..8724fbc 100644 --- a/Source/WebCore/platform/graphics/android/TilesManager.cpp +++ b/Source/WebCore/platform/graphics/android/TilesManager.cpp @@ -65,17 +65,16 @@ // In our case, we use 256*256 textures. On the tablet, this equates to // at least 60 textures, or 112 with expanded tile boundaries. // 112(tiles)*256*256*4(bpp)*2(pages) = 56MB +// It turns out the viewport dependent value m_maxTextureCount is a reasonable +// number to cap the layer tile texturs, it worked on both phones and tablets. +// TODO: after merge the pool of base tiles and layer tiles, we should revisit +// the logic of allocation management. #define MAX_TEXTURE_ALLOCATION ((6+TILE_PREFETCH_DISTANCE*2)*(5+TILE_PREFETCH_DISTANCE*2)*2) #define TILE_WIDTH 256 #define TILE_HEIGHT 256 #define LAYER_TILE_WIDTH 256 #define LAYER_TILE_HEIGHT 256 -#define LAYER_TILES 100 -// Define a maximum amount of ram used by layers -#define MAX_LAYERS_ALLOCATION 33554432 // 32Mb -// Define a maximum amount of ram used by one layer -#define MAX_LAYER_ALLOCATION 8388608 // 8Mb #define BYTES_PER_PIXEL 4 // 8888 config namespace WebCore { @@ -105,8 +104,8 @@ TilesManager::TilesManager() XLOG("TilesManager ctor"); m_textures.reserveCapacity(MAX_TEXTURE_ALLOCATION); m_availableTextures.reserveCapacity(MAX_TEXTURE_ALLOCATION); - m_tilesTextures.reserveCapacity(LAYER_TILES); - m_availableTilesTextures.reserveCapacity(LAYER_TILES); + m_tilesTextures.reserveCapacity(MAX_TEXTURE_ALLOCATION); + m_availableTilesTextures.reserveCapacity(MAX_TEXTURE_ALLOCATION); m_pixmapsGenerationThread = new TexturesGenerator(); m_pixmapsGenerationThread->run("TexturesGenerator"); } @@ -128,8 +127,9 @@ void TilesManager::allocateTiles() nbTexturesAllocated++; } - int nbLayersTexturesToAllocate = LAYER_TILES - m_tilesTextures.size(); - XLOG("%d layers tiles to allocate (%d textures planned)", nbLayersTexturesToAllocate, LAYER_TILES); + int nbLayersTexturesToAllocate = m_maxTextureCount - m_tilesTextures.size(); + XLOG("%d layers tiles to allocate (%d textures planned)", + nbLayersTexturesToAllocate, m_maxTextureCount); int nbLayersTexturesAllocated = 0; for (int i = 0; i < nbLayersTexturesToAllocate; i++) { BaseTileTexture* texture = new BaseTileTexture( @@ -339,16 +339,6 @@ BaseTileTexture* TilesManager::getAvailableTexture(BaseTile* owner) return 0; } -int TilesManager::maxLayersAllocation() -{ - return MAX_LAYERS_ALLOCATION; -} - -int TilesManager::maxLayerAllocation() -{ - return MAX_LAYER_ALLOCATION; -} - int TilesManager::maxTextureCount() { android::Mutex::Autolock lock(m_texturesLock); diff --git a/Source/WebCore/platform/graphics/android/TilesManager.h b/Source/WebCore/platform/graphics/android/TilesManager.h index 775af48..c582065 100644 --- a/Source/WebCore/platform/graphics/android/TilesManager.h +++ b/Source/WebCore/platform/graphics/android/TilesManager.h @@ -102,8 +102,6 @@ public: void resetTextureUsage(TiledPage* page); - int maxLayersAllocation(); - int maxLayerAllocation(); int maxTextureCount(); void setMaxTextureCount(int max); static float tileWidth(); |