diff options
author | Chris Craik <ccraik@google.com> | 2011-08-23 10:02:28 -0700 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2011-08-23 10:02:28 -0700 |
commit | 2611ed55f09dc1c2b17df5e453256c15722b5846 (patch) | |
tree | 4de92e0f1a3ebcd858866015886162a338058103 /Source/WebCore/platform/graphics/android | |
parent | 377f79007646131d8b91f685c89cb49abec5a996 (diff) | |
parent | 4a59c354560ed255d45ad00dbdbed13f045c557e (diff) | |
download | external_webkit-2611ed55f09dc1c2b17df5e453256c15722b5846.zip external_webkit-2611ed55f09dc1c2b17df5e453256c15722b5846.tar.gz external_webkit-2611ed55f09dc1c2b17df5e453256c15722b5846.tar.bz2 |
Merge "Re-enable tile prefetching, correct and adjust max tile allocation logic"
Diffstat (limited to 'Source/WebCore/platform/graphics/android')
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 aa4fcd2..3cc192f 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); |