diff options
author | Nicolas Roard <nicolasroard@google.com> | 2012-05-15 14:11:20 -0700 |
---|---|---|
committer | Nicolas Roard <nicolasroard@google.com> | 2012-05-16 18:46:20 -0700 |
commit | ed2ce36a1fac9f85b65edf34a1c241c2f73d806c (patch) | |
tree | cd96c66cb53e1cce08e4021f086ca1dfb102d4c8 /Source/WebCore/platform/graphics/android/rendering | |
parent | 7b17ee7dc951f404d93a458a61884d5c1bf6e40f (diff) | |
download | external_webkit-ed2ce36a1fac9f85b65edf34a1c241c2f73d806c.zip external_webkit-ed2ce36a1fac9f85b65edf34a1c241c2f73d806c.tar.gz external_webkit-ed2ce36a1fac9f85b65edf34a1c241c2f73d806c.tar.bz2 |
Allow more layers to be merged (merging fixed)
This will reduce the need to go to single surface rendering mode,
as well as improving jank by reducing the number of surfaces we need.
(tested on a set of popular sites, we now need up to 16 times less
surfaces, commonly 4-5 times less)
bug:5683630 bug:6499283 bug:6366440
Change-Id: I761c6a60279e5b21dca8bc1faccd956be58e3702
Diffstat (limited to 'Source/WebCore/platform/graphics/android/rendering')
5 files changed, 27 insertions, 7 deletions
diff --git a/Source/WebCore/platform/graphics/android/rendering/Surface.cpp b/Source/WebCore/platform/graphics/android/rendering/Surface.cpp index 2ec2659..7e4e918 100644 --- a/Source/WebCore/platform/graphics/android/rendering/Surface.cpp +++ b/Source/WebCore/platform/graphics/android/rendering/Surface.cpp @@ -226,19 +226,20 @@ void Surface::prepareGL(bool layerTilesDisabled, bool updateWithBlit) bool Surface::drawGL(bool layerTilesDisabled) { bool tilesDisabled = layerTilesDisabled && !isBase(); - if (!getFirstLayer()->visible()) + if (singleLayer() && !getFirstLayer()->visible()) return false; bool isBaseLayer = isBase() || getFirstLayer()->subclassType() == LayerAndroid::FixedBackgroundImageLayer || getFirstLayer()->subclassType() == LayerAndroid::ForegroundBaseLayer; - if (!isBaseLayer) { - // TODO: why are clipping regions wrong for base layer? - FloatRect drawClip = getFirstLayer()->drawClip(); - FloatRect clippingRect = TilesManager::instance()->shader()->rectInInvViewCoord(drawClip); - TilesManager::instance()->shader()->clip(clippingRect); + FloatRect drawClip = getFirstLayer()->drawClip(); + if (!singleLayer()) { + for (unsigned int i = 1; i < m_layers.size(); i++) + drawClip.unite(m_layers[i]->drawClip()); } + FloatRect clippingRect = TilesManager::instance()->shader()->rectInInvViewCoord(drawClip); + TilesManager::instance()->shader()->clip(clippingRect); bool askRedraw = false; if (m_surfaceBacking && !tilesDisabled) { diff --git a/Source/WebCore/platform/graphics/android/rendering/Surface.h b/Source/WebCore/platform/graphics/android/rendering/Surface.h index a79a286..7100125 100644 --- a/Source/WebCore/platform/graphics/android/rendering/Surface.h +++ b/Source/WebCore/platform/graphics/android/rendering/Surface.h @@ -93,7 +93,7 @@ public: LayerMergeState(Vector<Surface*>* const allGroups) : surfaceList(allGroups) , currentSurface(0) - , nonMergeNestedLevel(-1) // start at -1 to ignore first LayerAndroid's clipping + , nonMergeNestedLevel(0) , depth(0) {} diff --git a/Source/WebCore/platform/graphics/android/rendering/SurfaceCollection.cpp b/Source/WebCore/platform/graphics/android/rendering/SurfaceCollection.cpp index 3b6b306..7e5c2ca 100644 --- a/Source/WebCore/platform/graphics/android/rendering/SurfaceCollection.cpp +++ b/Source/WebCore/platform/graphics/android/rendering/SurfaceCollection.cpp @@ -238,4 +238,14 @@ void SurfaceCollection::updateLayerPositions(const SkRect& visibleContentRect) #endif } +int SurfaceCollection::backedSize() +{ + int count = 0; + for (unsigned int i = 0; i < m_surfaces.size(); i++) { + if (m_surfaces[i]->needsTexture()) + count++; + } + return count; +} + } // namespace WebCore diff --git a/Source/WebCore/platform/graphics/android/rendering/SurfaceCollection.h b/Source/WebCore/platform/graphics/android/rendering/SurfaceCollection.h index 5967c70..dfa37d6 100644 --- a/Source/WebCore/platform/graphics/android/rendering/SurfaceCollection.h +++ b/Source/WebCore/platform/graphics/android/rendering/SurfaceCollection.h @@ -66,6 +66,9 @@ public: bool hasCompositedAnimations(); void updateScrollableLayer(int layerId, int x, int y); + int size() { return m_surfaces.size(); } + int backedSize(); + private: void updateLayerPositions(const SkRect& visibleContentRect); BaseLayerAndroid* m_compositedRoot; diff --git a/Source/WebCore/platform/graphics/android/rendering/SurfaceCollectionManager.cpp b/Source/WebCore/platform/graphics/android/rendering/SurfaceCollectionManager.cpp index 7c42bd9..e2ac011 100644 --- a/Source/WebCore/platform/graphics/android/rendering/SurfaceCollectionManager.cpp +++ b/Source/WebCore/platform/graphics/android/rendering/SurfaceCollectionManager.cpp @@ -255,6 +255,12 @@ int SurfaceCollectionManager::drawGL(double currentTime, IntRect& viewRect, GLUtils::clearBackgroundIfOpaque(&background); } +#ifdef DEBUG + ALOGV("Drawing %d / %d surfaces", + m_drawingCollection ? m_drawingCollection->backedSize() : -1, + m_drawingCollection ? m_drawingCollection->size() : -1); +#endif + if (m_drawingCollection && m_drawingCollection->drawGL(visibleContentRect)) returnFlags |= uirenderer::DrawGlInfo::kStatusDraw; |