diff options
author | Chris Craik <ccraik@google.com> | 2011-08-22 15:49:32 -0700 |
---|---|---|
committer | Chris Craik <ccraik@google.com> | 2011-08-22 15:49:32 -0700 |
commit | 4a59c354560ed255d45ad00dbdbed13f045c557e (patch) | |
tree | ef6cdca0c39334697e149dd411ce464847f9fcc5 | |
parent | 77e5b594dd717e27b1a8be2b521f738cf5941ae1 (diff) | |
download | external_webkit-4a59c354560ed255d45ad00dbdbed13f045c557e.zip external_webkit-4a59c354560ed255d45ad00dbdbed13f045c557e.tar.gz external_webkit-4a59c354560ed255d45ad00dbdbed13f045c557e.tar.bz2 |
Re-enable tile prefetching, correct and adjust max tile allocation logic
bug:5168261
Change-Id: I37ec223da4ac1555cd925b08f105f9ed571cb2d9
3 files changed, 16 insertions, 9 deletions
diff --git a/Source/WebCore/platform/graphics/android/GLWebViewState.cpp b/Source/WebCore/platform/graphics/android/GLWebViewState.cpp index e600b04..a4953a3 100644 --- a/Source/WebCore/platform/graphics/android/GLWebViewState.cpp +++ b/Source/WebCore/platform/graphics/android/GLWebViewState.cpp @@ -395,8 +395,8 @@ void GLWebViewState::setViewport(SkRect& viewport, float scale) static_cast<int>(ceilf(viewport.fRight * invTileContentWidth)), static_cast<int>(ceilf(viewport.fBottom * invTileContentHeight))); - int maxTextureCount = (m_viewportTileBounds.width() + TILE_PREFETCH_DISTANCE * 2 + 1) * - (m_viewportTileBounds.height() + TILE_PREFETCH_DISTANCE * 2 + 1) * 2; + int maxTextureCount = (m_viewportTileBounds.width() + TILE_PREFETCH_DISTANCE * 2) * + (m_viewportTileBounds.height() + TILE_PREFETCH_DISTANCE * 2) * 2; TilesManager::instance()->setMaxTextureCount(maxTextureCount); m_tiledPageA->updateBaseTileSize(); m_tiledPageB->updateBaseTileSize(); diff --git a/Source/WebCore/platform/graphics/android/GLWebViewState.h b/Source/WebCore/platform/graphics/android/GLWebViewState.h index 421b25f..9182af3 100644 --- a/Source/WebCore/platform/graphics/android/GLWebViewState.h +++ b/Source/WebCore/platform/graphics/android/GLWebViewState.h @@ -44,8 +44,10 @@ // #define MEASURES_PERF #define MAX_MEASURES_PERF 2000 -// Prefetch and render 2 tiles ahead of the scroll -#define TILE_PREFETCH_DISTANCE 0 +// Prefetch and render 1 tiles ahead of the scroll +// TODO: We should either dynamically change the outer bound by detecting the +// HW limit or save further in the GPU memory consumption. +#define TILE_PREFETCH_DISTANCE 1 // ratio of content to view required for prefetching to enable #define TILE_PREFETCH_RATIO 1.2 diff --git a/Source/WebCore/platform/graphics/android/TilesManager.cpp b/Source/WebCore/platform/graphics/android/TilesManager.cpp index d7c7952..57c38cf 100644 --- a/Source/WebCore/platform/graphics/android/TilesManager.cpp +++ b/Source/WebCore/platform/graphics/android/TilesManager.cpp @@ -58,8 +58,14 @@ #endif // DEBUG -// Number of tiles for base layer -#define MAX_TEXTURE_ALLOCATION 51 +// Important: We need at least twice as many textures as is needed to cover +// one viewport, otherwise the allocation may stall. +// We need n textures for one TiledPage, and another n textures for the +// second page used when scaling. +// 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 +#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 @@ -322,9 +328,8 @@ void TilesManager::setMaxTextureCount(int max) { XLOG("setMaxTextureCount: %d (current: %d, total:%d)", max, m_maxTextureCount, MAX_TEXTURE_ALLOCATION); - if (m_maxTextureCount && - (max > MAX_TEXTURE_ALLOCATION || - max <= m_maxTextureCount)) + if (m_maxTextureCount == MAX_TEXTURE_ALLOCATION || + max <= m_maxTextureCount) return; android::Mutex::Autolock lock(m_texturesLock); |