Title: [141232] trunk/Source
Revision
141232
Author
commit-qu...@webkit.org
Date
2013-01-30 00:22:57 -0800 (Wed, 30 Jan 2013)

Log Message

Coordinated Graphics: Remove m_pendingSyncBackingStores in LayerTreeRenderer.
https://bugs.webkit.org/show_bug.cgi?id=107099

Patch by Huang Dongsung <luxte...@company100.net> on 2013-01-30
Reviewed by Noam Rosenthal.

Source/WebCore:

Add GraphicsLayerTextureMapper::setBackingStore() so that
LayerTreeRenderer sets a backing store to GraphicsLayerTextureMapper.

Remove three methods of TextureMapperLayer related to a backing store
because they are no longer used.

Covered by existing compositing tests.

* platform/graphics/texmap/GraphicsLayerTextureMapper.cpp:
(WebCore::GraphicsLayerTextureMapper::flushCompositingStateForThisLayerOnly):
(WebCore::GraphicsLayerTextureMapper::prepareBackingStoreIfNeeded):
(WebCore):
(WebCore::GraphicsLayerTextureMapper::updateDebugBorderAndRepaintCount):
(WebCore::GraphicsLayerTextureMapper::updateBackingStoreIfNeeded):
(WebCore::GraphicsLayerTextureMapper::setBackingStore):
* platform/graphics/texmap/GraphicsLayerTextureMapper.h:
(GraphicsLayerTextureMapper):
* platform/graphics/texmap/TextureMapperLayer.cpp:
(WebCore::TextureMapperLayer::flushCompositingStateForThisLayerOnly):
* platform/graphics/texmap/TextureMapperLayer.h:
(TextureMapperLayer):

Source/WebKit2:

Instead of queuing the setting of backing stores in LayerTreeRenderer,
and then setting them directly to TextureMapperLayer, we allow
GraphicsLayerTextureMapper's existing queuing mechanism to handle that.
Instead of a m_pendingSyncBackingStores queue, we have a m_backingStores
queue which can be applied much more easily to the layer tree.

In addition, LayerTreeRenderer::purgeGLResources() does not call
TextureMapperLayer::clearBackingStoresRecursive() because
TextureMapperLayer will be destructed soon.

* UIProcess/CoordinatedGraphics/LayerTreeRenderer.cpp:
(WebKit::LayerTreeRenderer::deleteLayer):
(WebKit::LayerTreeRenderer::createBackingStoreIfNeeded):
(WebKit::LayerTreeRenderer::removeBackingStoreIfNeeded):
(WebKit::LayerTreeRenderer::resetBackingStoreSizeToLayerSize):
(WebKit::LayerTreeRenderer::createTile):
(WebKit::LayerTreeRenderer::removeTile):
(WebKit::LayerTreeRenderer::updateTile):
(WebKit::LayerTreeRenderer::commitPendingBackingStoreOperations):
(WebKit::LayerTreeRenderer::purgeGLResources):
* UIProcess/CoordinatedGraphics/LayerTreeRenderer.h:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (141231 => 141232)


