Diff
Modified: trunk/Source/WebCore/ChangeLog (106288 => 106289)
--- trunk/Source/WebCore/ChangeLog 2012-01-30 22:07:23 UTC (rev 106288)
+++ trunk/Source/WebCore/ChangeLog 2012-01-30 22:10:07 UTC (rev 106289)
@@ -1,3 +1,34 @@
+2012-01-30 Adrienne Walker <[email protected]>
+
+ [chromium] Always pre-reserve scrollbar and scroll corner textures
+ https://bugs.webkit.org/show_bug.cgi?id=77251
+
+ Reviewed by James Robinson.
+
+ Add a flag to LayerChromium that says that a layer's textures should
+ always be reserved. Prior to painting layers, find all layers marked
+ as such and reserve their textures. This will prevent texture memory
+ limits from being hit before the root layer's scrollbars are reserved
+ and painted.
+
+ * platform/graphics/chromium/LayerChromium.cpp:
+ (WebCore::LayerChromium::LayerChromium):
+ * platform/graphics/chromium/LayerChromium.h:
+ (LayerChromium):
+ (WebCore::LayerChromium::reserveTextures):
+ (WebCore::LayerChromium::setAlwaysReserveTextures):
+ (WebCore::LayerChromium::alwaysReserveTextures):
+ * platform/graphics/chromium/TiledLayerChromium.cpp:
+ (WebCore::TiledLayerChromium::reserveTextures):
+ * platform/graphics/chromium/TiledLayerChromium.h:
+ ():
+ * platform/graphics/chromium/cc/CCLayerTreeHost.cpp:
+ (WebCore::CCLayerTreeHost::updateLayers):
+ (WebCore::CCLayerTreeHost::reserveTextures):
+ (WebCore):
+ * platform/graphics/chromium/cc/CCLayerTreeHost.h:
+ ():
+
2012-01-30 Beth Dakin <[email protected]>
Speculative 32-bit build-fix.
Modified: trunk/Source/WebCore/platform/graphics/chromium/LayerChromium.cpp (106288 => 106289)
--- trunk/Source/WebCore/platform/graphics/chromium/LayerChromium.cpp 2012-01-30 22:07:23 UTC (rev 106288)
+++ trunk/Source/WebCore/platform/graphics/chromium/LayerChromium.cpp 2012-01-30 22:10:07 UTC (rev 106289)
@@ -72,6 +72,7 @@
, m_usesLayerClipping(false)
, m_isNonCompositedContent(false)
, m_preserves3D(false)
+ , m_alwaysReserveTextures(false)
, m_replicaLayer(0)
, m_drawOpacity(0)
, m_targetRenderSurface(0)
Modified: trunk/Source/WebCore/platform/graphics/chromium/LayerChromium.h (106288 => 106289)
--- trunk/Source/WebCore/platform/graphics/chromium/LayerChromium.h 2012-01-30 22:07:23 UTC (rev 106288)
+++ trunk/Source/WebCore/platform/graphics/chromium/LayerChromium.h 2012-01-30 22:10:07 UTC (rev 106289)
@@ -197,6 +197,12 @@
CCLayerTreeHost* layerTreeHost() const { return m_layerTreeHost.get(); }
+ // Reserve any textures needed for this layer.
+ virtual void reserveTextures() { }
+
+ void setAlwaysReserveTextures(bool alwaysReserveTextures) { m_alwaysReserveTextures = alwaysReserveTextures; }
+ bool alwaysReserveTextures() const { return m_alwaysReserveTextures; }
+
protected:
LayerChromium();
@@ -264,6 +270,7 @@
bool m_usesLayerClipping;
bool m_isNonCompositedContent;
bool m_preserves3D;
+ bool m_alwaysReserveTextures;
TransformationMatrix m_transform;
TransformationMatrix m_sublayerTransform;
Modified: trunk/Source/WebCore/platform/graphics/chromium/TiledLayerChromium.cpp (106288 => 106289)
--- trunk/Source/WebCore/platform/graphics/chromium/TiledLayerChromium.cpp 2012-01-30 22:07:23 UTC (rev 106288)
+++ trunk/Source/WebCore/platform/graphics/chromium/TiledLayerChromium.cpp 2012-01-30 22:10:07 UTC (rev 106289)
@@ -451,7 +451,32 @@
}
}
+void TiledLayerChromium::reserveTextures()
+{
+ updateBounds();
+ const IntRect& layerRect = visibleLayerRect();
+ if (layerRect.isEmpty() || !m_tiler->numTiles())
+ return;
+
+ int left, top, right, bottom;
+ m_tiler->layerRectToTileIndices(layerRect, left, top, right, bottom);
+
+ for (int j = top; j <= bottom; ++j) {
+ for (int i = left; i <= right; ++i) {
+ UpdatableTile* tile = tileAt(i, j);
+ if (!tile)
+ tile = createTile(i, j);
+
+ if (!tile->managedTexture()->isValid(m_tiler->tileSize(), m_textureFormat))
+ tile->m_dirtyRect = m_tiler->tileRect(tile);
+
+ if (!tile->managedTexture()->reserve(m_tiler->tileSize(), m_textureFormat))
+ return;
+ }
+ }
+}
+
void TiledLayerChromium::prepareToUpdate(const IntRect& layerRect)
{
m_skipsDraw = false;
Modified: trunk/Source/WebCore/platform/graphics/chromium/TiledLayerChromium.h (106288 => 106289)
--- trunk/Source/WebCore/platform/graphics/chromium/TiledLayerChromium.h 2012-01-30 22:07:23 UTC (rev 106288)
+++ trunk/Source/WebCore/platform/graphics/chromium/TiledLayerChromium.h 2012-01-30 22:10:07 UTC (rev 106289)
@@ -61,6 +61,8 @@
// recycled by the texture manager.
void protectTileTextures(const IntRect& layerRect);
+ virtual void reserveTextures();
+
protected:
TiledLayerChromium();
Modified: trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.cpp (106288 => 106289)
--- trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.cpp 2012-01-30 22:07:23 UTC (rev 106288)
+++ trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.cpp 2012-01-30 22:10:07 UTC (rev 106289)
@@ -379,6 +379,8 @@
CCLayerTreeHostCommon::calculateDrawTransformsAndVisibility(rootLayer, rootLayer, identityMatrix, identityMatrix, m_updateList, rootRenderSurface->layerList(), layerRendererCapabilities().maxTextureSize);
}
+ reserveTextures();
+
paintLayerContents(m_updateList, PaintVisible);
if (!m_triggerIdlePaints)
return;
@@ -397,6 +399,19 @@
m_contentsTextureManager->setMaxMemoryLimitBytes(maxLimitBytes);
}
+void CCLayerTreeHost::reserveTextures()
+{
+ // Use BackToFront since it's cheap and this isn't order-dependent.
+ typedef CCLayerIterator<LayerChromium, RenderSurfaceChromium, CCLayerIteratorActions::BackToFront> CCLayerIteratorType;
+
+ CCLayerIteratorType end = CCLayerIteratorType::end(&m_updateList);
+ for (CCLayerIteratorType it = CCLayerIteratorType::begin(&m_updateList); it != end; ++it) {
+ if (it.representsTargetRenderSurface() || !it->alwaysReserveTextures())
+ continue;
+ it->reserveTextures();
+ }
+}
+
// static
void CCLayerTreeHost::paintContentsIfDirty(LayerChromium* layer, PaintType paintType)
{
Modified: trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.h (106288 => 106289)
--- trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.h 2012-01-30 22:07:23 UTC (rev 106288)
+++ trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.h 2012-01-30 22:10:07 UTC (rev 106289)
@@ -210,6 +210,8 @@
void paintMaskAndReplicaForRenderSurface(LayerChromium*, PaintType);
void updateLayers(LayerChromium*);
+ // Pre-reserve textures for any layer marked "always reserve textures"
+ void reserveTextures();
void clearPendingUpdate();
int m_compositorIdentifier;
Modified: trunk/Source/WebKit/chromium/ChangeLog (106288 => 106289)
--- trunk/Source/WebKit/chromium/ChangeLog 2012-01-30 22:07:23 UTC (rev 106288)
+++ trunk/Source/WebKit/chromium/ChangeLog 2012-01-30 22:10:07 UTC (rev 106289)
@@ -1,3 +1,15 @@
+2012-01-30 Adrienne Walker <[email protected]>
+
+ [chromium] Always pre-reserve scrollbar and scroll corner textures
+ https://bugs.webkit.org/show_bug.cgi?id=77251
+
+ Reviewed by James Robinson.
+
+ * src/NonCompositedContentHost.cpp:
+ (WebKit::reserveScrollbarLayers):
+ (WebKit):
+ (WebKit::NonCompositedContentHost::setViewport):
+
2012-01-30 Ryosuke Niwa <[email protected]>
Roll Chromium DEPS from 119623 to 119700.
Modified: trunk/Source/WebKit/chromium/src/NonCompositedContentHost.cpp (106288 => 106289)
--- trunk/Source/WebKit/chromium/src/NonCompositedContentHost.cpp 2012-01-30 22:07:23 UTC (rev 106288)
+++ trunk/Source/WebKit/chromium/src/NonCompositedContentHost.cpp 2012-01-30 22:10:07 UTC (rev 106289)
@@ -78,6 +78,20 @@
ASSERT(scrollLayer());
}
+static void reserveScrollbarLayers(WebCore::LayerChromium* layer, WebCore::LayerChromium* clipLayer)
+{
+ // Scrollbars and corners are known to be attached outside the root clip
+ // rect, so skip the clipLayer subtree.
+ if (layer == clipLayer)
+ return;
+
+ for (size_t i = 0; i < layer->children().size(); ++i)
+ reserveScrollbarLayers(layer->children()[i].get(), clipLayer);
+
+ if (layer->drawsContent())
+ layer->setAlwaysReserveTextures(true);
+}
+
void NonCompositedContentHost::setViewport(const WebCore::IntSize& viewportSize, const WebCore::IntSize& contentsSize, const WebCore::IntPoint& scrollPosition, float pageScale, int layerAdjustX)
{
if (!scrollLayer())
@@ -106,6 +120,12 @@
if (m_graphicsLayer->pageScaleFactor() != pageScale)
m_graphicsLayer->deviceOrPageScaleFactorChanged();
+
+ WebCore::LayerChromium* clipLayer = scrollLayer()->parent();
+ WebCore::LayerChromium* rootLayer = clipLayer;
+ while (rootLayer->parent())
+ rootLayer = rootLayer->parent();
+ reserveScrollbarLayers(rootLayer, clipLayer);
}
WebCore::LayerChromium* NonCompositedContentHost::scrollLayer()