summaryrefslogtreecommitdiffstats
path: root/Source/WebCore/platform/graphics/android/rendering/TilesManager.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Source/WebCore/platform/graphics/android/rendering/TilesManager.cpp')
-rw-r--r--Source/WebCore/platform/graphics/android/rendering/TilesManager.cpp52
1 files changed, 45 insertions, 7 deletions
diff --git a/Source/WebCore/platform/graphics/android/rendering/TilesManager.cpp b/Source/WebCore/platform/graphics/android/rendering/TilesManager.cpp
index 0b4ba7b..aa18898 100644
--- a/Source/WebCore/platform/graphics/android/rendering/TilesManager.cpp
+++ b/Source/WebCore/platform/graphics/android/rendering/TilesManager.cpp
@@ -57,7 +57,7 @@
// number to cap the layer tile texturs, it worked on both phones and tablets.
// TODO: after merge the pool of base tiles and layer tiles, we should revisit
// the logic of allocation management.
-#define MAX_TEXTURE_ALLOCATION ((6+TILE_PREFETCH_DISTANCE*2)*(5+TILE_PREFETCH_DISTANCE*2)*4)
+#define MAX_TEXTURE_ALLOCATION ((10+TILE_PREFETCH_DISTANCE*2)*(7+TILE_PREFETCH_DISTANCE*2)*4)
#define TILE_WIDTH 256
#define TILE_HEIGHT 256
@@ -65,6 +65,10 @@
#define LAYER_TEXTURES_DESTROY_TIMEOUT 60 // If we do not need layers for 60 seconds, free the textures
+// Eventually this should be dynamically be determined, and smart scheduling
+// between the generators should be implemented
+#define NUM_TEXTURES_GENERATORS 1
+
namespace WebCore {
int TilesManager::getMaxTextureAllocation()
@@ -101,14 +105,25 @@ TilesManager::TilesManager()
, m_eglContext(EGL_NO_CONTEXT)
{
ALOGV("TilesManager ctor");
- m_textures.reserveCapacity(MAX_TEXTURE_ALLOCATION);
- m_availableTextures.reserveCapacity(MAX_TEXTURE_ALLOCATION);
- m_tilesTextures.reserveCapacity(MAX_TEXTURE_ALLOCATION);
- m_availableTilesTextures.reserveCapacity(MAX_TEXTURE_ALLOCATION);
- m_pixmapsGenerationThread = new TexturesGenerator(this);
- m_pixmapsGenerationThread->run("TexturesGenerator");
+ m_textures.reserveCapacity(MAX_TEXTURE_ALLOCATION / 2);
+ m_availableTextures.reserveCapacity(MAX_TEXTURE_ALLOCATION / 2);
+ m_tilesTextures.reserveCapacity(MAX_TEXTURE_ALLOCATION / 2);
+ m_availableTilesTextures.reserveCapacity(MAX_TEXTURE_ALLOCATION / 2);
+
+ m_textureGenerators = new sp<TexturesGenerator>[NUM_TEXTURES_GENERATORS];
+ for (int i = 0; i < NUM_TEXTURES_GENERATORS; i++) {
+ m_textureGenerators[i] = new TexturesGenerator(this);
+ ALOGD("Starting TG #%d, %p", i, m_textureGenerators[i].get());
+ m_textureGenerators[i]->run("TexturesGenerator");
+ }
+}
+
+TilesManager::~TilesManager()
+{
+ delete[] m_textureGenerators;
}
+
void TilesManager::allocateTextures()
{
int nbTexturesToAllocate = m_currentTextureCount - m_textures.size();
@@ -488,6 +503,29 @@ void TilesManager::updateTilesIfContextVerified()
return;
}
+void TilesManager::removeOperationsForFilter(OperationFilter* filter)
+{
+ for (int i = 0; i < NUM_TEXTURES_GENERATORS; i++)
+ m_textureGenerators[i]->removeOperationsForFilter(filter);
+ delete filter;
+}
+
+bool TilesManager::tryUpdateOperationWithPainter(Tile* tile, TilePainter* painter)
+{
+ for (int i = 0; i < NUM_TEXTURES_GENERATORS; i++) {
+ if (m_textureGenerators[i]->tryUpdateOperationWithPainter(tile, painter))
+ return true;
+ }
+ return false;
+}
+
+void TilesManager::scheduleOperation(QueuedOperation* operation)
+{
+ // TODO: painter awareness, store prefer awareness, store preferred thread into painter
+ m_scheduleThread = (m_scheduleThread + 1) % NUM_TEXTURES_GENERATORS;
+ m_textureGenerators[m_scheduleThread]->scheduleOperation(operation);
+}
+
int TilesManager::tileWidth()
{
return TILE_WIDTH;