Changeset 141232 in webkit


Ignore:
Timestamp:
Jan 30, 2013 12:22:57 AM (11 years ago)
Author:
commit-queue@webkit.org
Message:

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

Patch by Huang Dongsung <luxtella@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:
Location:
trunk/Source
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r141230 r141232  
     12013-01-30  Huang Dongsung  <luxtella@company100.net>
     2
     3        Coordinated Graphics: Remove m_pendingSyncBackingStores in LayerTreeRenderer.
     4        https://bugs.webkit.org/show_bug.cgi?id=107099
     5
     6        Reviewed by Noam Rosenthal.
     7
     8        Add GraphicsLayerTextureMapper::setBackingStore() so that
     9        LayerTreeRenderer sets a backing store to GraphicsLayerTextureMapper.
     10
     11        Remove three methods of TextureMapperLayer related to a backing store
     12        because they are no longer used.
     13
     14        Covered by existing compositing tests.
     15
     16        * platform/graphics/texmap/GraphicsLayerTextureMapper.cpp:
     17        (WebCore::GraphicsLayerTextureMapper::flushCompositingStateForThisLayerOnly):
     18        (WebCore::GraphicsLayerTextureMapper::prepareBackingStoreIfNeeded):
     19        (WebCore):
     20        (WebCore::GraphicsLayerTextureMapper::updateDebugBorderAndRepaintCount):
     21        (WebCore::GraphicsLayerTextureMapper::updateBackingStoreIfNeeded):
     22        (WebCore::GraphicsLayerTextureMapper::setBackingStore):
     23        * platform/graphics/texmap/GraphicsLayerTextureMapper.h:
     24        (GraphicsLayerTextureMapper):
     25        * platform/graphics/texmap/TextureMapperLayer.cpp:
     26        (WebCore::TextureMapperLayer::flushCompositingStateForThisLayerOnly):
     27        * platform/graphics/texmap/TextureMapperLayer.h:
     28        (TextureMapperLayer):
     29
    1302013-01-30  Andrey Lushnikov  <lushnikov@chromium.org>
    231
  • trunk/Source/WebCore/platform/graphics/texmap/GraphicsLayerTextureMapper.cpp

    r141067 r141232  
    403403void GraphicsLayerTextureMapper::flushCompositingStateForThisLayerOnly()
    404404{
    405     updateDebugBorderAndRepaintCountIfNeeded();
     405    prepareBackingStoreIfNeeded();
    406406    m_layer->flushCompositingStateForThisLayerOnly(this);
    407407    updateBackingStoreIfNeeded();
     
    409409}
    410410
    411 void GraphicsLayerTextureMapper::updateDebugBorderAndRepaintCountIfNeeded()
     411void GraphicsLayerTextureMapper::prepareBackingStoreIfNeeded()
    412412{
    413413    if (!m_hasOwnBackingStore)
    414414        return;
    415 
     415    if (!shouldHaveBackingStore()) {
     416        m_backingStore.clear();
     417        m_changeMask |= TextureMapperLayer::BackingStoreChange;
     418    } else {
     419        if (!m_backingStore) {
     420            m_backingStore = TextureMapperTiledBackingStore::create();
     421            m_changeMask |= TextureMapperLayer::BackingStoreChange;
     422        }
     423    }
     424
     425    updateDebugBorderAndRepaintCount();
     426}
     427
     428void GraphicsLayerTextureMapper::updateDebugBorderAndRepaintCount()
     429{
     430    ASSERT(m_hasOwnBackingStore);
    416431    if (isShowingDebugBorder())
    417432        updateDebugIndicators();
     
    458473    if (!m_hasOwnBackingStore)
    459474        return;
    460     prepareBackingStore();
    461     m_layer->setBackingStore(m_backingStore);
    462 }
    463 
    464 void GraphicsLayerTextureMapper::prepareBackingStore()
    465 {
     475
    466476    TextureMapper* textureMapper = m_layer->textureMapper();
    467477    if (!textureMapper)
     
    469479
    470480    if (!shouldHaveBackingStore()) {
    471         m_backingStore.clear();
     481        ASSERT(!m_backingStore);
    472482        return;
    473483    }
     484    ASSERT(m_backingStore);
    474485
    475486    IntRect dirtyRect = enclosingIntRect(FloatRect(FloatPoint::zero(), m_size));
     
    479490        return;
    480491
    481     if (!m_backingStore)
    482         m_backingStore = TextureMapperTiledBackingStore::create();
    483 
    484492#if PLATFORM(QT)
    485493    ASSERT(dynamic_cast<TextureMapperTiledBackingStore*>(m_backingStore.get()));
     
    547555#endif
    548556
     557void GraphicsLayerTextureMapper::setBackingStore(PassRefPtr<TextureMapperBackingStore> backingStore)
     558{
     559    ASSERT(!m_hasOwnBackingStore);
     560    if (m_backingStore == backingStore)
     561        return;
     562
     563    m_backingStore = backingStore;
     564    notifyChange(TextureMapperLayer::BackingStoreChange);
     565}
     566
    549567void GraphicsLayerTextureMapper::setRepaintCount(int repaintCount)
    550568{
  • trunk/Source/WebCore/platform/graphics/texmap/GraphicsLayerTextureMapper.h

    r140821 r141232  
    9090    // FIXME: It will be removed after removing dependency of LayerTreeRenderer on GraphicsLayerTextureMapper.
    9191    void setHasOwnBackingStore(bool b) { m_hasOwnBackingStore = b; }
     92    void setBackingStore(PassRefPtr<TextureMapperBackingStore>);
    9293
    9394    void setFixedToViewport(bool fixed) { m_fixedToViewport = fixed; }
     
    101102    virtual void willBeDestroyed();
    102103    void didFlushCompositingState();
    103     void updateDebugBorderAndRepaintCountIfNeeded();
     104    void updateDebugBorderAndRepaintCount();
    104105    void updateBackingStoreIfNeeded();
    105     void prepareBackingStore();
     106    void prepareBackingStoreIfNeeded();
    106107    bool shouldHaveBackingStore() const;
    107108    void animationStartedTimerFired(Timer<GraphicsLayerTextureMapper>*);
  • trunk/Source/WebCore/platform/graphics/texmap/TextureMapperLayer.cpp

    r140825 r141232  
    5555}
    5656
    57 void TextureMapperLayer::clearBackingStoresRecursive()
    58 {
    59     m_backingStore.clear();
    60     m_contentsLayer = 0;
    61     for (size_t i = 0; i < m_children.size(); ++i)
    62         m_children[i]->clearBackingStoresRecursive();
    63     if (m_state.maskLayer)
    64         m_state.maskLayer->clearBackingStoresRecursive();
    65 }
    66 
    6757void TextureMapperLayer::computeTransformsRecursive()
    6858{
     
    437427        m_shouldUpdateCurrentFiltersFromGraphicsLayer = true;
    438428#endif
     429
     430    if (changeMask & BackingStoreChange)
     431        m_backingStore = graphicsLayer->m_backingStore;
    439432
    440433    if (changeMask & RepaintCountChange)
  • trunk/Source/WebCore/platform/graphics/texmap/TextureMapperLayer.h

    r140825 r141232  
    7575
    7676        DebugVisualsChange =        (1L << 24),
    77         RepaintCountChange =        (1L << 25)
     77        RepaintCountChange =        (1L << 25),
     78
     79        BackingStoreChange =        (1L << 26)
    7880    };
    7981
     
    100102
    101103    void paint();
    102 
    103     void setBackingStore(PassRefPtr<TextureMapperBackingStore> backingStore) { m_backingStore = backingStore; }
    104     PassRefPtr<TextureMapperBackingStore> backingStore() { return m_backingStore; }
    105     void clearBackingStoresRecursive();
    106104
    107105    void setScrollPositionDeltaIfNeeded(const FloatSize&);
  • trunk/Source/WebKit2/ChangeLog

    r141224 r141232  
     12013-01-30  Huang Dongsung  <luxtella@company100.net>
     2
     3        Coordinated Graphics: Remove m_pendingSyncBackingStores in LayerTreeRenderer.
     4        https://bugs.webkit.org/show_bug.cgi?id=107099
     5
     6        Reviewed by Noam Rosenthal.
     7
     8        Instead of queuing the setting of backing stores in LayerTreeRenderer,
     9        and then setting them directly to TextureMapperLayer, we allow
     10        GraphicsLayerTextureMapper's existing queuing mechanism to handle that.
     11        Instead of a m_pendingSyncBackingStores queue, we have a m_backingStores
     12        queue which can be applied much more easily to the layer tree.
     13
     14        In addition, LayerTreeRenderer::purgeGLResources() does not call
     15        TextureMapperLayer::clearBackingStoresRecursive() because
     16        TextureMapperLayer will be destructed soon.
     17
     18        * UIProcess/CoordinatedGraphics/LayerTreeRenderer.cpp:
     19        (WebKit::LayerTreeRenderer::deleteLayer):
     20        (WebKit::LayerTreeRenderer::createBackingStoreIfNeeded):
     21        (WebKit::LayerTreeRenderer::removeBackingStoreIfNeeded):
     22        (WebKit::LayerTreeRenderer::resetBackingStoreSizeToLayerSize):
     23        (WebKit::LayerTreeRenderer::createTile):
     24        (WebKit::LayerTreeRenderer::removeTile):
     25        (WebKit::LayerTreeRenderer::updateTile):
     26        (WebKit::LayerTreeRenderer::commitPendingBackingStoreOperations):
     27        (WebKit::LayerTreeRenderer::purgeGLResources):
     28        * UIProcess/CoordinatedGraphics/LayerTreeRenderer.h:
     29
    1302013-01-29  Anders Carlsson  <andersca@apple.com>
    231
  • trunk/Source/WebKit2/UIProcess/CoordinatedGraphics/LayerTreeRenderer.cpp

    r141065 r141232  
    387387    ASSERT(layer);
    388388
    389     m_pendingSyncBackingStores.remove(toTextureMapperLayer(layer.get()));
     389    m_backingStores.remove(layer.get());
    390390    m_fixedLayers.remove(layerID);
    391391#if USE(GRAPHICS_SURFACE)
     
    406406}
    407407
    408 CoordinatedBackingStore* LayerTreeRenderer::getBackingStore(GraphicsLayer* graphicsLayer)
    409 {
    410     TextureMapperLayer* layer = toTextureMapperLayer(graphicsLayer);
    411     ASSERT(layer);
    412     CoordinatedBackingStore* backingStore = static_cast<CoordinatedBackingStore*>(layer->backingStore().get());
    413 
    414     BackingStoreMap::iterator it = m_pendingSyncBackingStores.find(layer);
    415     if (it != m_pendingSyncBackingStores.end())
    416         backingStore = it->value.get();
    417     return backingStore;
    418 }
    419 
    420408void LayerTreeRenderer::prepareContentBackingStore(GraphicsLayer* graphicsLayer)
    421409{
     
    430418void LayerTreeRenderer::createBackingStoreIfNeeded(GraphicsLayer* graphicsLayer)
    431419{
    432     TextureMapperLayer* layer = toTextureMapperLayer(graphicsLayer);
    433     ASSERT(layer);
    434 
    435     // Make sure the layer does not already have a backing store (committed or pending).
    436     BackingStoreMap::iterator it = m_pendingSyncBackingStores.find(layer);
    437     if (it != m_pendingSyncBackingStores.end()) {
    438         if (!it->value) {
    439             // There is a pending removal, cancel it.
    440             m_pendingSyncBackingStores.remove(it);
    441         }
    442         // There is already a pending addition.
    443         return;
    444     }
    445     if (layer->backingStore())
    446         return; // The layer already has a backing store (and no pending removal).
     420    if (m_backingStores.contains(graphicsLayer))
     421        return;
    447422
    448423    RefPtr<CoordinatedBackingStore> backingStore(CoordinatedBackingStore::create());
    449 
    450424    backingStore->setSize(graphicsLayer->size());
    451     ASSERT(!m_pendingSyncBackingStores.contains(layer));
    452     m_pendingSyncBackingStores.add(layer, backingStore);
     425    m_backingStores.add(graphicsLayer, backingStore);
     426    toGraphicsLayerTextureMapper(graphicsLayer)->setBackingStore(backingStore);
    453427}
    454428
    455429void LayerTreeRenderer::removeBackingStoreIfNeeded(GraphicsLayer* graphicsLayer)
    456430{
    457     TextureMapperLayer* layer = toTextureMapperLayer(graphicsLayer);
    458     ASSERT(layer);
    459 
    460     // Check if the layout already has a backing store (committed or pending).
    461     BackingStoreMap::iterator it = m_pendingSyncBackingStores.find(layer);
    462     if (it != m_pendingSyncBackingStores.end()) {
    463         if (it->value) {
    464             // There is a pending addition, cancel it.
    465             m_pendingSyncBackingStores.remove(it);
    466         }
    467         // There is already a pending removal.
    468         return;
    469     }
    470 
    471     if (!layer->backingStore())
    472         return; // The layer has no backing store (and no pending addition).
    473 
    474     ASSERT(!m_pendingSyncBackingStores.contains(layer));
    475     m_pendingSyncBackingStores.add(layer, 0);
     431    RefPtr<CoordinatedBackingStore> backingStore = m_backingStores.take(graphicsLayer);
     432    if (!backingStore)
     433        return;
     434
     435    toGraphicsLayerTextureMapper(graphicsLayer)->setBackingStore(0);
    476436}
    477437
    478438void LayerTreeRenderer::resetBackingStoreSizeToLayerSize(GraphicsLayer* graphicsLayer)
    479439{
    480     CoordinatedBackingStore* backingStore = getBackingStore(graphicsLayer);
     440    RefPtr<CoordinatedBackingStore> backingStore = m_backingStores.get(graphicsLayer);
    481441    ASSERT(backingStore);
    482442    backingStore->setSize(graphicsLayer->size());
     
    486446{
    487447    GraphicsLayer* layer = layerByID(layerID);
    488     CoordinatedBackingStore* backingStore = getBackingStore(layer);
     448    RefPtr<CoordinatedBackingStore> backingStore = m_backingStores.get(layer);
    489449    ASSERT(backingStore);
    490450    backingStore->createTile(tileID, scale);
     
    495455{
    496456    GraphicsLayer* layer = layerByID(layerID);
    497     CoordinatedBackingStore* backingStore = getBackingStore(layer);
     457    RefPtr<CoordinatedBackingStore> backingStore = m_backingStores.get(layer);
    498458    if (!backingStore)
    499459        return;
     
    507467{
    508468    GraphicsLayer* layer = layerByID(layerID);
    509     RefPtr<CoordinatedBackingStore> backingStore = getBackingStore(layer);
     469    RefPtr<CoordinatedBackingStore> backingStore = m_backingStores.get(layer);
    510470    ASSERT(backingStore);
    511471    backingStore->updateTile(tileID, update.sourceRect, update.tileRect, update.surface, update.offset);
     
    578538
    579539    m_backingStoresWithPendingBuffers.clear();
    580 
    581     {
    582         BackingStoreMap::iterator end = m_pendingSyncBackingStores.end();
    583         BackingStoreMap::iterator it = m_pendingSyncBackingStores.begin();
    584         for (;it != end; ++it)
    585             it->key->setBackingStore(it->value);
    586 
    587         m_pendingSyncBackingStores.clear();
    588     }
    589540}
    590541
     
    646597void LayerTreeRenderer::purgeGLResources()
    647598{
    648     TextureMapperLayer* layer = toTextureMapperLayer(rootLayer());
    649 
    650     if (layer)
    651         layer->clearBackingStoresRecursive();
    652 
    653599    m_imageBackings.clear();
     600    m_releasedImageBackings.clear();
    654601#if USE(GRAPHICS_SURFACE)
    655602    m_surfaceBackingStores.clear();
     
    661608    m_fixedLayers.clear();
    662609    m_textureMapper.clear();
    663     m_pendingSyncBackingStores.clear();
     610    m_backingStores.clear();
    664611    m_backingStoresWithPendingBuffers.clear();
    665612
  • trunk/Source/WebKit2/UIProcess/CoordinatedGraphics/LayerTreeRenderer.h

    r141065 r141232  
    154154    void commitPendingBackingStoreOperations();
    155155
    156     CoordinatedBackingStore* getBackingStore(WebCore::GraphicsLayer*);
    157156    void prepareContentBackingStore(WebCore::GraphicsLayer*);
    158157    void createBackingStoreIfNeeded(WebCore::GraphicsLayer*);
     
    173172    Vector<RefPtr<CoordinatedBackingStore> > m_releasedImageBackings;
    174173
    175     typedef HashMap<WebCore::TextureMapperLayer*, RefPtr<CoordinatedBackingStore> > BackingStoreMap;
    176     BackingStoreMap m_pendingSyncBackingStores;
     174    typedef HashMap<WebCore::GraphicsLayer*, RefPtr<CoordinatedBackingStore> > BackingStoreMap;
     175    BackingStoreMap m_backingStores;
    177176
    178177    HashSet<RefPtr<CoordinatedBackingStore> > m_backingStoresWithPendingBuffers;
Note: See TracChangeset for help on using the changeset viewer.