Changeset 215469 in webkit


Ignore:
Timestamp:
Apr 18, 2017 10:31:20 AM (7 years ago)
Author:
Antti Koivisto
Message:

Enable optimized layer flushes on iOS
https://bugs.webkit.org/show_bug.cgi?id=170938
<rdar://problem/31677395>

Reviewed by Simon Fraser.

Source/WebCore:

Test: compositing/ios/overflow-scroll-touch-tiles.html

  • platform/graphics/GraphicsLayer.h:

(WebCore::GraphicsLayer::setApproximatePosition):

Make virtual.

(WebCore::GraphicsLayer::flushCompositingState):

  • platform/graphics/ca/GraphicsLayerCA.cpp:

(WebCore::GraphicsLayerCA::syncPosition):

Rename PositionChanged enum value to more descriptive NeedsComputeVisibleAndCoverageRect.

(WebCore::GraphicsLayerCA::setApproximatePosition):
(WebCore::GraphicsLayerCA::syncBoundsOrigin):

Like syncPosition make these invalidate the geometry without scheduling a flush. This is needed
so when flush happens we don't just optimize it away. Tile coverage depends on position and bounds.

(WebCore::GraphicsLayerCA::flushCompositingState):

Remove FlushScope argument.
Disable optimization on WK1 due to some UIKit interactions.

  • platform/graphics/ca/GraphicsLayerCA.h:
  • platform/graphics/texmap/GraphicsLayerTextureMapper.cpp:

(WebCore::GraphicsLayerTextureMapper::flushCompositingState):

  • platform/graphics/texmap/GraphicsLayerTextureMapper.h:

LayoutTests:

Add test verifying that tiles get created for touch overflow scrolling.

  • compositing/ios/overflow-scroll-touch-tiles-expected.txt: Added.
  • compositing/ios/overflow-scroll-touch-tiles.html: Added.