--- trunk/Source/WebCore/ChangeLog	2013-01-30 08:22:46 UTC (rev 141231)
+++ trunk/Source/WebCore/ChangeLog	2013-01-30 08:22:57 UTC (rev 141232)
@@ -1,3 +1,32 @@
+2013-01-30  Huang Dongsung  <luxte...@company100.net>
+
+        Coordinated Graphics: Remove m_pendingSyncBackingStores in LayerTreeRenderer.
+        https://bugs.webkit.org/show_bug.cgi?id=107099
+
+        Reviewed by Noam Rosenthal.
+
+        Add GraphicsLayerTextureMapper::setBackingStore() so that
+        LayerTreeRenderer sets a backing store to GraphicsLayerTextureMapper.
+
+        Remove three methods of TextureMapperLayer related to a backing store
+        because they are no longer used.
+
+        Covered by existing compositing tests.
+
+        * platform/graphics/texmap/GraphicsLayerTextureMapper.cpp:
+        (WebCore::GraphicsLayerTextureMapper::flushCompositingStateForThisLayerOnly):
+        (WebCore::GraphicsLayerTextureMapper::prepareBackingStoreIfNeeded):
+        (WebCore):
+        (WebCore::GraphicsLayerTextureMapper::updateDebugBorderAndRepaintCount):
+        (WebCore::GraphicsLayerTextureMapper::updateBackingStoreIfNeeded):
+        (WebCore::GraphicsLayerTextureMapper::setBackingStore):
+        * platform/graphics/texmap/GraphicsLayerTextureMapper.h:
+        (GraphicsLayerTextureMapper):
+        * platform/graphics/texmap/TextureMapperLayer.cpp:
+        (WebCore::TextureMapperLayer::flushCompositingStateForThisLayerOnly):
+        * platform/graphics/texmap/TextureMapperLayer.h:
+        (TextureMapperLayer):
+
 2013-01-30  Andrey Lushnikov  <lushni...@chromium.org>
 
         Web Inspector: DTE adds additional space to the end of line.

Modified: trunk/Source/WebCore/platform/graphics/texmap/GraphicsLayerTextureMapper.cpp (141231 => 141232)


--- trunk/Source/WebCore/platform/graphics/texmap/GraphicsLayerTextureMapper.cpp	2013-01-30 08:22:46 UTC (rev 141231)
+++ trunk/Source/WebCore/platform/graphics/texmap/GraphicsLayerTextureMapper.cpp	2013-01-30 08:22:57 UTC (rev 141232)
@@ -402,17 +402,32 @@
 */
 void GraphicsLayerTextureMapper::flushCompositingStateForThisLayerOnly()
 {
-    updateDebugBorderAndRepaintCountIfNeeded();
+    prepareBackingStoreIfNeeded();
     m_layer->flushCompositingStateForThisLayerOnly(this);
     updateBackingStoreIfNeeded();
     didFlushCompositingState();
 }
 
