diff options
author | Chris Craik <ccraik@google.com> | 2011-09-08 14:09:43 -0700 |
---|---|---|
committer | The Android Automerger <android-build@android.com> | 2011-09-09 13:33:55 -0700 |
commit | ab3edbf9489b21b337a378b88850f06fbdd7d8f8 (patch) | |
tree | 6d798e6c941c0e5dacf25bb16ac7d00c08797417 | |
parent | 3a38386b884b7c6470d5bfb9d63bc77744698a31 (diff) | |
download | external_webkit-ab3edbf9489b21b337a378b88850f06fbdd7d8f8.zip external_webkit-ab3edbf9489b21b337a378b88850f06fbdd7d8f8.tar.gz external_webkit-ab3edbf9489b21b337a378b88850f06fbdd7d8f8.tar.bz2 |
Stop layer tile flickering
bug:5265207
Don't steal textures with a draw count from last frame to prevent flickering
Change-Id: I0a37b2417f0721b150b47920feea9ddb1666ec28
-rw-r--r-- | Source/WebCore/platform/graphics/android/TilesManager.cpp | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/Source/WebCore/platform/graphics/android/TilesManager.cpp b/Source/WebCore/platform/graphics/android/TilesManager.cpp index 2c263e3..8b6566a 100644 --- a/Source/WebCore/platform/graphics/android/TilesManager.cpp +++ b/Source/WebCore/platform/graphics/android/TilesManager.cpp @@ -235,10 +235,11 @@ BaseTileTexture* TilesManager::getAvailableTexture(BaseTile* owner) // 1. If a tile isn't owned, break with that one // 2. If we find a tile in the same page with a different scale, // it's old and not visible. Break with that one - // 3. Otherwise, use the least recently prepared tile + // 3. Otherwise, use the least recently prepared tile, but ignoring tiles + // drawn in the last frame to avoid flickering BaseTileTexture* farthestTexture = 0; - unsigned long long oldestDrawCount = ~0; //maximum u64 + unsigned long long oldestDrawCount = getDrawGLCount() - 1; const unsigned int max = availableTexturePool->size(); for (unsigned int i = 0; i < max; i++) { BaseTileTexture* texture = (*availableTexturePool)[i]; @@ -263,16 +264,18 @@ BaseTileTexture* TilesManager::getAvailableTexture(BaseTile* owner) } } - TextureOwner* previousOwner = farthestTexture->owner(); - if (farthestTexture && farthestTexture->acquire(owner)) { - if (previousOwner) { - XLOG("%s texture %p stolen from tile %d, %d, drawCount was %llu", - owner->isLayerTile() ? "LAYER" : "BASE", - farthestTexture, owner->x(), owner->y(), oldestDrawCount); + if (farthestTexture) { + TextureOwner* previousOwner = farthestTexture->owner(); + if (farthestTexture->acquire(owner)) { + if (previousOwner) { + XLOG("%s texture %p stolen from tile %d, %d, drawCount was %llu", + owner->isLayerTile() ? "LAYER" : "BASE", + farthestTexture, owner->x(), owner->y(), oldestDrawCount); + } + + availableTexturePool->remove(availableTexturePool->find(farthestTexture)); + return farthestTexture; } - - availableTexturePool->remove(availableTexturePool->find(farthestTexture)); - return farthestTexture; } XLOG("Couldn't find an available texture for tile %x (%d, %d) out of %d available!!!", |