summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Craik <ccraik@google.com>2011-09-19 15:27:48 -0700
committerBart Sears <bsears@google.com>2011-09-19 17:58:12 -0700
commitd6b2e6954f8448ca1940a17a9f891cd1e6032f2c (patch)
tree0de083a25696f86f8eb31fc73e4af0d3597f648c
parent541681581f45b3bee31c3ad44ff52642ed7e9ab5 (diff)
downloadexternal_webkit-d6b2e6954f8448ca1940a17a9f891cd1e6032f2c.zip
external_webkit-d6b2e6954f8448ca1940a17a9f891cd1e6032f2c.tar.gz
external_webkit-d6b2e6954f8448ca1940a17a9f891cd1e6032f2c.tar.bz2
Cherry-pick "Fix missing tiles" from master - do not merge
bug:5288530 Fix issue where stealing a back texture from a tile (while the tile was ready to swap) wouldn't mark tile as dirty. Now, mark tile dirty whenever texture is stolen from it, and avoid trying to steal busy textures. Cherry-pick of CL: 6aa089bded6a1abbf8d61264588e1e3a32be31b3 Change-Id: Iacbda17ba4b4c6382ceb1c84a6e5f02e609a76a5
-rw-r--r--Source/WebCore/platform/graphics/android/BaseTile.cpp20
-rw-r--r--Source/WebCore/platform/graphics/android/TilesManager.cpp24
2 files changed, 28 insertions, 16 deletions
diff --git a/Source/WebCore/platform/graphics/android/BaseTile.cpp b/Source/WebCore/platform/graphics/android/BaseTile.cpp
index dc17a21..a4ce788 100644
--- a/Source/WebCore/platform/graphics/android/BaseTile.cpp
+++ b/Source/WebCore/platform/graphics/android/BaseTile.cpp
@@ -135,13 +135,12 @@ void BaseTile::reserveTexture()
if (texture && m_backTexture != texture) {
m_swapDrawCount = 0; // no longer ready to swap
m_backTexture = texture;
-
- // this is to catch when the front texture is stolen from beneath us. We
- // should refine the stealing method to be simpler, and not require last
- // moment checks like this
- if (!m_frontTexture)
- m_dirty = true;
}
+
+ // a texture reservation will only happen if we're dirty, or ready to
+ // swap. if it's the former, ensure it's marked dirty.
+ if (!m_swapDrawCount)
+ m_dirty = true;
}
bool BaseTile::removeTexture(BaseTileTexture* texture)
@@ -150,12 +149,15 @@ bool BaseTile::removeTexture(BaseTileTexture* texture)
this, m_backTexture, m_frontTexture, m_page);
// We update atomically, so paintBitmap() can see the correct value
android::AutoMutex lock(m_atomicSync);
- if (m_frontTexture == texture) {
+ if (m_frontTexture == texture)
m_frontTexture = 0;
- m_dirty = true;
- }
if (m_backTexture == texture)
m_backTexture = 0;
+
+ // mark dirty regardless of which texture was taken - the back texture may
+ // have been ready to swap
+ m_dirty = true;
+
return true;
}
diff --git a/Source/WebCore/platform/graphics/android/TilesManager.cpp b/Source/WebCore/platform/graphics/android/TilesManager.cpp
index ee35ce2..e1d7665 100644
--- a/Source/WebCore/platform/graphics/android/TilesManager.cpp
+++ b/Source/WebCore/platform/graphics/android/TilesManager.cpp
@@ -267,11 +267,13 @@ BaseTileTexture* TilesManager::getAvailableTexture(BaseTile* owner)
}
// The heuristic for selecting a texture is as follows:
- // 1. If a tile isn't owned, break with that one
- // 2. Don't let tiles acquire their front textures
- // 3. If we find a tile in the same page with a different scale,
+ // 1. Skip textures currently being painted, they can't be painted while
+ // busy anyway
+ // 2. If a tile isn't owned, break with that one
+ // 3. Don't let tiles acquire their front textures
+ // 4. If we find a tile in the same page with a different scale,
// it's old and not visible. Break with that one
- // 4. Otherwise, use the least recently prepared tile, but ignoring tiles
+ // 5. Otherwise, use the least recently prepared tile, but ignoring tiles
// drawn in the last frame to avoid flickering
BaseTileTexture* farthestTexture = 0;
@@ -280,15 +282,23 @@ BaseTileTexture* TilesManager::getAvailableTexture(BaseTile* owner)
for (unsigned int i = 0; i < max; i++) {
BaseTileTexture* texture = (*availableTexturePool)[i];
TextureOwner* currentOwner = texture->owner();
+
+ if (texture->busy()) {
+ // don't bother, since the acquire() will likely fail
+ continue;
+ }
+
if (!currentOwner) {
+ // unused texture! take it!
farthestTexture = texture;
break;
}
- // Don't let a tile acquire its own front texture, as the acquisition
- // logic doesn't handle that
- if (currentOwner == owner)
+ if (currentOwner == owner) {
+ // Don't let a tile acquire its own front texture, as the
+ // acquisition logic doesn't handle that
continue;
+ }
if (currentOwner->page() == owner->page() && texture->scale() != owner->scale()) {
// if we render the back page with one scale, then another while