summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorChris Craik <ccraik@google.com>2011-09-14 16:56:00 -0700
committerAndroid (Google) Code Review <android-gerrit@google.com>2011-09-14 16:56:00 -0700
commitbf67a54e6a1e5ab331404b6e745a6c27c840d6dd (patch)
tree1c80d2d0011b7e734f874051785aa49f6b97a351 /Source
parent2c6734b2136615b5e7ce38e9f7ab65d375afaa70 (diff)
parent776eacf05148ca804f88be63f6e81cb00f2e24aa (diff)
downloadexternal_webkit-bf67a54e6a1e5ab331404b6e745a6c27c840d6dd.zip
external_webkit-bf67a54e6a1e5ab331404b6e745a6c27c840d6dd.tar.gz
external_webkit-bf67a54e6a1e5ab331404b6e745a6c27c840d6dd.tar.bz2
Merge "Improve tile painting prioritization to minimize stalled, blank tiles"
Diffstat (limited to 'Source')
-rw-r--r--Source/WebCore/platform/graphics/android/PaintTileOperation.cpp32
-rw-r--r--Source/WebCore/platform/graphics/android/TiledPage.cpp1
2 files changed, 16 insertions, 17 deletions
diff --git a/Source/WebCore/platform/graphics/android/PaintTileOperation.cpp b/Source/WebCore/platform/graphics/android/PaintTileOperation.cpp
index 4366ad6..aa3f320 100644
--- a/Source/WebCore/platform/graphics/android/PaintTileOperation.cpp
+++ b/Source/WebCore/platform/graphics/android/PaintTileOperation.cpp
@@ -76,27 +76,25 @@ int PaintTileOperation::priority()
if (!m_tile)
return -1;
- int priority;
- if (m_tile->isLayerTile())
- priority = -2;
- else {
+ // first, prioritize higher draw count
+ unsigned long long currentDraw = TilesManager::instance()->getDrawGLCount();
+ unsigned long long drawDelta = currentDraw - m_tile->drawCount();
+ int priority = 100000 * (int)std::min(drawDelta, (unsigned long long)1000);
+
+ // prioritize unpainted tiles, within the same drawCount
+ if (m_tile->frontTexture())
+ priority += 50000;
+
+ // for base tiles, prioritize based on position
+ if (!m_tile->isLayerTile()) {
bool goingDown = m_tile->page()->scrollingDown();
SkIRect *rect = m_tile->page()->expandedTileBounds();
- int firstTileX = rect->fLeft;
- int nbTilesWidth = rect->width();
- priority = m_tile->x() - firstTileX;
+ priority += m_tile->x();
+
if (goingDown)
- priority += (rect->fBottom - m_tile->y()) * nbTilesWidth;
+ priority += 100000 - (1 + m_tile->y()) * 1000;
else
- priority += (m_tile->y() - rect->fTop) * nbTilesWidth;
- }
-
- if (m_tile->frontTexture()) {
- // de-prioritize old tiles that have something visible
- unsigned long long currentDraw = TilesManager::instance()->getDrawGLCount();
- unsigned long long drawDelta = currentDraw - m_tile->drawCount();
- int cappedDrawDelta = (int)std::max(drawDelta, (unsigned long long)1000);
- priority += cappedDrawDelta * 100000;
+ priority += m_tile->y() * 1000;
}
return priority;
diff --git a/Source/WebCore/platform/graphics/android/TiledPage.cpp b/Source/WebCore/platform/graphics/android/TiledPage.cpp
index 78140fa..ede7d1b 100644
--- a/Source/WebCore/platform/graphics/android/TiledPage.cpp
+++ b/Source/WebCore/platform/graphics/android/TiledPage.cpp
@@ -172,6 +172,7 @@ void TiledPage::prepareRow(bool goingLeft, int tilesInRow, int firstTileX, int y
if (!currentTile && availableTile) {
XLOG("STEALING tile %d, %d (draw count %llu) for tile %d, %d",
availableTile->x(), availableTile->y(), availableTile->drawCount(), x, y);
+ availableTile->discardTextures(); // don't wait for textures to be stolen
currentTile = availableTile;
}