diff options
author | Chris Craik <ccraik@google.com> | 2011-09-14 16:06:57 -0700 |
---|---|---|
committer | Chris Craik <ccraik@google.com> | 2011-09-14 16:13:50 -0700 |
commit | 776eacf05148ca804f88be63f6e81cb00f2e24aa (patch) | |
tree | f2127c7f7bd6b619e668660f3d977768a77bface /Source/WebCore | |
parent | 6fa81b6762dfc7fdd6d9f177d0c326e7bef3537b (diff) | |
download | external_webkit-776eacf05148ca804f88be63f6e81cb00f2e24aa.zip external_webkit-776eacf05148ca804f88be63f6e81cb00f2e24aa.tar.gz external_webkit-776eacf05148ca804f88be63f6e81cb00f2e24aa.tar.bz2 |
Improve tile painting prioritization to minimize stalled, blank tiles
bug:5320450
* Greedily deallocate textures from stolen tiles
* Force all prioritization values to be positive
* Create simply described prioritization ordering:
* Draw count
* Has front texture?
* position (if base tile)
Change-Id: Icd5dab931f735c14c18feef5186c8245c5956cfd
Diffstat (limited to 'Source/WebCore')
-rw-r--r-- | Source/WebCore/platform/graphics/android/PaintTileOperation.cpp | 32 | ||||
-rw-r--r-- | Source/WebCore/platform/graphics/android/TiledPage.cpp | 1 |
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; } |