summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorChris Craik <ccraik@google.com>2011-09-19 15:27:48 -0700
committerChris Craik <ccraik@google.com>2011-09-19 16:09:53 -0700
commit6aa089bded6a1abbf8d61264588e1e3a32be31b3 (patch)
tree0aa5ddfb8f47ceb13c903a7f9736d855ee65ebe0 /Source
parent5e590daf1c9d392d7d44a8881ac80f7f2adc68e1 (diff)
downloadexternal_webkit-6aa089bded6a1abbf8d61264588e1e3a32be31b3.zip
external_webkit-6aa089bded6a1abbf8d61264588e1e3a32be31b3.tar.gz
external_webkit-6aa089bded6a1abbf8d61264588e1e3a32be31b3.tar.bz2
Fix missing tiles
bug:5335634 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. Change-Id: Iacbda17ba4b4c6382ceb1c84a6e5f02e609a76a5
Diffstat (limited to 'Source')
-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