Location:
trunk
Files:
2 added
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r215464 r215469  
     12017-04-18  Antti Koivisto  <antti@apple.com>
     2
     3        Enable optimized layer flushes on iOS
     4        https://bugs.webkit.org/show_bug.cgi?id=170938
     5        <rdar://problem/31677395>
     6
     7        Reviewed by Simon Fraser.
     8
     9        Add test verifying that tiles get created for touch overflow scrolling.
     10
     11        * compositing/ios/overflow-scroll-touch-tiles-expected.txt: Added.
     12        * compositing/ios/overflow-scroll-touch-tiles.html: Added.
     13
    1142017-04-18  Ryan Haddad  <ryanhaddad@apple.com>
    215
  • trunk/Source/WebCore/ChangeLog

    r215467 r215469  
     12017-04-18  Antti Koivisto  <antti@apple.com>
     2
     3        Enable optimized layer flushes on iOS
     4        https://bugs.webkit.org/show_bug.cgi?id=170938
     5        <rdar://problem/31677395>
     6
     7        Reviewed by Simon Fraser.
     8
     9        Test: compositing/ios/overflow-scroll-touch-tiles.html
     10
     11        * platform/graphics/GraphicsLayer.h:
     12        (WebCore::GraphicsLayer::setApproximatePosition):
     13
     14            Make virtual.
     15
     16        (WebCore::GraphicsLayer::flushCompositingState):
     17        * platform/graphics/ca/GraphicsLayerCA.cpp:
     18        (WebCore::GraphicsLayerCA::syncPosition):
     19
     20            Rename PositionChanged enum value to more descriptive NeedsComputeVisibleAndCoverageRect.
     21
     22        (WebCore::GraphicsLayerCA::setApproximatePosition):
     23        (WebCore::GraphicsLayerCA::syncBoundsOrigin):
     24
     25            Like syncPosition make these invalidate the geometry without scheduling a flush. This is needed
     26            so when flush happens we don't just optimize it away. Tile coverage depends on position and bounds.
     27
     28        (WebCore::GraphicsLayerCA::flushCompositingState):
     29
     30            Remove FlushScope argument.
     31            Disable optimization on WK1 due to some UIKit interactions.
     32
     33        * platform/graphics/ca/GraphicsLayerCA.h:
     34        * platform/graphics/texmap/GraphicsLayerTextureMapper.cpp:
     35        (WebCore::GraphicsLayerTextureMapper::flushCompositingState):
     36        * platform/graphics/texmap/GraphicsLayerTextureMapper.h:
     37
    1382017-04-18  Tim Horton  <timothy_horton@apple.com>
    239
  • trunk/Source/WebCore/platform/graphics/GraphicsLayer.h

    r215410 r215469  
    315315    // approximatePosition, if set, overrides position() and is used during coverage rect computation.
    316316    FloatPoint approximatePosition() const { return m_approximatePosition ? m_approximatePosition.value() : m_position; }
    317     void setApproximatePosition(std::optional<FloatPoint> p) { m_approximatePosition = p; }
     317    virtual void setApproximatePosition(const FloatPoint& p) { m_approximatePosition = p; }
    318318
    319319    // For platforms that move underlying platform layers on a different thread for scrolling; just update the GraphicsLayer state.
     
    526526    // with updates drawn into the window. These methods flush internal batched state on this layer
    527527    // and descendant layers, and this layer only.
    528     enum class FlushScope { Uncommitted, All };
    529     virtual void flushCompositingState(const FloatRect& /* clipRect */, FlushScope = FlushScope::All) { }
     528    virtual void flushCompositingState(const FloatRect& /* clipRect */) { }
    530529    virtual void flushCompositingStateForThisLayerOnly() { }
    531530
  • trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp

    r215410 r215469  
    589589    GraphicsLayer::syncPosition(point);
    590590    // Ensure future flushes will recompute the coverage rect and update tiling.
    591     noteLayerPropertyChanged(PositionChanged, DontScheduleFlush);
     591    noteLayerPropertyChanged(NeedsComputeVisibleAndCoverageRect, DontScheduleFlush);
     592}
     593
     594void GraphicsLayerCA::setApproximatePosition(const FloatPoint& point)
     595{
     596    if (point == m_approximatePosition)
     597        return;
     598
     599    GraphicsLayer::setApproximatePosition(point);
     600    // Ensure future flushes will recompute the coverage rect and update tiling.
     601    noteLayerPropertyChanged(NeedsComputeVisibleAndCoverageRect, DontScheduleFlush);
    592602}
    593603
     
    617627    GraphicsLayer::setBoundsOrigin(origin);
    618628    noteLayerPropertyChanged(GeometryChanged);
     629}
     630
     631void GraphicsLayerCA::syncBoundsOrigin(const FloatPoint& origin)
     632{
     633    if (origin == m_boundsOrigin)
     634        return;
     635
     636    GraphicsLayer::syncBoundsOrigin(origin);
     637    noteLayerPropertyChanged(NeedsComputeVisibleAndCoverageRect, DontScheduleFlush);
    619638}
    620639
     
    11751194}
    11761195
    1177 void GraphicsLayerCA::flushCompositingState(const FloatRect& visibleRect, FlushScope flushScope)
     1196void GraphicsLayerCA::flushCompositingState(const FloatRect& visibleRect)
    11781197{
    11791198    TransformState state(TransformState::UnapplyInverseTransformDirection, FloatQuad(visibleRect));
     
    11821201
    11831202    CommitState commitState;
    1184     commitState.ancestorHadChanges = visibleRect != m_previousCommittedVisibleRect || flushScope == FlushScope::All;
     1203    commitState.ancestorHadChanges = visibleRect != m_previousCommittedVisibleRect;
    11851204    m_previousCommittedVisibleRect = visibleRect;
     1205
     1206#if PLATFORM(IOS)
     1207    // In WK1, UIKit may be changing layer bounds behind our back in overflow-scroll layers, so disable the optimization.
     1208    // See the similar test in computeVisibleAndCoverageRect().
     1209    if (m_layer->isPlatformCALayerCocoa())
     1210        commitState.ancestorHadChanges = true;
     1211#endif
    11861212
    11871213    recursiveCommitChanges(commitState, state);
  • trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.h

    r215410 r215469  
    7777    WEBCORE_EXPORT void setPosition(const FloatPoint&) override;
    7878    WEBCORE_EXPORT void syncPosition(const FloatPoint&) override;
     79    WEBCORE_EXPORT void setApproximatePosition(const FloatPoint&) override;
    7980    WEBCORE_EXPORT void setAnchorPoint(const FloatPoint3D&) override;
    8081    WEBCORE_EXPORT void setSize(const FloatSize&) override;
    8182    WEBCORE_EXPORT void setBoundsOrigin(const FloatPoint&) override;
     83    WEBCORE_EXPORT void syncBoundsOrigin(const FloatPoint&) override;
    8284
    8385    WEBCORE_EXPORT void setTransform(const TransformationMatrix&) override;
     
    160162    void recursiveCommitChanges(const CommitState&, const TransformState&, float pageScaleFactor = 1, const FloatPoint& positionRelativeToBase = FloatPoint(), bool affectedByPageScale = false);
    161163
    162     WEBCORE_EXPORT void flushCompositingState(const FloatRect&, FlushScope) override;
     164    WEBCORE_EXPORT void flushCompositingState(const FloatRect&) override;
    163165    WEBCORE_EXPORT void flushCompositingStateForThisLayerOnly() override;
    164166
     
    497499        WindRuleChanged                         = 1LLU << 37,
    498500        UserInteractionEnabledChanged           = 1LLU << 38,
    499         PositionChanged                         = 1LLU << 39,
     501        NeedsComputeVisibleAndCoverageRect      = 1LLU << 39,
    500502    };
    501503    typedef uint64_t LayerChangeFlags;
  • trunk/Source/WebCore/platform/graphics/texmap/GraphicsLayerTextureMapper.cpp

    r215447 r215469  
    498498}
    499499
    500 void GraphicsLayerTextureMapper::flushCompositingState(const FloatRect& rect, FlushScope)
     500void GraphicsLayerTextureMapper::flushCompositingState(const FloatRect& rect)
    501501{
    502502    if (!m_layer.textureMapper())
  • trunk/Source/WebCore/platform/graphics/texmap/GraphicsLayerTextureMapper.h

    r215447 r215469  
    8484    void setShowRepaintCounter(bool) override;
    8585
    86     void flushCompositingState(const FloatRect&, FlushScope) override;
     86    void flushCompositingState(const FloatRect&) override;
    8787    void flushCompositingStateForThisLayerOnly() override;
    8888
  • trunk/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp

    r215410 r215469  
    573573}
    574574
    575 void CoordinatedGraphicsLayer::flushCompositingState(const FloatRect& rect, FlushScope)
     575void CoordinatedGraphicsLayer::flushCompositingState(const FloatRect& rect)
    576576{
    577577    if (CoordinatedGraphicsLayer* mask = downcast<CoordinatedGraphicsLayer>(maskLayer()))
  • trunk/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.h

    r215410 r215469  
    101101    void setContentsNeedsDisplay() override;
    102102    void deviceOrPageScaleFactorChanged() override;
    103     void flushCompositingState(const FloatRect&, FlushScope) override;
     103    void flushCompositingState(const FloatRect&) override;
    104104    void flushCompositingStateForThisLayerOnly() override;
    105105    bool setFilters(const FilterOperations&) override;
  • trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp

    r215425 r215469  
    453453
    454454        LOG_WITH_STREAM(Compositing,  stream << "\nRenderLayerCompositor " << this << " flushPendingLayerChanges(" << isFlushRoot << ") " << visibleRect);
    455         rootLayer->flushCompositingState(visibleRect, GraphicsLayer::FlushScope::Uncommitted);
     455        rootLayer->flushCompositingState(visibleRect);
    456456        LOG_WITH_STREAM(Compositing,  stream << "RenderLayerCompositor " << this << " flush complete\n");
    457457#endif
Note: See TracChangeset for help on using the changeset viewer.