Changeset 270071 in webkit


Ignore:
Timestamp:
Nov 19, 2020 11:26:50 PM (3 years ago)
Author:
Fujii Hironori
Message:

[TextureMapper] Remove m_textureMapper from TextureMapperLayer
https://bugs.webkit.org/show_bug.cgi?id=219191

Reviewed by Carlos Garcia Campos.

Source/WebCore:

TextureMapperLayer had m_textureMapper to get the TextureMapper
pointer. However, it was used only by the root layer. The child
layers needed to traverse up to the root layer to get the
TextureMapper pointer. It's more efficient to pass TextureMapper
reference as an argument.

No behavior changes.

  • platform/graphics/texmap/BitmapTexture.cpp:

(WebCore::BitmapTexture::updateContents):

  • platform/graphics/texmap/BitmapTexture.h:
  • platform/graphics/texmap/GraphicsLayerTextureMapper.cpp:

(WebCore::GraphicsLayerTextureMapper::flushCompositingState):
(WebCore::GraphicsLayerTextureMapper::updateBackingStoreIncludingSubLayers):
(WebCore::GraphicsLayerTextureMapper::updateBackingStoreIfNeeded):

  • platform/graphics/texmap/GraphicsLayerTextureMapper.h:
  • platform/graphics/texmap/TextureMapperLayer.cpp:

(WebCore::TextureMapperLayer::paint):

  • platform/graphics/texmap/TextureMapperLayer.h:
  • platform/graphics/texmap/TextureMapperTile.cpp:

(WebCore::TextureMapperTile::updateContents):

Source/WebKit:

  • Shared/CoordinatedGraphics/CoordinatedGraphicsScene.cpp:

(WebKit::CoordinatedGraphicsScene::paintToCurrentGLContext):
(WebKit::CoordinatedGraphicsScene::ensureRootLayer):

  • WebProcess/WebPage/CoordinatedGraphics/LayerTreeHostTextureMapper.cpp:

(WebKit::LayerTreeHost::compositeLayersToContext):
(WebKit::LayerTreeHost::flushPendingLayerChanges):
(WebKit::LayerTreeHost::LayerTreeHost):

Source/WebKitLegacy/win:

  • WebCoreSupport/AcceleratedCompositingContext.cpp:

(AcceleratedCompositingContext::initialize):
(AcceleratedCompositingContext::compositeLayersToContext):
(AcceleratedCompositingContext::flushPendingLayerChanges):

