diff options
author | Nicolas Roard <nicolasroard@google.com> | 2012-05-17 17:32:25 -0700 |
---|---|---|
committer | Nicolas Roard <nicolasroard@google.com> | 2012-05-17 18:01:19 -0700 |
commit | 377dc9f6b46a2ac0f968d9ee8d3c7916f3bf6904 (patch) | |
tree | 518fb21355b3530d6cdd18e3c6303348ee5501c0 /Source/WebCore | |
parent | 37df6b06a8481e3608cff1718038d353a8733d6c (diff) | |
download | external_webkit-377dc9f6b46a2ac0f968d9ee8d3c7916f3bf6904.zip external_webkit-377dc9f6b46a2ac0f968d9ee8d3c7916f3bf6904.tar.gz external_webkit-377dc9f6b46a2ac0f968d9ee8d3c7916f3bf6904.tar.bz2 |
Fix invalidations sent to framework
bug:6479200 bug:6323847 bug:4124445
Change-Id: I1a4058ba6c69d3e285b6274d99a6eafcbf1cdc6f
Diffstat (limited to 'Source/WebCore')
12 files changed, 57 insertions, 19 deletions
diff --git a/Source/WebCore/platform/graphics/android/GLWebViewState.cpp b/Source/WebCore/platform/graphics/android/GLWebViewState.cpp index f6be593..4440912 100644 --- a/Source/WebCore/platform/graphics/android/GLWebViewState.cpp +++ b/Source/WebCore/platform/graphics/android/GLWebViewState.cpp @@ -64,6 +64,7 @@ using namespace android::uirenderer; GLWebViewState::GLWebViewState() : m_frameworkLayersInval(0, 0, 0, 0) + , m_doFrameworkFullInval(false) , m_isScrolling(false) , m_isVisibleContentRectScrolling(false) , m_goingDown(true) @@ -194,6 +195,12 @@ void GLWebViewState::resetLayersDirtyArea() m_frameworkLayersInval.setY(0); m_frameworkLayersInval.setWidth(0); m_frameworkLayersInval.setHeight(0); + m_doFrameworkFullInval = false; +} + +void GLWebViewState::doFrameworkFullInval() +{ + m_doFrameworkFullInval = true; } double GLWebViewState::setupDrawing(const IntRect& invScreenRect, @@ -383,7 +390,7 @@ int GLWebViewState::drawGL(IntRect& invScreenRect, SkRect& visibleContentRect, // returnFlags & kStatusDraw && empty inval region means we've inval'd everything, // but don't have new content. Keep redrawing full view (0,0,0,0) // until tile generation catches up and we swap pages. - bool fullScreenInval = m_frameworkLayersInval.isEmpty(); + bool fullScreenInval = m_frameworkLayersInval.isEmpty() || m_doFrameworkFullInval; if (!fullScreenInval) { m_frameworkLayersInval.inflate(1); diff --git a/Source/WebCore/platform/graphics/android/GLWebViewState.h b/Source/WebCore/platform/graphics/android/GLWebViewState.h index 7892e83..b643405 100644 --- a/Source/WebCore/platform/graphics/android/GLWebViewState.h +++ b/Source/WebCore/platform/graphics/android/GLWebViewState.h @@ -189,6 +189,7 @@ public: void addDirtyArea(const IntRect& rect); void resetLayersDirtyArea(); + void doFrameworkFullInval(); bool goingDown() { return m_goingDown; } bool goingLeft() { return m_goingLeft; } @@ -219,6 +220,7 @@ private: SkRect m_visibleContentRect; IntRect m_frameworkLayersInval; + bool m_doFrameworkFullInval; #ifdef MEASURES_PERF unsigned int m_totalTimeCounter; diff --git a/Source/WebCore/platform/graphics/android/layers/LayerAndroid.cpp b/Source/WebCore/platform/graphics/android/layers/LayerAndroid.cpp index 7a25e7f..95e6825 100644 --- a/Source/WebCore/platform/graphics/android/layers/LayerAndroid.cpp +++ b/Source/WebCore/platform/graphics/android/layers/LayerAndroid.cpp @@ -273,6 +273,11 @@ void LayerAndroid::initAnimations() { void LayerAndroid::addDirtyArea() { + if (m_drawTransform.hasPerspective()) { + state()->doFrameworkFullInval(); + return; + } + IntSize layerSize(getSize().width(), getSize().height()); FloatRect area = @@ -816,12 +821,10 @@ bool LayerAndroid::drawGL(bool layerTilesDisabled) bool askScreenUpdate = false; m_atomicSync.lock(); - if (m_hasRunningAnimations || m_drawTransform.hasPerspective()) { + if (m_hasRunningAnimations) askScreenUpdate = true; - addDirtyArea(); - } - m_atomicSync.unlock(); + return askScreenUpdate; } diff --git a/Source/WebCore/platform/graphics/android/rendering/Surface.cpp b/Source/WebCore/platform/graphics/android/rendering/Surface.cpp index 7e4e918..20a9c2b 100644 --- a/Source/WebCore/platform/graphics/android/rendering/Surface.cpp +++ b/Source/WebCore/platform/graphics/android/rendering/Surface.cpp @@ -253,8 +253,12 @@ bool Surface::drawGL(bool layerTilesDisabled) } // draw member layers (draws image textures, glextras) - for (unsigned int i = 0; i < m_layers.size(); i++) - askRedraw |= m_layers[i]->drawGL(tilesDisabled); + for (unsigned int i = 0; i < m_layers.size(); i++) { + if (m_layers[i]->drawGL(tilesDisabled)) { + m_layers[i]->addDirtyArea(); + askRedraw = true; + } + } return askRedraw; } @@ -264,7 +268,16 @@ void Surface::swapTiles() if (!m_surfaceBacking) return; - m_surfaceBacking->swapTiles(); + if (m_surfaceBacking->swapTiles()) + addFrameworkInvals(); +} + +void Surface::addFrameworkInvals() +{ + // Let's return an inval area to framework that will + // contain all of our layers' areas + for (unsigned int i = 0; i < m_layers.size(); i++) + m_layers[i]->addDirtyArea(); } bool Surface::isReady() diff --git a/Source/WebCore/platform/graphics/android/rendering/Surface.h b/Source/WebCore/platform/graphics/android/rendering/Surface.h index 7100125..0286259 100644 --- a/Source/WebCore/platform/graphics/android/rendering/Surface.h +++ b/Source/WebCore/platform/graphics/android/rendering/Surface.h @@ -52,6 +52,7 @@ public: void prepareGL(bool layerTilesDisabled, bool updateWithBlit); bool drawGL(bool layerTilesDisabled); void swapTiles(); + void addFrameworkInvals(); bool isReady(); bool isMissingContent(); bool canUpdateWithBlit(); diff --git a/Source/WebCore/platform/graphics/android/rendering/SurfaceBacking.cpp b/Source/WebCore/platform/graphics/android/rendering/SurfaceBacking.cpp index af96560..78a9861 100644 --- a/Source/WebCore/platform/graphics/android/rendering/SurfaceBacking.cpp +++ b/Source/WebCore/platform/graphics/android/rendering/SurfaceBacking.cpp @@ -146,11 +146,12 @@ void SurfaceBacking::markAsDirty(const SkRegion& dirtyArea) m_lowResTileGrid->markAsDirty(dirtyArea); } -void SurfaceBacking::swapTiles() +bool SurfaceBacking::swapTiles() { - m_backTileGrid->swapTiles(); - m_frontTileGrid->swapTiles(); - m_lowResTileGrid->swapTiles(); + bool swap = m_backTileGrid->swapTiles(); + swap |= m_frontTileGrid->swapTiles(); + swap |= m_lowResTileGrid->swapTiles(); + return swap; } void SurfaceBacking::computeTexturesAmount(TexturesResult* result, LayerAndroid* layer) diff --git a/Source/WebCore/platform/graphics/android/rendering/SurfaceBacking.h b/Source/WebCore/platform/graphics/android/rendering/SurfaceBacking.h index 7d3e93c..137a25b 100644 --- a/Source/WebCore/platform/graphics/android/rendering/SurfaceBacking.h +++ b/Source/WebCore/platform/graphics/android/rendering/SurfaceBacking.h @@ -44,7 +44,7 @@ public: const IntRect& prepareArea, const IntRect& fullContentArea, TilePainter* painter, bool aggressiveRendering, bool updateWithBlit); - void swapTiles(); + bool swapTiles(); void drawGL(const IntRect& visibleContentArea, float opacity, const TransformationMatrix* transform, bool aggressiveRendering, const Color* background); diff --git a/Source/WebCore/platform/graphics/android/rendering/SurfaceCollection.cpp b/Source/WebCore/platform/graphics/android/rendering/SurfaceCollection.cpp index f3415af..77b238e 100644 --- a/Source/WebCore/platform/graphics/android/rendering/SurfaceCollection.cpp +++ b/Source/WebCore/platform/graphics/android/rendering/SurfaceCollection.cpp @@ -139,6 +139,12 @@ void SurfaceCollection::swapTiles() m_surfaces[i]->swapTiles(); } +void SurfaceCollection::addFrameworkInvals() +{ + for (unsigned int i = 0; i < m_surfaces.size(); i++) + m_surfaces[i]->addFrameworkInvals(); +} + bool SurfaceCollection::isReady() { // Override layer readiness check for single surface mode diff --git a/Source/WebCore/platform/graphics/android/rendering/SurfaceCollection.h b/Source/WebCore/platform/graphics/android/rendering/SurfaceCollection.h index b502142..5eb5d65 100644 --- a/Source/WebCore/platform/graphics/android/rendering/SurfaceCollection.h +++ b/Source/WebCore/platform/graphics/android/rendering/SurfaceCollection.h @@ -52,6 +52,7 @@ public: bool drawGL(const SkRect& visibleContentRect); Color getBackgroundColor(); void swapTiles(); + void addFrameworkInvals(); bool isReady(); bool isBaseSurfaceReady(); bool isMissingBackgroundContent(); diff --git a/Source/WebCore/platform/graphics/android/rendering/SurfaceCollectionManager.cpp b/Source/WebCore/platform/graphics/android/rendering/SurfaceCollectionManager.cpp index b4fd699..5abca02 100644 --- a/Source/WebCore/platform/graphics/android/rendering/SurfaceCollectionManager.cpp +++ b/Source/WebCore/platform/graphics/android/rendering/SurfaceCollectionManager.cpp @@ -68,12 +68,14 @@ void SurfaceCollectionManager::swap() // if we have a drawing collection, discard it since the painting collection is done if (m_drawingCollection) { ALOGV("destroying drawing collection %p", m_drawingCollection); + m_drawingCollection->addFrameworkInvals(); SkSafeUnref(m_drawingCollection); } // painting collection becomes the drawing collection ALOGV("drawing collection %p", m_paintingCollection); m_paintingCollection->setIsDrawing(); // initialize animations + m_paintingCollection->addFrameworkInvals(); if (m_queuedCollection) { // start painting with the queued collection @@ -203,6 +205,10 @@ int SurfaceCollectionManager::drawGL(double currentTime, IntRect& viewRect, m_drawingCollection, m_paintingCollection, m_queuedCollection, m_fastSwapMode, shouldDraw); + // ask for kStatusInvoke while painting, kStatusDraw if we have content to be redrawn next frame + // returning 0 indicates all painting complete, no framework inval needed. + int returnFlags = 0; + bool didCollectionSwap = false; if (m_paintingCollection) { ALOGV("preparing painting collection %p", m_paintingCollection); @@ -222,6 +228,7 @@ int SurfaceCollectionManager::drawGL(double currentTime, IntRect& viewRect, if (newCollectionHasAnimPtr) *newCollectionHasAnimPtr = m_paintingCollection->hasCompositedAnimations(); swap(); + returnFlags |= uirenderer::DrawGlInfo::kStatusDraw; } } else if (m_drawingCollection) { ALOGV("preparing drawing collection %p", m_drawingCollection); @@ -229,10 +236,6 @@ int SurfaceCollectionManager::drawGL(double currentTime, IntRect& viewRect, m_drawingCollection->computeTexturesAmount(texturesResultPtr); } - // ask for kStatusInvoke while painting, kStatusDraw if we have content to be redrawn next frame - // returning 0 indicates all painting complete, no framework inval needed. - int returnFlags = 0; - if (m_paintingCollection) returnFlags |= DrawGlInfo::kStatusInvoke; diff --git a/Source/WebCore/platform/graphics/android/rendering/TileGrid.cpp b/Source/WebCore/platform/graphics/android/rendering/TileGrid.cpp index 3487acd..9cd904e 100644 --- a/Source/WebCore/platform/graphics/android/rendering/TileGrid.cpp +++ b/Source/WebCore/platform/graphics/android/rendering/TileGrid.cpp @@ -97,13 +97,14 @@ bool TileGrid::isMissingContent() return false; } -void TileGrid::swapTiles() +bool TileGrid::swapTiles() { int swaps = 0; for (unsigned int i = 0; i < m_tiles.size(); i++) if (m_tiles[i]->swapTexturesIfNeeded()) swaps++; ALOGV("TG %p swapping, swaps = %d", this, swaps); + return swaps != 0; } IntRect TileGrid::computeTilesArea(const IntRect& contentArea, float scale) diff --git a/Source/WebCore/platform/graphics/android/rendering/TileGrid.h b/Source/WebCore/platform/graphics/android/rendering/TileGrid.h index b480419..665f4ec 100644 --- a/Source/WebCore/platform/graphics/android/rendering/TileGrid.h +++ b/Source/WebCore/platform/graphics/android/rendering/TileGrid.h @@ -52,7 +52,7 @@ public: const IntRect& prepareArea, const IntRect& fullContentArea, TilePainter* painter, int regionFlags = StandardRegion, bool isLowResPrefetch = false, bool updateWithBlit = false); - void swapTiles(); + bool swapTiles(); void drawGL(const IntRect& visibleContentArea, float opacity, const TransformationMatrix* transform, const Color* background = 0); |