-void GraphicsLayerTextureMapper::updateDebugBorderAndRepaintCountIfNeeded()
+void GraphicsLayerTextureMapper::prepareBackingStoreIfNeeded()
 {
     if (!m_hasOwnBackingStore)
         return;
+    if (!shouldHaveBackingStore()) {
+        m_backingStore.clear();
+        m_changeMask |= TextureMapperLayer::BackingStoreChange;
+    } else {
+        if (!m_backingStore) {
+            m_backingStore = TextureMapperTiledBackingStore::create();
+            m_changeMask |= TextureMapperLayer::BackingStoreChange;
+        }
+    }
 
+    updateDebugBorderAndRepaintCount();
+}
+
+void GraphicsLayerTextureMapper::updateDebugBorderAndRepaintCount()
+{
+    ASSERT(m_hasOwnBackingStore);
     if (isShowingDebugBorder())
         updateDebugIndicators();
 
@@ -457,20 +472,16 @@
 {
     if (!m_hasOwnBackingStore)
         return;
-    prepareBackingStore();
-    m_layer->setBackingStore(m_backingStore);
-}
 
-void GraphicsLayerTextureMapper::prepareBackingStore()
-{
     TextureMapper* textureMapper = m_layer->textureMapper();
     if (!textureMapper)
         return;
 
     if (!shouldHaveBackingStore()) {
-        m_backingStore.clear();
+        ASSERT(!m_backingStore);
         return;
     }
+    ASSERT(m_backingStore);
 
     IntRect dirtyRect = enclosingIntRect(FloatRect(FloatPoint::zero(), m_size));
     if (!m_needsDisplay)
@@ -478,9 +489,6 @@
     if (dirtyRect.isEmpty())
         return;
 
-    if (!m_backingStore)
-        m_backingStore = TextureMapperTiledBackingStore::create();
-
 #if PLATFORM(QT)
     ASSERT(dynamic_cast<TextureMapperTiledBackingStore*>(m_backingStore.get()));
 #endif
@@ -546,6 +554,16 @@
 }
 #endif
 
+void GraphicsLayerTextureMapper::setBackingStore(PassRefPtr<TextureMapperBackingStore> backingStore)
+{
+    ASSERT(!m_hasOwnBackingStore);
+    if (m_backingStore == backingStore)
+        return;
+
+    m_backingStore = backingStore;
+    notifyChange(TextureMapperLayer::BackingStoreChange);
+}
+
 void GraphicsLayerTextureMapper::setRepaintCount(int repaintCount)
 {
     m_repaintCount = repaintCount;

Modified: trunk/Source/WebCore/platform/graphics/texmap/GraphicsLayerTextureMapper.h (141231 => 141232)


--- trunk/Source/WebCore/platform/graphics/texmap/GraphicsLayerTextureMapper.h	2013-01-30 08:22:46 UTC (rev 141231)
+++ trunk/Source/WebCore/platform/graphics/texmap/GraphicsLayerTextureMapper.h	2013-01-30 08:22:57 UTC (rev 141232)
@@ -89,6 +89,7 @@
 
     // FIXME: It will be removed after removing dependency of LayerTreeRenderer on GraphicsLayerTextureMapper.
     void setHasOwnBackingStore(bool b) { m_hasOwnBackingStore = b; }
+    void setBackingStore(PassRefPtr<TextureMapperBackingStore>);
 
     void setFixedToViewport(bool fixed) { m_fixedToViewport = fixed; }
     bool fixedToViewport() const { return m_fixedToViewport; }
@@ -100,9 +101,9 @@
 private:
     virtual void willBeDestroyed();
     void didFlushCompositingState();
-    void updateDebugBorderAndRepaintCountIfNeeded();
+    void updateDebugBorderAndRepaintCount();
     void updateBackingStoreIfNeeded();
-    void prepareBackingStore();
+    void prepareBackingStoreIfNeeded();
     bool shouldHaveBackingStore() const;
     void animationStartedTimerFired(Timer<GraphicsLayerTextureMapper>*);
 

Modified: trunk/Source/WebCore/platform/graphics/texmap/TextureMapperLayer.cpp (141231 => 141232)


--- trunk/Source/WebCore/platform/graphics/texmap/TextureMapperLayer.cpp	2013-01-30 08:22:46 UTC (rev 141231)
+++ trunk/Source/WebCore/platform/graphics/texmap/TextureMapperLayer.cpp	2013-01-30 08:22:57 UTC (rev 141232)
@@ -54,16 +54,6 @@
     return this;
 }
 
-void TextureMapperLayer::clearBackingStoresRecursive()
-{
-    m_backingStore.clear();
-    m_contentsLayer = 0;
-    for (size_t i = 0; i < m_children.size(); ++i)
-        m_children[i]->clearBackingStoresRecursive();
-    if (m_state.maskLayer)
-        m_state.maskLayer->clearBackingStoresRecursive();
-}
-
 void TextureMapperLayer::computeTransformsRecursive()
 {
     if (m_state.size.isEmpty() && m_state.masksToBounds)
@@ -437,6 +427,9 @@
         m_shouldUpdateCurrentFiltersFromGraphicsLayer = true;
 #endif
 
+    if (changeMask & BackingStoreChange)
+        m_backingStore = graphicsLayer->m_backingStore;
+
     if (changeMask & RepaintCountChange)
         m_state.repaintCount = graphicsLayer->repaintCount();
 

Modified: trunk/Source/WebCore/platform/graphics/texmap/TextureMapperLayer.h (141231 => 141232)


--- trunk/Source/WebCore/platform/graphics/texmap/TextureMapperLayer.h	2013-01-30 08:22:46 UTC (rev 141231)
+++ trunk/Source/WebCore/platform/graphics/texmap/TextureMapperLayer.h	2013-01-30 08:22:57 UTC (rev 141232)
@@ -74,7 +74,9 @@
         FilterChange =              (1L << 23),
 
         DebugVisualsChange =        (1L << 24),
-        RepaintCountChange =        (1L << 25)
+        RepaintCountChange =        (1L << 25),
+
+        BackingStoreChange =        (1L << 26)
     };
 
     TextureMapperLayer()
@@ -100,10 +102,6 @@
 
     void paint();
 
-    void setBackingStore(PassRefPtr<TextureMapperBackingStore> backingStore) { m_backingStore = backingStore; }
-    PassRefPtr<TextureMapperBackingStore> backingStore() { return m_backingStore; }
-    void clearBackingStoresRecursive();
-
     void setScrollPositionDeltaIfNeeded(const FloatSize&);
 
     void applyAnimationsRecursively();

Modified: trunk/Source/WebKit2/ChangeLog (141231 => 141232)


--- trunk/Source/WebKit2/ChangeLog	2013-01-30 08:22:46 UTC (rev 141231)
+++ trunk/Source/WebKit2/ChangeLog	2013-01-30 08:22:57 UTC (rev 141232)
@@ -1,3 +1,32 @@
+2013-01-30  Huang Dongsung  <luxte...@company100.net>
+
+        Coordinated Graphics: Remove m_pendingSyncBackingStores in LayerTreeRenderer.
+        https://bugs.webkit.org/show_bug.cgi?id=107099
+
+        Reviewed by Noam Rosenthal.
+
+        Instead of queuing the setting of backing stores in LayerTreeRenderer,
+        and then setting them directly to TextureMapperLayer, we allow
+        GraphicsLayerTextureMapper's existing queuing mechanism to handle that.
+        Instead of a m_pendingSyncBackingStores queue, we have a m_backingStores
+        queue which can be applied much more easily to the layer tree.
+
+        In addition, LayerTreeRenderer::purgeGLResources() does not call
+        TextureMapperLayer::clearBackingStoresRecursive() because
+        TextureMapperLayer will be destructed soon.
+
+        * UIProcess/CoordinatedGraphics/LayerTreeRenderer.cpp:
+        (WebKit::LayerTreeRenderer::deleteLayer):
+        (WebKit::LayerTreeRenderer::createBackingStoreIfNeeded):
+        (WebKit::LayerTreeRenderer::removeBackingStoreIfNeeded):
+        (WebKit::LayerTreeRenderer::resetBackingStoreSizeToLayerSize):
+        (WebKit::LayerTreeRenderer::createTile):
+        (WebKit::LayerTreeRenderer::removeTile):
+        (WebKit::LayerTreeRenderer::updateTile):
+        (WebKit::LayerTreeRenderer::commitPendingBackingStoreOperations):
+        (WebKit::LayerTreeRenderer::purgeGLResources):
+        * UIProcess/CoordinatedGraphics/LayerTreeRenderer.h:
+
 2013-01-29  Anders Carlsson  <ander...@apple.com>
 
         Update the expected generated message results

Modified: trunk/Source/WebKit2/UIProcess/CoordinatedGraphics/LayerTreeRenderer.cpp (141231 => 141232)


--- trunk/Source/WebKit2/UIProcess/CoordinatedGraphics/LayerTreeRenderer.cpp	2013-01-30 08:22:46 UTC (rev 141231)
+++ trunk/Source/WebKit2/UIProcess/CoordinatedGraphics/LayerTreeRenderer.cpp	2013-01-30 08:22:57 UTC (rev 141232)
@@ -386,7 +386,7 @@
     OwnPtr<GraphicsLayer> layer = m_layers.take(layerID);
     ASSERT(layer);
 
-    m_pendingSyncBackingStores.remove(toTextureMapperLayer(layer.get()));
+    m_backingStores.remove(layer.get());
     m_fixedLayers.remove(layerID);
 #if USE(GRAPHICS_SURFACE)
     m_surfaceBackingStores.remove(layerID);
@@ -405,18 +405,6 @@
     m_rootLayer->addChild(layer);
 }
 