Location:
trunk/Source
Files:
13 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r270070 r270071  
     12020-11-19  Fujii Hironori  <Hironori.Fujii@sony.com>
     2
     3        [TextureMapper] Remove m_textureMapper from TextureMapperLayer
     4        https://bugs.webkit.org/show_bug.cgi?id=219191
     5
     6        Reviewed by Carlos Garcia Campos.
     7
     8        TextureMapperLayer had m_textureMapper to get the TextureMapper
     9        pointer. However, it was used only by the root layer. The child
     10        layers needed to traverse up to the root layer to get the
     11        TextureMapper pointer. It's more efficient to pass TextureMapper
     12        reference as an argument.
     13
     14        No behavior changes.
     15
     16        * platform/graphics/texmap/BitmapTexture.cpp:
     17        (WebCore::BitmapTexture::updateContents):
     18        * platform/graphics/texmap/BitmapTexture.h:
     19        * platform/graphics/texmap/GraphicsLayerTextureMapper.cpp:
     20        (WebCore::GraphicsLayerTextureMapper::flushCompositingState):
     21        (WebCore::GraphicsLayerTextureMapper::updateBackingStoreIncludingSubLayers):
     22        (WebCore::GraphicsLayerTextureMapper::updateBackingStoreIfNeeded):
     23        * platform/graphics/texmap/GraphicsLayerTextureMapper.h:
     24        * platform/graphics/texmap/TextureMapperLayer.cpp:
     25        (WebCore::TextureMapperLayer::paint):
     26        * platform/graphics/texmap/TextureMapperLayer.h:
     27        * platform/graphics/texmap/TextureMapperTile.cpp:
     28        (WebCore::TextureMapperTile::updateContents):
     29
    1302020-11-19  Zalan Bujtas  <zalan@apple.com>
    231
  • trunk/Source/WebCore/platform/graphics/texmap/BitmapTexture.cpp

    r269323 r270071  
    3535namespace WebCore {
    3636
    37 void BitmapTexture::updateContents(TextureMapper&, GraphicsLayer* sourceLayer, const IntRect& targetRect, const IntPoint& offset, float scale)
     37void BitmapTexture::updateContents(GraphicsLayer* sourceLayer, const IntRect& targetRect, const IntPoint& offset, float scale)
    3838{
    3939    // Making an unconditionally unaccelerated buffer here is OK because this code
  • trunk/Source/WebCore/platform/graphics/texmap/BitmapTexture.h

    r229895 r270071  
    6161    virtual IntSize size() const = 0;
    6262    virtual void updateContents(Image*, const IntRect&, const IntPoint& offset) = 0;
    63     virtual void updateContents(TextureMapper&, GraphicsLayer*, const IntRect& target, const IntPoint& offset, float scale = 1);
     63    void updateContents(GraphicsLayer*, const IntRect& target, const IntPoint& offset, float scale = 1);
    6464    virtual void updateContents(const void*, const IntRect& target, const IntPoint& offset, int bytesPerLine) = 0;
    6565    virtual bool isValid() const = 0;
  • trunk/Source/WebCore/platform/graphics/texmap/GraphicsLayerTextureMapper.cpp

    r269838 r270071  
    508508void GraphicsLayerTextureMapper::flushCompositingState(const FloatRect& rect)
    509509{
    510     if (!m_layer.textureMapper())
    511         return;
    512 
    513510    flushCompositingStateForThisLayerOnly();
    514511
     
    527524}
    528525
    529 void GraphicsLayerTextureMapper::updateBackingStoreIncludingSubLayers()
    530 {
    531     if (!m_layer.textureMapper())
    532         return;
    533 
    534     updateBackingStoreIfNeeded();
     526void GraphicsLayerTextureMapper::updateBackingStoreIncludingSubLayers(TextureMapper& textureMapper)
     527{
     528    updateBackingStoreIfNeeded(textureMapper);
    535529
    536530    if (maskLayer())
    537         downcast<GraphicsLayerTextureMapper>(*maskLayer()).updateBackingStoreIfNeeded();
     531        downcast<GraphicsLayerTextureMapper>(*maskLayer()).updateBackingStoreIfNeeded(textureMapper);
    538532    if (replicaLayer())
    539         downcast<GraphicsLayerTextureMapper>(*replicaLayer()).updateBackingStoreIncludingSubLayers();
     533        downcast<GraphicsLayerTextureMapper>(*replicaLayer()).updateBackingStoreIncludingSubLayers(textureMapper);
    540534    for (auto& child : children())
    541         downcast<GraphicsLayerTextureMapper>(child.get()).updateBackingStoreIncludingSubLayers();
    542 }
    543 
    544 void GraphicsLayerTextureMapper::updateBackingStoreIfNeeded()
    545 {
    546     TextureMapper* textureMapper = m_layer.textureMapper();
    547     if (!textureMapper)
    548         return;
    549 
     535        downcast<GraphicsLayerTextureMapper>(child.get()).updateBackingStoreIncludingSubLayers(textureMapper);
     536}
     537
     538void GraphicsLayerTextureMapper::updateBackingStoreIfNeeded(TextureMapper& textureMapper)
     539{
    550540    if (!shouldHaveBackingStore()) {
    551541        ASSERT(!m_backingStore);
     
    563553
    564554    dirtyRect.scale(pageScaleFactor() * deviceScaleFactor());
    565     m_backingStore->updateContents(*textureMapper, this, m_size, dirtyRect);
     555    m_backingStore->updateContents(textureMapper, this, m_size, dirtyRect);
    566556
    567557    m_needsDisplay = false;
  • trunk/Source/WebCore/platform/graphics/texmap/GraphicsLayerTextureMapper.h

    r269614 r270071  
    8888    void flushCompositingStateForThisLayerOnly() override;
    8989
    90     void updateBackingStoreIncludingSubLayers();
     90    void updateBackingStoreIncludingSubLayers(TextureMapper&);
    9191
    9292    TextureMapperLayer& layer() { return m_layer; }
     
    105105    void commitLayerChanges();
    106106    void updateDebugBorderAndRepaintCount();
    107     void updateBackingStoreIfNeeded();
     107    void updateBackingStoreIfNeeded(TextureMapper&);
    108108    void prepareBackingStoreIfNeeded();
    109109    bool shouldHaveBackingStore() const;
  • trunk/Source/WebCore/platform/graphics/texmap/TextureMapperLayer.cpp

    r269936 r270071  
    134134}
    135135
    136 void TextureMapperLayer::paint()
     136void TextureMapperLayer::paint(TextureMapper& textureMapper)
    137137{
    138138    computeTransformsRecursive();
    139139
    140     ASSERT(m_textureMapper);
    141     TextureMapperPaintOptions options(*m_textureMapper);
     140    TextureMapperPaintOptions options(textureMapper);
    142141    options.textureMapper.bindSurface(0);
    143142
  • trunk/Source/WebCore/platform/graphics/texmap/TextureMapperLayer.h

    r269936 r270071  
    4949
    5050    const Vector<TextureMapperLayer*>& children() const { return m_children; }
    51 
    52     TextureMapper* textureMapper() const { return rootLayer().m_textureMapper; }
    53     void setTextureMapper(TextureMapper* texmap) { m_textureMapper = texmap; }
    5451
    5552#if !USE(COORDINATED_GRAPHICS)
     
    104101    bool descendantsOrSelfHaveRunningAnimations() const;
    105102
    106     void paint();
     103    void paint(TextureMapper&);
    107104
    108105    void addChild(TextureMapperLayer*);
     
    215212
    216213    State m_state;
    217     TextureMapper* m_textureMapper { nullptr };
    218214    Nicosia::Animations m_animations;
    219215    uint32_t m_id { 0 };
  • trunk/Source/WebCore/platform/graphics/texmap/TextureMapperTile.cpp

    r229895 r270071  
    6565    }
    6666
    67     m_texture->updateContents(textureMapper, sourceLayer, targetRect, sourceOffset, scale);
     67    m_texture->updateContents(sourceLayer, targetRect, sourceOffset, scale);
    6868}
    6969
  • trunk/Source/WebKit/ChangeLog

    r270069 r270071  
     12020-11-19  Fujii Hironori  <Hironori.Fujii@sony.com>
     2
     3        [TextureMapper] Remove m_textureMapper from TextureMapperLayer
     4        https://bugs.webkit.org/show_bug.cgi?id=219191
     5
     6        Reviewed by Carlos Garcia Campos.
     7
     8        * Shared/CoordinatedGraphics/CoordinatedGraphicsScene.cpp:
     9        (WebKit::CoordinatedGraphicsScene::paintToCurrentGLContext):
     10        (WebKit::CoordinatedGraphicsScene::ensureRootLayer):
     11        * WebProcess/WebPage/CoordinatedGraphics/LayerTreeHostTextureMapper.cpp:
     12        (WebKit::LayerTreeHost::compositeLayersToContext):
     13        (WebKit::LayerTreeHost::flushPendingLayerChanges):
     14        (WebKit::LayerTreeHost::LayerTreeHost):
     15
    1162020-11-19  Hoa Dinh  <dvh@apple.com>
    217
  • trunk/Source/WebKit/Shared/CoordinatedGraphics/CoordinatedGraphicsScene.cpp

    r269772 r270071  
    6969        return;
    7070
    71     currentRootLayer->setTextureMapper(m_textureMapper.get());
    7271    bool sceneHasRunningAnimations = currentRootLayer->applyAnimationsRecursively(MonotonicTime::now());
    7372    m_textureMapper->beginPainting(PaintFlags);
     
    7776        currentRootLayer->setTransform(matrix);
    7877
    79     currentRootLayer->paint();
     78    currentRootLayer->paint(*m_textureMapper);
    8079    m_fpsCounter.updateFPSAndDisplay(*m_textureMapper, clipRect.location(), matrix);
    8180    m_textureMapper->endClip();
     
    423422    // The root layer should not have zero size, or it would be optimized out.
    424423    m_rootLayer->setSize(FloatSize(1.0, 1.0));
    425 
    426     ASSERT(m_textureMapper);
    427     m_rootLayer->setTextureMapper(m_textureMapper.get());
    428424}
    429425
  • trunk/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/LayerTreeHostTextureMapper.cpp

    r268075 r270071  
    6868
    6969    m_textureMapper->beginPainting();
    70     downcast<GraphicsLayerTextureMapper>(*m_rootLayer).layer().paint();
     70    downcast<GraphicsLayerTextureMapper>(*m_rootLayer).layer().paint(*m_textureMapper);
    7171    m_fpsCounter.updateFPSAndDisplay(*m_textureMapper);
    7272    m_textureMapper->endPainting();
     
    8585        m_overlayCompositingLayer->flushCompositingState(FloatRect(FloatPoint(), m_rootLayer->size()));
    8686
    87     downcast<GraphicsLayerTextureMapper>(*m_rootLayer).updateBackingStoreIncludingSubLayers();
     87    downcast<GraphicsLayerTextureMapper>(*m_rootLayer).updateBackingStoreIncludingSubLayers(*m_textureMapper);
    8888    return true;
    8989}
     
    124124
    125125    m_textureMapper = TextureMapperGL::create();
    126     downcast<GraphicsLayerTextureMapper>(*m_rootLayer).layer().setTextureMapper(m_textureMapper.get());
    127126}
    128127
  • trunk/Source/WebKitLegacy/win/ChangeLog

    r269973 r270071  
     12020-11-19  Fujii Hironori  <Hironori.Fujii@sony.com>
     2
     3        [TextureMapper] Remove m_textureMapper from TextureMapperLayer
     4        https://bugs.webkit.org/show_bug.cgi?id=219191
     5
     6        Reviewed by Carlos Garcia Campos.
     7
     8        * WebCoreSupport/AcceleratedCompositingContext.cpp:
     9        (AcceleratedCompositingContext::initialize):
     10        (AcceleratedCompositingContext::compositeLayersToContext):
     11        (AcceleratedCompositingContext::flushPendingLayerChanges):
     12
    1132020-11-18  Simon Fraser  <simon.fraser@apple.com>
    214
  • trunk/Source/WebKitLegacy/win/WebCoreSupport/AcceleratedCompositingContext.cpp

    r269066 r270071  
    108108
    109109    m_textureMapper = TextureMapperGL::create();
    110     downcast<GraphicsLayerTextureMapper>(*m_rootLayer).layer().setTextureMapper(m_textureMapper.get());
    111110
    112111    scheduleLayerFlush();
     
    184183
    185184    m_textureMapper->beginPainting();
    186     downcast<GraphicsLayerTextureMapper>(*m_rootLayer).layer().paint();
     185    downcast<GraphicsLayerTextureMapper>(*m_rootLayer).layer().paint(*m_textureMapper);
    187186    m_fpsCounter.updateFPSAndDisplay(*m_textureMapper);
    188187    m_textureMapper->endPainting();
     
    283282        return false;
    284283
    285     downcast<GraphicsLayerTextureMapper>(*m_rootLayer).updateBackingStoreIncludingSubLayers();
     284    downcast<GraphicsLayerTextureMapper>(*m_rootLayer).updateBackingStoreIncludingSubLayers(*m_textureMapper);
    286285    return true;
    287286}
Note: See TracChangeset for help on using the changeset viewer.