summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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