-CoordinatedBackingStore* LayerTreeRenderer::getBackingStore(GraphicsLayer* graphicsLayer)
-{
-    TextureMapperLayer* layer = toTextureMapperLayer(graphicsLayer);
-    ASSERT(layer);
-    CoordinatedBackingStore* backingStore = static_cast<CoordinatedBackingStore*>(layer->backingStore().get());
-
-    BackingStoreMap::iterator it = m_pendingSyncBackingStores.find(layer);
-    if (it != m_pendingSyncBackingStores.end())
-        backingStore = it->value.get();
-    return backingStore;
-}
-
 void LayerTreeRenderer::prepareContentBackingStore(GraphicsLayer* graphicsLayer)
 {
     if (!layerShouldHaveBackingStore(graphicsLayer)) {
@@ -429,55 +417,27 @@
 
 void LayerTreeRenderer::createBackingStoreIfNeeded(GraphicsLayer* graphicsLayer)
 {
-    TextureMapperLayer* layer = toTextureMapperLayer(graphicsLayer);
-    ASSERT(layer);
-
-    // Make sure the layer does not already have a backing store (committed or pending).
-    BackingStoreMap::iterator it = m_pendingSyncBackingStores.find(layer);
-    if (it != m_pendingSyncBackingStores.end()) {
-        if (!it->value) {
-            // There is a pending removal, cancel it.
-            m_pendingSyncBackingStores.remove(it);
-        }
-        // There is already a pending addition.
+    if (m_backingStores.contains(graphicsLayer))
         return;
-    }
-    if (layer->backingStore())
-        return; // The layer already has a backing store (and no pending removal).
 
     RefPtr<CoordinatedBackingStore> backingStore(CoordinatedBackingStore::create());
-
     backingStore->setSize(graphicsLayer->size());
-    ASSERT(!m_pendingSyncBackingStores.contains(layer));
-    m_pendingSyncBackingStores.add(layer, backingStore);
+    m_backingStores.add(graphicsLayer, backingStore);
+    toGraphicsLayerTextureMapper(graphicsLayer)->setBackingStore(backingStore);
 }
 
 void LayerTreeRenderer::removeBackingStoreIfNeeded(GraphicsLayer* graphicsLayer)
 {
-    TextureMapperLayer* layer = toTextureMapperLayer(graphicsLayer);
-    ASSERT(layer);
-
-    // Check if the layout already has a backing store (committed or pending).
-    BackingStoreMap::iterator it = m_pendingSyncBackingStores.find(layer);
-    if (it != m_pendingSyncBackingStores.end()) {
-        if (it->value) {
-            // There is a pending addition, cancel it.
-            m_pendingSyncBackingStores.remove(it);
-        }
-        // There is already a pending removal.
+    RefPtr<CoordinatedBackingStore> backingStore = m_backingStores.take(graphicsLayer);
+    if (!backingStore)
         return;
-    }
 
-    if (!layer->backingStore())
-        return; // The layer has no backing store (and no pending addition).
-
-    ASSERT(!m_pendingSyncBackingStores.contains(layer));
-    m_pendingSyncBackingStores.add(layer, 0);
+    toGraphicsLayerTextureMapper(graphicsLayer)->setBackingStore(0);
 }
 
 void LayerTreeRenderer::resetBackingStoreSizeToLayerSize(GraphicsLayer* graphicsLayer)
 {
-    CoordinatedBackingStore* backingStore = getBackingStore(graphicsLayer);
+    RefPtr<CoordinatedBackingStore> backingStore = m_backingStores.get(graphicsLayer);
     ASSERT(backingStore);
     backingStore->setSize(graphicsLayer->size());
 }
@@ -485,7 +445,7 @@
 void LayerTreeRenderer::createTile(CoordinatedLayerID layerID, uint32_t tileID, float scale)
 {
     GraphicsLayer* layer = layerByID(layerID);
-    CoordinatedBackingStore* backingStore = getBackingStore(layer);
+    RefPtr<CoordinatedBackingStore> backingStore = m_backingStores.get(layer);
     ASSERT(backingStore);
     backingStore->createTile(tileID, scale);
     resetBackingStoreSizeToLayerSize(layer);
@@ -494,7 +454,7 @@
 void LayerTreeRenderer::removeTile(CoordinatedLayerID layerID, uint32_t tileID)
 {
     GraphicsLayer* layer = layerByID(layerID);
-    CoordinatedBackingStore* backingStore = getBackingStore(layer);
+    RefPtr<CoordinatedBackingStore> backingStore = m_backingStores.get(layer);
     if (!backingStore)
         return;
 
@@ -506,7 +466,7 @@
 void LayerTreeRenderer::updateTile(CoordinatedLayerID layerID, uint32_t tileID, const TileUpdate& update)
 {
     GraphicsLayer* layer = layerByID(layerID);
-    RefPtr<CoordinatedBackingStore> backingStore = getBackingStore(layer);
+    RefPtr<CoordinatedBackingStore> backingStore = m_backingStores.get(layer);
     ASSERT(backingStore);
     backingStore->updateTile(tileID, update.sourceRect, update.tileRect, update.surface, update.offset);
     resetBackingStoreSizeToLayerSize(layer);
@@ -577,15 +537,6 @@
         (*it)->commitTileOperations(m_textureMapper.get());
 
     m_backingStoresWithPendingBuffers.clear();
-
-    {
-        BackingStoreMap::iterator end = m_pendingSyncBackingStores.end();
-        BackingStoreMap::iterator it = m_pendingSyncBackingStores.begin();
-        for (;it != end; ++it)
-            it->key->setBackingStore(it->value);
-
-        m_pendingSyncBackingStores.clear();
-    }
 }
 
 void LayerTreeRenderer::flushLayerChanges()
@@ -645,12 +596,8 @@
 
 void LayerTreeRenderer::purgeGLResources()
 {
-    TextureMapperLayer* layer = toTextureMapperLayer(rootLayer());
-
-    if (layer)
-        layer->clearBackingStoresRecursive();
-
     m_imageBackings.clear();
+    m_releasedImageBackings.clear();
 #if USE(GRAPHICS_SURFACE)
     m_surfaceBackingStores.clear();
 #endif
@@ -660,7 +607,7 @@
     m_layers.clear();
     m_fixedLayers.clear();
     m_textureMapper.clear();
-    m_pendingSyncBackingStores.clear();
+    m_backingStores.clear();
     m_backingStoresWithPendingBuffers.clear();
 
     setActive(false);

Modified: trunk/Source/WebKit2/UIProcess/CoordinatedGraphics/LayerTreeRenderer.h (141231 => 141232)


--- trunk/Source/WebKit2/UIProcess/CoordinatedGraphics/LayerTreeRenderer.h	2013-01-30 08:22:46 UTC (rev 141231)
+++ trunk/Source/WebKit2/UIProcess/CoordinatedGraphics/LayerTreeRenderer.h	2013-01-30 08:22:57 UTC (rev 141232)
@@ -153,7 +153,6 @@
     void ensureRootLayer();
     void commitPendingBackingStoreOperations();
 
-    CoordinatedBackingStore* getBackingStore(WebCore::GraphicsLayer*);
     void prepareContentBackingStore(WebCore::GraphicsLayer*);
     void createBackingStoreIfNeeded(WebCore::GraphicsLayer*);
     void removeBackingStoreIfNeeded(WebCore::GraphicsLayer*);
@@ -172,8 +171,8 @@
     ImageBackingMap m_imageBackings;
     Vector<RefPtr<CoordinatedBackingStore> > m_releasedImageBackings;
 
-    typedef HashMap<WebCore::TextureMapperLayer*, RefPtr<CoordinatedBackingStore> > BackingStoreMap;
-    BackingStoreMap m_pendingSyncBackingStores;
+    typedef HashMap<WebCore::GraphicsLayer*, RefPtr<CoordinatedBackingStore> > BackingStoreMap;
+    BackingStoreMap m_backingStores;
 
     HashSet<RefPtr<CoordinatedBackingStore> > m_backingStoresWithPendingBuffers;
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to