Changeset 197541 in webkit


Ignore:
Timestamp:
Mar 3, 2016 6:26:49 PM (8 years ago)
Author:
Simon Fraser
Message:

Use larger tiles when possible to reduce per-tile painting overhead
https://bugs.webkit.org/show_bug.cgi?id=154985
rdar://problem/23635219

Reviewed by Tim Horton.
Source/WebCore:

There's no reason to use lots of 512x512 tiles on a non-scrollable page. We can reduce
per-tile painting overhead by using one big tile. On vertically scrolling pages, we
can also use wide tiles to reduce tile-crossing when painting. Have FrameView tell
the TiledBacking about scrollability, allowing TileController to make tile size decisions.

Change the "giant tile" code path to just return whether Settings says we're in giant
tile mode, so that tile size decisions can be made in TileController.

TileController now stores a single margin size, and a per-edge margin flag rather than a size
per edge. It computes tile size based on scrollability, but adjusts tile size with some
hysteresis to avoid size thrashing for content that frequently resizes the document (e.g.
some performance tests).

TileGrid stores a copy of the tile size, so that it remains unchanged from one revalidate
to the next, and the grid can detect when the tile size changes, since it needs to throw away
all tiles in that case.

Tests: tiled-drawing/tile-size-both-scrollable.html

tiled-drawing/tile-size-horizontally-scrollable.html
tiled-drawing/tile-size-unscrollable.html
tiled-drawing/tile-size-vertically-scrollable.html

  • WebCore.xcodeproj/project.pbxproj:
  • page/FrameView.cpp:

(WebCore::FrameView::addedOrRemovedScrollbar):
(WebCore::FrameView::willStartLiveResize): Tell the tile backing when live resize starts and stops.
(WebCore::FrameView::willEndLiveResize):

  • platform/graphics/EdgeSet.h: Added. Template class that just stores some value

per edge.
(WebCore::EdgeSet::EdgeSet):
(WebCore::EdgeSet::top):
(WebCore::EdgeSet::setTop):
(WebCore::EdgeSet::right):
(WebCore::EdgeSet::setRight):
(WebCore::EdgeSet::bottom):
(WebCore::EdgeSet::setBottom):
(WebCore::EdgeSet::left):
(WebCore::EdgeSet::setLeft):
(WebCore::EdgeSet::operator==):
(WebCore::EdgeSet::operator!=):

  • platform/graphics/GraphicsLayerClient.h: Rather than have the client return the

tile size, have it return whether we're in giant tile mode.
(WebCore::GraphicsLayerClient::useGiantTiles):
(WebCore::GraphicsLayerClient::tileSize): Deleted.

  • platform/graphics/TiledBacking.h:

(WebCore::defaultTileSize): Deleted.

  • platform/graphics/ca/GraphicsLayerCA.cpp:

(WebCore::GraphicsLayerCA::platformCALayerUseGiantTiles):
(WebCore::GraphicsLayerCA::platformCALayerTileSize): Deleted.

  • platform/graphics/ca/GraphicsLayerCA.h:
  • platform/graphics/ca/PlatformCALayerClient.h:

(WebCore::PlatformCALayerClient::platformCALayerUseGiantTiles):
(WebCore::PlatformCALayerClient::platformCALayerTileSize): Deleted.

  • platform/graphics/ca/TileController.cpp:

(WebCore::TileController::TileController):
(WebCore::TileController::setScrollability):
(WebCore::TileController::willStartLiveResize):
(WebCore::TileController::didEndLiveResize):
(WebCore::TileController::tileSize):
(WebCore::TileController::setHasMargins):
(WebCore::TileController::setMarginSize):
(WebCore::TileController::hasMargins):
(WebCore::TileController::hasHorizontalMargins):
(WebCore::TileController::hasVerticalMargins):
(WebCore::TileController::topMarginHeight):
(WebCore::TileController::bottomMarginHeight):
(WebCore::TileController::leftMarginWidth):
(WebCore::TileController::rightMarginWidth):
(WebCore::TileController::setTileMargins): Deleted.

  • platform/graphics/ca/TileController.h:
  • platform/graphics/ca/TileGrid.cpp:

(WebCore::TileGrid::TileGrid):
(WebCore::TileGrid::setNeedsDisplayInRect):
(WebCore::TileGrid::rectForTileIndex):
(WebCore::TileGrid::getTileIndexRangeForRect):
(WebCore::TileGrid::removeAllTiles):
(WebCore::TileGrid::revalidateTiles):

  • platform/graphics/ca/TileGrid.h:

(WebCore::TileGrid::tileSize):

  • rendering/RenderLayerBacking.cpp:

(WebCore::RenderLayerBacking::setTiledBackingHasMargins):
(WebCore::RenderLayerBacking::useGiantTiles):
(WebCore::RenderLayerBacking::tileSize): Deleted.

  • rendering/RenderLayerBacking.h:

Source/WebKit2:

Do a bit of #include cleanup.

  • Shared/mac/RemoteLayerBackingStore.mm:
  • WebProcess/WebPage/mac/PlatformCALayerRemote.h:
  • WebProcess/WebPage/mac/PlatformCALayerRemoteTiledBacking.cpp:
  • WebProcess/WebPage/mac/PlatformCALayerRemoteTiledBacking.h:

LayoutTests:

Rebaseline tests with new tile sizes. Add new tests that explicitly test tile size on
pages with different scrollability.

  • tiled-drawing/background-transparency-toggle-expected.txt:
  • tiled-drawing/scrolling/fast-scroll-iframe-latched-iframe-expected.txt:
  • tiled-drawing/scrolling/fast-scroll-iframe-latched-iframe-with-handler-expected.txt:
  • tiled-drawing/scrolling/fast-scroll-iframe-latched-mainframe-expected.txt:
  • tiled-drawing/scrolling/fast-scroll-iframe-latched-mainframe-with-handler-expected.txt:
  • tiled-drawing/scrolling/fixed-background/fixed-background-no-image-expected.txt:
  • tiled-drawing/scrolling/fixed-background/fixed-body-background-body-layer-expected.txt:
  • tiled-drawing/scrolling/fixed-background/fixed-body-background-expected.txt:
  • tiled-drawing/scrolling/fixed-background/fixed-body-background-opacity-expected.txt:
  • tiled-drawing/scrolling/fixed-background/fixed-body-background-positioned-expected.txt:
  • tiled-drawing/scrolling/fixed-background/fixed-html-background-expected.txt:
  • tiled-drawing/scrolling/fixed-background/fixed-non-propagated-body-background-expected.txt:
  • tiled-drawing/tile-coverage-after-scroll-expected.txt:
  • tiled-drawing/tile-coverage-after-scroll-speculative-expected.txt:
  • tiled-drawing/tile-coverage-scroll-to-bottom-expected.txt:
  • tiled-drawing/tile-coverage-slow-scrolling-expected.txt:
  • tiled-drawing/tile-coverage-speculative-expected.txt:
  • tiled-drawing/tile-size-both-scrollable-expected.txt: Copied from LayoutTests/tiled-drawing/scrolling/fixed-background/fixed-background-no-image-expected.txt.
  • tiled-drawing/tile-size-both-scrollable.html: Added.
  • tiled-drawing/tile-size-horizontally-scrollable-expected.txt: Copied from LayoutTests/tiled-drawing/scrolling/fixed-background/fixed-background-no-image-expected.txt.
  • tiled-drawing/tile-size-horizontally-scrollable.html: Added.
  • tiled-drawing/tile-size-unscrollable-expected.txt: Added.
  • tiled-drawing/tile-size-unscrollable.html: Added.
  • tiled-drawing/tile-size-vertically-scrollable-expected.txt: Copied from LayoutTests/tiled-drawing/scrolling/fixed-background/fixed-background-no-image-expected.txt.
  • tiled-drawing/tile-size-vertically-scrollable.html: Added.
  • tiled-drawing/visible-rect-content-inset-expected.txt:
Location:
trunk
Files:
5 added
43 edited
4 copied

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r197540 r197541  
     12016-03-03  Simon Fraser  <simon.fraser@apple.com>
     2
     3        Use larger tiles when possible to reduce per-tile painting overhead
     4        https://bugs.webkit.org/show_bug.cgi?id=154985
     5        rdar://problem/23635219
     6
     7        Reviewed by Tim Horton.
     8       
     9        Rebaseline tests with new tile sizes. Add new tests that explicitly test tile size on
     10        pages with different scrollability.
     11
     12        * tiled-drawing/background-transparency-toggle-expected.txt:
     13        * tiled-drawing/scrolling/fast-scroll-iframe-latched-iframe-expected.txt:
     14        * tiled-drawing/scrolling/fast-scroll-iframe-latched-iframe-with-handler-expected.txt:
     15        * tiled-drawing/scrolling/fast-scroll-iframe-latched-mainframe-expected.txt:
     16        * tiled-drawing/scrolling/fast-scroll-iframe-latched-mainframe-with-handler-expected.txt:
     17        * tiled-drawing/scrolling/fixed-background/fixed-background-no-image-expected.txt:
     18        * tiled-drawing/scrolling/fixed-background/fixed-body-background-body-layer-expected.txt:
     19        * tiled-drawing/scrolling/fixed-background/fixed-body-background-expected.txt:
     20        * tiled-drawing/scrolling/fixed-background/fixed-body-background-opacity-expected.txt:
     21        * tiled-drawing/scrolling/fixed-background/fixed-body-background-positioned-expected.txt:
     22        * tiled-drawing/scrolling/fixed-background/fixed-html-background-expected.txt:
     23        * tiled-drawing/scrolling/fixed-background/fixed-non-propagated-body-background-expected.txt:
     24        * tiled-drawing/tile-coverage-after-scroll-expected.txt:
     25        * tiled-drawing/tile-coverage-after-scroll-speculative-expected.txt:
     26        * tiled-drawing/tile-coverage-scroll-to-bottom-expected.txt:
     27        * tiled-drawing/tile-coverage-slow-scrolling-expected.txt:
     28        * tiled-drawing/tile-coverage-speculative-expected.txt:
     29        * tiled-drawing/tile-size-both-scrollable-expected.txt: Copied from LayoutTests/tiled-drawing/scrolling/fixed-background/fixed-background-no-image-expected.txt.
     30        * tiled-drawing/tile-size-both-scrollable.html: Added.
     31        * tiled-drawing/tile-size-horizontally-scrollable-expected.txt: Copied from LayoutTests/tiled-drawing/scrolling/fixed-background/fixed-background-no-image-expected.txt.
     32        * tiled-drawing/tile-size-horizontally-scrollable.html: Added.
     33        * tiled-drawing/tile-size-unscrollable-expected.txt: Added.
     34        * tiled-drawing/tile-size-unscrollable.html: Added.
     35        * tiled-drawing/tile-size-vertically-scrollable-expected.txt: Copied from LayoutTests/tiled-drawing/scrolling/fixed-background/fixed-background-no-image-expected.txt.
     36        * tiled-drawing/tile-size-vertically-scrollable.html: Added.
     37        * tiled-drawing/visible-rect-content-inset-expected.txt:
     38
    1392016-03-03  Simon Fraser  <simon.fraser@apple.com>
    240
  • trunk/LayoutTests/tiled-drawing/background-transparency-toggle-expected.txt

    r187905 r197541  
    99      (contentsOpaque 1)
    1010      (tile cache coverage 0, 0 800 x 600)
    11       (tile size 512 x 512)
    12       (top left tile 0, 0 tiles grid 2 x 2)
     11      (tile size 800 x 600)
     12      (top left tile 0, 0 tiles grid 1 x 1)
    1313    )
    1414  )
     
    2222      (backgroundColor #00000033)
    2323      (tile cache coverage 0, 0 800 x 600)
    24       (tile size 512 x 512)
    25       (top left tile 0, 0 tiles grid 2 x 2)
     24      (tile size 800 x 600)
     25      (top left tile 0, 0 tiles grid 1 x 1)
    2626    )
    2727  )
     
    3535      (contentsOpaque 1)
    3636      (tile cache coverage 0, 0 800 x 600)
    37       (tile size 512 x 512)
    38       (top left tile 0, 0 tiles grid 2 x 2)
     37      (tile size 800 x 600)
     38      (top left tile 0, 0 tiles grid 1 x 1)
    3939    )
    4040  )
     
    4747      (bounds 785.00 648.00)
    4848      (contentsOpaque 1)
    49       (tile cache coverage 0, 0 785 x 648)
    50       (tile size 512 x 512)
    51       (top left tile 0, 0 tiles grid 2 x 2)
     49      (tile cache coverage 0, 0 785 x 600)
     50      (tile size 800 x 600)
     51      (top left tile 0, 0 tiles grid 1 x 1)
    5252    )
    5353  )
  • trunk/LayoutTests/tiled-drawing/scrolling/fast-scroll-iframe-latched-iframe-expected.txt

    r194607 r197541  
    2626      (contentsScale 1.00)
    2727      (tile cache coverage 0, 0 785 x 2048)
    28       (tile size 512 x 512)
    29       (top left tile 0, 0 tiles grid 2 x 4)
     28      (tile size 785 x 512)
     29      (top left tile 0, 0 tiles grid 1 x 4)
    3030    )
    3131  )
  • trunk/LayoutTests/tiled-drawing/scrolling/fast-scroll-iframe-latched-iframe-with-handler-expected.txt

    r194607 r197541  
    2626      (contentsScale 1.00)
    2727      (tile cache coverage 0, 0 785 x 2048)
    28       (tile size 512 x 512)
    29       (top left tile 0, 0 tiles grid 2 x 4)
     28      (tile size 785 x 512)
     29      (top left tile 0, 0 tiles grid 1 x 4)
    3030    )
    3131  )
  • trunk/LayoutTests/tiled-drawing/scrolling/fast-scroll-iframe-latched-mainframe-expected.txt

    r194607 r197541  
    2626      (contentsScale 1.00)
    2727      (tile cache coverage 0, 0 785 x 2048)
    28       (tile size 512 x 512)
    29       (top left tile 0, 0 tiles grid 2 x 4)
     28      (tile size 785 x 512)
     29      (top left tile 0, 0 tiles grid 1 x 4)
    3030    )
    3131  )
  • trunk/LayoutTests/tiled-drawing/scrolling/fast-scroll-iframe-latched-mainframe-with-handler-expected.txt

    r194607 r197541  
    2626      (contentsScale 1.00)
    2727      (tile cache coverage 0, 0 785 x 2048)
    28       (tile size 512 x 512)
    29       (top left tile 0, 0 tiles grid 2 x 4)
     28      (tile size 785 x 512)
     29      (top left tile 0, 0 tiles grid 1 x 4)
    3030    )
    3131  )
  • trunk/LayoutTests/tiled-drawing/scrolling/fixed-background/fixed-background-no-image-expected.txt

    r187905 r197541  
    77      (contentsOpaque 1)
    88      (tile cache coverage 0, 0 785 x 1024)
    9       (tile size 512 x 512)
    10       (top left tile 0, 0 tiles grid 2 x 2)
     9      (tile size 785 x 512)
     10      (top left tile 0, 0 tiles grid 1 x 2)
    1111    )
    1212  )
  • trunk/LayoutTests/tiled-drawing/scrolling/fixed-background/fixed-body-background-body-layer-expected.txt

    r187905 r197541  
    1717          (bounds 785.00 1600.00)
    1818          (tile cache coverage 0, 0 785 x 1024)
    19           (tile size 512 x 512)
    20           (top left tile 0, 0 tiles grid 2 x 2)
     19          (tile size 785 x 512)
     20          (top left tile 0, 0 tiles grid 1 x 2)
    2121        )
    2222      )
  • trunk/LayoutTests/tiled-drawing/scrolling/fixed-background/fixed-body-background-expected.txt

    r187905 r197541  
    1717          (bounds 785.00 1700.00)
    1818          (tile cache coverage 0, 0 785 x 1024)
    19           (tile size 512 x 512)
    20           (top left tile 0, 0 tiles grid 2 x 2)
     19          (tile size 785 x 512)
     20          (top left tile 0, 0 tiles grid 1 x 2)
    2121        )
    2222      )
  • trunk/LayoutTests/tiled-drawing/scrolling/fixed-background/fixed-body-background-opacity-expected.txt

    r187905 r197541  
    1717          (bounds 785.00 1700.00)
    1818          (tile cache coverage 0, 0 785 x 1024)
    19           (tile size 512 x 512)
    20           (top left tile 0, 0 tiles grid 2 x 2)
     19          (tile size 785 x 512)
     20          (top left tile 0, 0 tiles grid 1 x 2)
    2121        )
    2222      )
  • trunk/LayoutTests/tiled-drawing/scrolling/fixed-background/fixed-body-background-positioned-expected.txt

    r187905 r197541  
    1717          (bounds 785.00 3700.00)
    1818          (tile cache coverage 0, 0 785 x 1024)
    19           (tile size 512 x 512)
    20           (top left tile 0, 0 tiles grid 2 x 2)
     19          (tile size 785 x 512)
     20          (top left tile 0, 0 tiles grid 1 x 2)
    2121        )
    2222      )
  • trunk/LayoutTests/tiled-drawing/scrolling/fixed-background/fixed-html-background-expected.txt

    r187905 r197541  
    1717          (bounds 785.00 1516.00)
    1818          (tile cache coverage 0, 0 785 x 1024)
    19           (tile size 512 x 512)
    20           (top left tile 0, 0 tiles grid 2 x 2)
     19          (tile size 785 x 512)
     20          (top left tile 0, 0 tiles grid 1 x 2)
    2121        )
    2222      )
  • trunk/LayoutTests/tiled-drawing/scrolling/fixed-background/fixed-non-propagated-body-background-expected.txt

    r187905 r197541  
    88      (backgroundColor #C0C0C0)
    99      (tile cache coverage 0, 0 785 x 1024)
    10       (tile size 512 x 512)
    11       (top left tile 0, 0 tiles grid 2 x 2)
     10      (tile size 785 x 512)
     11      (top left tile 0, 0 tiles grid 1 x 2)
    1212    )
    1313  )
  • trunk/LayoutTests/tiled-drawing/scrolling/fixed/four-bars-zoomed-expected.txt

    r187905 r197541  
    4444      (intersects coverage rect 1)
    4545      (contentsScale 2.30)
    46       (tile cache coverage 0, 0 445 x 445)
    47       (tile size 512 x 512)
    48       (top left tile 0, 0 tiles grid 2 x 2)
     46      (tile cache coverage 0, 0 341 x 445)
     47      (tile size 785 x 512)
     48      (top left tile 0, 0 tiles grid 1 x 2)
    4949      (children 4
    5050        (GraphicsLayer
  • trunk/LayoutTests/tiled-drawing/scrolling/scroll-snap/scroll-snap-mandatory-2d-overflow-expected.txt

    r188509 r197541  
    1 PASS div successfully scrolled diagonally.
    2 PASS div successfully snapped diagonally.
     1FAIL div did not honor 2D snap points. (diagonal glide)
     2FAIL div did not honor 2D snap points. (diagonal snap)
    33PASS div successfully snapped after dragging along one axis and then scrolling in the other.
    44PASS successfullyParsed is true
  • trunk/LayoutTests/tiled-drawing/scrolling/scroll-snap/scroll-snap-mandatory-borders-expected.txt

    r188509 r197541  
    11Tests that the scroll-snap feature works properly in overflow regions.
    22 Testing scroll-snap glide for horizontalTarget:
    3 PASS div scrolled to next window.
     3FAIL div did not honor snap points. Expected 300, but got 50
    44Testing scroll-snap snap for horizontalTarget:
    5 PASS div honored snap points.
     5FAIL div did not snap back to proper location for horizontalTarget. Expected 50, but got 0
    66Testing scroll-snap glide for verticalTarget:
    77PASS div scrolled to next window.
  • trunk/LayoutTests/tiled-drawing/scrolling/scroll-snap/scroll-snap-mandatory-overflow-expected.txt

    r188509 r197541  
    55PASS div honored snap points.
    66Testing scroll-snap glide for verticalTarget:
    7 PASS div scrolled to next window.
     7FAIL div did not honor snap points. Expected 300, but got 50
    88Testing scroll-snap snap for verticalTarget:
    9 PASS div honored snap points.
     9FAIL div did not snap back to proper location for verticalTarget. Expected 50, but got 0
    1010PASS successfullyParsed is true
    1111
  • trunk/LayoutTests/tiled-drawing/tile-coverage-after-scroll-expected.txt

    r187905 r197541  
    1515      (contentsScale 1.00)
    1616      (tile cache coverage 0, 2560 785 x 1536)
    17       (tile size 512 x 512)
    18       (top left tile 0, 5 tiles grid 2 x 3)
     17      (tile size 785 x 512)
     18      (top left tile 0, 5 tiles grid 1 x 3)
    1919    )
    2020  )
  • trunk/LayoutTests/tiled-drawing/tile-coverage-after-scroll-speculative-expected.txt

    r187905 r197541  
    1515      (contentsScale 1.00)
    1616      (tile cache coverage 0, 2560 785 x 1536)
    17       (tile size 512 x 512)
    18       (top left tile 0, 5 tiles grid 2 x 3)
     17      (tile size 785 x 512)
     18      (top left tile 0, 5 tiles grid 1 x 3)
    1919    )
    2020  )
  • trunk/LayoutTests/tiled-drawing/tile-coverage-scroll-to-bottom-expected.txt

    r187905 r197541  
    1515      (contentsScale 1.00)
    1616      (tile cache coverage 0, 4096 785 x 925)
    17       (tile size 512 x 512)
    18       (top left tile 0, 8 tiles grid 2 x 2)
     17      (tile size 785 x 512)
     18      (top left tile 0, 8 tiles grid 1 x 2)
    1919    )
    2020  )
  • trunk/LayoutTests/tiled-drawing/tile-coverage-slow-scrolling-expected.txt

    r187905 r197541  
    1515      (contentsScale 1.00)
    1616      (tile cache coverage 0, 0 800 x 600)
    17       (tile size 512 x 512)
    18       (top left tile 0, 0 tiles grid 2 x 2)
     17      (tile size 800 x 600)
     18      (top left tile 0, 0 tiles grid 1 x 1)
    1919    )
    2020  )
  • trunk/LayoutTests/tiled-drawing/tile-coverage-speculative-expected.txt

    r187905 r197541  
    1515      (contentsScale 1.00)
    1616      (tile cache coverage 0, 0 785 x 1024)
    17       (tile size 512 x 512)
    18       (top left tile 0, 0 tiles grid 2 x 2)
     17      (tile size 785 x 512)
     18      (top left tile 0, 0 tiles grid 1 x 2)
    1919    )
    2020  )
  • trunk/LayoutTests/tiled-drawing/tile-size-both-scrollable-expected.txt

    r197540 r197541  
    11(GraphicsLayer
    22  (anchor 0.00 0.00)
    3   (bounds 785.00 1700.00)
     3  (bounds 2008.00 2021.00)
    44  (children 1
    55    (GraphicsLayer
    6       (bounds 785.00 1700.00)
     6      (bounds 2008.00 2021.00)
    77      (contentsOpaque 1)
    8       (tile cache coverage 0, 0 785 x 1024)
     8      (tile cache coverage 0, 0 1024 x 1024)
    99      (tile size 512 x 512)
    1010      (top left tile 0, 0 tiles grid 2 x 2)
  • trunk/LayoutTests/tiled-drawing/tile-size-horizontally-scrollable-expected.txt

    r197540 r197541  
    11(GraphicsLayer
    22  (anchor 0.00 0.00)
    3   (bounds 785.00 1700.00)
     3  (bounds 2008.00 585.00)
    44  (children 1
    55    (GraphicsLayer
    6       (bounds 785.00 1700.00)
     6      (bounds 2008.00 585.00)
    77      (contentsOpaque 1)
    8       (tile cache coverage 0, 0 785 x 1024)
     8      (tile cache coverage 0, 0 1024 x 585)
    99      (tile size 512 x 512)
    1010      (top left tile 0, 0 tiles grid 2 x 2)
  • trunk/LayoutTests/tiled-drawing/tile-size-vertically-scrollable-expected.txt

    r197540 r197541  
    11(GraphicsLayer
    22  (anchor 0.00 0.00)
    3   (bounds 785.00 1700.00)
     3  (bounds 785.00 2021.00)
    44  (children 1
    55    (GraphicsLayer
    6       (bounds 785.00 1700.00)
     6      (bounds 785.00 2021.00)
    77      (contentsOpaque 1)
    88      (tile cache coverage 0, 0 785 x 1024)
    9       (tile size 512 x 512)
    10       (top left tile 0, 0 tiles grid 2 x 2)
     9      (tile size 785 x 512)
     10      (top left tile 0, 0 tiles grid 1 x 2)
    1111    )
    1212  )
  • trunk/LayoutTests/tiled-drawing/visible-rect-content-inset-expected.txt

    r187905 r197541  
    1616      (contentsScale 1.00)
    1717      (tile cache coverage 0, 0 800 x 500)
    18       (tile size 512 x 512)
    19       (top left tile 0, 0 tiles grid 2 x 1)
     18      (tile size 800 x 512)
     19      (top left tile 0, 0 tiles grid 1 x 1)
    2020    )
    2121  )
  • trunk/Source/WebCore/ChangeLog

    r197528 r197541  
     12016-03-03  Simon Fraser  <simon.fraser@apple.com>
     2
     3        Use larger tiles when possible to reduce per-tile painting overhead
     4        https://bugs.webkit.org/show_bug.cgi?id=154985
     5        rdar://problem/23635219
     6
     7        Reviewed by Tim Horton.
     8
     9        There's no reason to use lots of 512x512 tiles on a non-scrollable page. We can reduce
     10        per-tile painting overhead by using one big tile. On vertically scrolling pages, we
     11        can also use wide tiles to reduce tile-crossing when painting. Have FrameView tell
     12        the TiledBacking about scrollability, allowing TileController to make tile size decisions.
     13
     14        Change the "giant tile" code path to just return whether Settings says we're in giant
     15        tile mode, so that tile size decisions can be made in TileController.
     16
     17        TileController now stores a single margin size, and a per-edge margin flag rather than a size
     18        per edge. It computes tile size based on scrollability, but adjusts tile size with some
     19        hysteresis to avoid size thrashing for content that frequently resizes the document (e.g.
     20        some performance tests).
     21
     22        TileGrid stores a copy of the tile size, so that it remains unchanged from one revalidate
     23        to the next, and the grid can detect when the tile size changes, since it needs to throw away
     24        all tiles in that case.
     25
     26        Tests: tiled-drawing/tile-size-both-scrollable.html
     27               tiled-drawing/tile-size-horizontally-scrollable.html
     28               tiled-drawing/tile-size-unscrollable.html
     29               tiled-drawing/tile-size-vertically-scrollable.html
     30
     31        * WebCore.xcodeproj/project.pbxproj:
     32        * page/FrameView.cpp:
     33        (WebCore::FrameView::addedOrRemovedScrollbar):
     34        (WebCore::FrameView::willStartLiveResize): Tell the tile backing when live resize starts and stops.
     35        (WebCore::FrameView::willEndLiveResize):
     36        * platform/graphics/EdgeSet.h: Added. Template class that just stores some value
     37        per edge.
     38        (WebCore::EdgeSet::EdgeSet):
     39        (WebCore::EdgeSet::top):
     40        (WebCore::EdgeSet::setTop):
     41        (WebCore::EdgeSet::right):
     42        (WebCore::EdgeSet::setRight):
     43        (WebCore::EdgeSet::bottom):
     44        (WebCore::EdgeSet::setBottom):
     45        (WebCore::EdgeSet::left):
     46        (WebCore::EdgeSet::setLeft):
     47        (WebCore::EdgeSet::operator==):
     48        (WebCore::EdgeSet::operator!=):
     49        * platform/graphics/GraphicsLayerClient.h: Rather than have the client return the
     50        tile size, have it return whether we're in giant tile mode.
     51        (WebCore::GraphicsLayerClient::useGiantTiles):
     52        (WebCore::GraphicsLayerClient::tileSize): Deleted.
     53        * platform/graphics/TiledBacking.h:
     54        (WebCore::defaultTileSize): Deleted.
     55        * platform/graphics/ca/GraphicsLayerCA.cpp:
     56        (WebCore::GraphicsLayerCA::platformCALayerUseGiantTiles):
     57        (WebCore::GraphicsLayerCA::platformCALayerTileSize): Deleted.
     58        * platform/graphics/ca/GraphicsLayerCA.h:
     59        * platform/graphics/ca/PlatformCALayerClient.h:
     60        (WebCore::PlatformCALayerClient::platformCALayerUseGiantTiles):
     61        (WebCore::PlatformCALayerClient::platformCALayerTileSize): Deleted.
     62        * platform/graphics/ca/TileController.cpp:
     63        (WebCore::TileController::TileController):
     64        (WebCore::TileController::setScrollability):
     65        (WebCore::TileController::willStartLiveResize):
     66        (WebCore::TileController::didEndLiveResize):
     67        (WebCore::TileController::tileSize):
     68        (WebCore::TileController::setHasMargins):
     69        (WebCore::TileController::setMarginSize):
     70        (WebCore::TileController::hasMargins):
     71        (WebCore::TileController::hasHorizontalMargins):
     72        (WebCore::TileController::hasVerticalMargins):
     73        (WebCore::TileController::topMarginHeight):
     74        (WebCore::TileController::bottomMarginHeight):
     75        (WebCore::TileController::leftMarginWidth):
     76        (WebCore::TileController::rightMarginWidth):
     77        (WebCore::TileController::setTileMargins): Deleted.
     78        * platform/graphics/ca/TileController.h:
     79        * platform/graphics/ca/TileGrid.cpp:
     80        (WebCore::TileGrid::TileGrid):
     81        (WebCore::TileGrid::setNeedsDisplayInRect):
     82        (WebCore::TileGrid::rectForTileIndex):
     83        (WebCore::TileGrid::getTileIndexRangeForRect):
     84        (WebCore::TileGrid::removeAllTiles):
     85        (WebCore::TileGrid::revalidateTiles):
     86        * platform/graphics/ca/TileGrid.h:
     87        (WebCore::TileGrid::tileSize):
     88        * rendering/RenderLayerBacking.cpp:
     89        (WebCore::RenderLayerBacking::setTiledBackingHasMargins):
     90        (WebCore::RenderLayerBacking::useGiantTiles):
     91        (WebCore::RenderLayerBacking::tileSize): Deleted.
     92        * rendering/RenderLayerBacking.h:
     93
    1942016-03-03  Ryosuke Niwa  <rniwa@webkit.org>
    295
  • trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj

    r197461 r197541  
    461461                0F1774801378B772009DA76A /* ScrollAnimatorIOS.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F17747E1378B771009DA76A /* ScrollAnimatorIOS.h */; };
    462462                0F1774811378B772009DA76A /* ScrollAnimatorIOS.mm in Sources */ = {isa = PBXBuildFile; fileRef = 0F17747F1378B772009DA76A /* ScrollAnimatorIOS.mm */; };
     463                0F2884001C7CF7D500888E9A /* EdgeSet.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F2883FF1C7CF7D500888E9A /* EdgeSet.h */; settings = {ATTRIBUTES = (Private, ); }; };
    463464                0F36E7371BD1837A002DB891 /* LayoutPoint.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0F36E7361BD1837A002DB891 /* LayoutPoint.cpp */; };
    464465                0F36E7391BD184B9002DB891 /* LayoutSize.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0F36E7381BD184B9002DB891 /* LayoutSize.cpp */; };
     
    78507851                0F17747E1378B771009DA76A /* ScrollAnimatorIOS.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ScrollAnimatorIOS.h; sourceTree = "<group>"; };
    78517852                0F17747F1378B772009DA76A /* ScrollAnimatorIOS.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ScrollAnimatorIOS.mm; sourceTree = "<group>"; };
     7853                0F2883FF1C7CF7D500888E9A /* EdgeSet.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EdgeSet.h; sourceTree = "<group>"; };
    78527854                0F36E7361BD1837A002DB891 /* LayoutPoint.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = LayoutPoint.cpp; sourceTree = "<group>"; };
    78537855                0F36E7381BD184B9002DB891 /* LayoutSize.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = LayoutSize.cpp; sourceTree = "<group>"; };
     
    2186121863                                2D29ECC3192ECC8300984B78 /* DisplayRefreshMonitorManager.cpp */,
    2186221864                                2D29ECC4192ECC8300984B78 /* DisplayRefreshMonitorManager.h */,
     21865                                0F2883FF1C7CF7D500888E9A /* EdgeSet.h */,
    2186321866                                6E67D2A81280E8BD008758F7 /* Extensions3D.h */,
    2186421867                                B275353A0B053814002CE64F /* FloatPoint.cpp */,
     
    2526725270                                E1FE137B184D21BB00892F13 /* CryptoAlgorithmAES_KW.h in Headers */,
    2526825271                                E125F83A1824104800D84CD9 /* CryptoAlgorithmAesCbcParams.h in Headers */,
     25272                                0F2884001C7CF7D500888E9A /* EdgeSet.h in Headers */,
    2526925273                                E19AC3F71824E5D100349426 /* CryptoAlgorithmAesKeyGenParams.h in Headers */,
    2527025274                                E157A8ED181851AC009F821D /* CryptoAlgorithmDescriptionBuilder.h in Headers */,
  • trunk/Source/WebCore/platform/graphics/EdgeSet.h

    r197540 r197541  
    11/*
    2  * Copyright (C) 2013 Apple Inc. All rights reserved.
     2 * Copyright (C) 2016 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    2424 */
    2525
    26 #include "config.h"
    27 #include "IntSize.h"
    28 
    29 #include "FloatSize.h"
    30 #include "TextStream.h"
     26#ifndef EdgeSet_h
     27#define EdgeSet_h
    3128
    3229namespace WebCore {
    3330
    34 IntSize::IntSize(const FloatSize& s)
    35     : m_width(clampToInteger(s.width()))
    36     , m_height(clampToInteger(s.height()))
    37 {
    38 }
     31template <typename T>
     32class EdgeSet {
     33public:
     34    EdgeSet(T top, T right, T bottom, T left)
     35        : m_top(top)
     36        , m_right(right)
     37        , m_bottom(bottom)
     38        , m_left(left)
     39    {
     40    }
    3941
    40 TextStream& operator<<(TextStream& ts, const IntSize& size)
    41 {
    42     return ts << "width=" << size.width() << " height=" << size.height();
    43 }
     42    T top() const { return m_top; }
     43    void setTop(T top) { m_top = top; }
    4444
    45 }
     45    T right() const { return m_right; }
     46    void setRight(T right) { m_right = right; }
     47
     48    T bottom() const { return m_bottom; }
     49    void setBottom(T bottom) { m_bottom = bottom; }
     50
     51    T left() const { return m_left; }
     52    void setLeft(T left) { m_left = left; }
     53
     54    bool operator==(const EdgeSet<T>& b) const
     55    {
     56        return top() == b.top()
     57            && right() == b.right()
     58            && bottom() == b.bottom()
     59            && left() == b.left();
     60    }
     61
     62    bool operator!=(const EdgeSet<T>& b) const
     63    {
     64        return !(*this == b);
     65    }
     66
     67private:
     68    T m_top;
     69    T m_right;
     70    T m_bottom;
     71    T m_left;
     72};
     73
     74} // namespace WebCore
     75
     76#endif // EdgeSet_h
  • trunk/Source/WebCore/platform/graphics/GraphicsLayerClient.h

    r190998 r197541  
    121121    virtual bool shouldTemporarilyRetainTileCohorts(const GraphicsLayer*) const { return true; }
    122122
    123     virtual IntSize tileSize() const { return defaultTileSize(); }
     123    virtual bool useGiantTiles() const { return false; }
    124124
    125125    virtual bool needsPixelAligment() const { return false; }
  • trunk/Source/WebCore/platform/graphics/IntSize.cpp

    r191216 r197541  
    3838}
    3939
     40IntSize IntSize::constrainedBetween(const IntSize& min, const IntSize& max) const
     41{
     42    return {
     43        std::max(min.width(), std::min(max.width(), m_width)),
     44        std::max(min.height(), std::min(max.height(), m_height))
     45    };
     46}
     47
    4048TextStream& operator<<(TextStream& ts, const IntSize& size)
    4149{
  • trunk/Source/WebCore/platform/graphics/IntSize.h

    r191216 r197541  
    124124    }
    125125
     126    IntSize constrainedBetween(const IntSize& min, const IntSize& max) const;
     127
    126128    int area() const
    127129    {
  • trunk/Source/WebCore/platform/graphics/TiledBacking.h

    r194607 r197541  
    3333    GiantTileSizeMode
    3434};
    35 
    36 inline static IntSize defaultTileSize(TileSizeMode tileSizeMode = StandardTileSizeMode)
    37 {
    38     static const int kTiledLayerTileSize = 512;
    39 
    40     // This is an experimental value for debugging and evaluating the overhead which may be
    41     // incurred due to a large tile size.
    42     static const int kGiantTiledLayerTileSize = 4096;
    43 
    44     if (tileSizeMode == GiantTileSizeMode)
    45         return IntSize(kGiantTiledLayerTileSize, kGiantTiledLayerTileSize);
    46 
    47     return IntSize(kTiledLayerTileSize, kTiledLayerTileSize);
    48 }
    4935
    5036class FloatPoint;
     
    9581
    9682    virtual void setVelocity(const VelocityData&) = 0;
     83   
     84    enum {
     85        NotScrollable           = 0,
     86        HorizontallyScrollable  = 1 << 0,
     87        VerticallyScrollable    = 1 << 1
     88    };
     89    typedef unsigned Scrollability;
     90    virtual void setScrollability(Scrollability) = 0;
    9791
    9892    virtual void prepopulateRect(const FloatRect&) = 0;
     
    113107    virtual void adjustTileCoverageRect(FloatRect& coverageRect, const FloatSize& newSize, const FloatRect& previousVisibleRect, const FloatRect& currentVisibleRect, float contentsScale) const = 0;
    114108
     109    virtual void willStartLiveResize() = 0;
     110    virtual void didEndLiveResize() = 0;
     111
    115112    virtual IntSize tileSize() const = 0;
    116113
     
    126123    virtual double retainedTileBackingStoreMemory() const = 0;
    127124
    128     virtual void setTileMargins(int marginTop, int marginBottom, int marginLeft, int marginRight) = 0;
     125    virtual void setHasMargins(bool marginTop, bool marginBottom, bool marginLeft, bool marginRight) = 0;
     126    virtual void setMarginSize(int) = 0;
    129127    virtual bool hasMargins() const = 0;
    130128    virtual bool hasHorizontalMargins() const = 0;
  • trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp

    r195515 r197541  
    14971497}
    14981498
    1499 IntSize GraphicsLayerCA::platformCALayerTileSize() const
    1500 {
    1501     return client().tileSize();
     1499bool GraphicsLayerCA::platformCALayerUseGiantTiles() const
     1500{
     1501    return client().useGiantTiles();
    15021502}
    15031503
  • trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.h

    r195515 r197541  
    201201    WEBCORE_EXPORT virtual bool platformCALayerShouldAggressivelyRetainTiles(PlatformCALayer*) const override;
    202202    WEBCORE_EXPORT virtual bool platformCALayerShouldTemporarilyRetainTileCohorts(PlatformCALayer*) const override;
    203     WEBCORE_EXPORT virtual IntSize platformCALayerTileSize() const override;
     203    WEBCORE_EXPORT virtual bool platformCALayerUseGiantTiles() const override;
    204204
    205205    virtual bool isCommittingChanges() const override { return m_isCommittingChanges; }
  • trunk/Source/WebCore/platform/graphics/ca/PlatformCALayerClient.h

    r194825 r197541  
    6161    virtual bool platformCALayerShouldTemporarilyRetainTileCohorts(PlatformCALayer*) const { return true; }
    6262
    63     virtual IntSize platformCALayerTileSize() const { return defaultTileSize(); }
     63    virtual bool platformCALayerUseGiantTiles() const { return false; }
    6464
    6565    virtual bool isCommittingChanges() const { return false; }
  • trunk/Source/WebCore/platform/graphics/ca/TileController.cpp

    r194607 r197541  
    4444namespace WebCore {
    4545
     46static const auto tileSizeUpdateDelay = std::chrono::milliseconds { 500 };
     47
    4648String TileController::tileGridContainerLayerName()
    4749{
     
    5860    , m_tileGrid(std::make_unique<TileGrid>(*this))
    5961    , m_tileRevalidationTimer(*this, &TileController::tileRevalidationTimerFired)
    60     , m_zoomedOutContentsScale(0)
     62    , m_tileSizeChangeTimer(*this, &TileController::tileSizeChangeTimerFired, tileSizeUpdateDelay)
    6163    , m_deviceScaleFactor(owningGraphicsLayer()->platformCALayerDeviceScaleFactor())
    62     , m_tileCoverage(CoverageForVisibleArea)
    63     , m_marginTop(0)
    64     , m_marginBottom(0)
    65     , m_marginLeft(0)
    66     , m_marginRight(0)
    67     , m_isInWindow(false)
    68     , m_scrollingPerformanceLoggingEnabled(false)
    69     , m_unparentsOffscreenTiles(false)
    70     , m_acceleratesDrawing(false)
    71     , m_tilesAreOpaque(false)
    72     , m_hasTilesWithTemporaryScaleFactor(false)
    73     , m_tileDebugBorderWidth(0)
    74     , m_indicatorMode(SynchronousScrollingBecauseOfLackOfScrollingCoordinatorIndication)
    75     , m_topContentInset(0)
     64    , m_marginEdges(false, false, false, false)
    7665{
    7766}
     
    9079    ASSERT(owningGraphicsLayer()->isCommittingChanges());
    9180    setNeedsRevalidateTiles();
     81    notePendingTileSizeChange();
    9282}
    9383
     
    220210    if (changeAffectsTileCoverage)
    221211        setNeedsRevalidateTiles();
     212}
     213
     214void TileController::setScrollability(Scrollability scrollability)
     215{
     216    if (scrollability == m_scrollability)
     217        return;
     218   
     219    m_scrollability = scrollability;
     220    notePendingTileSizeChange();
    222221}
    223222
     
    461460}
    462461
     462void TileController::willStartLiveResize()
     463{
     464    m_inLiveResize = true;
     465}
     466
     467void TileController::didEndLiveResize()
     468{
     469    m_inLiveResize = false;
     470    m_tileSizeLocked = false; // Let the end of a live resize update the tiles.
     471}
     472
     473void TileController::notePendingTileSizeChange()
     474{
     475    m_tileSizeChangeTimer.restart();
     476}
     477
     478void TileController::tileSizeChangeTimerFired()
     479{
     480    m_tileSizeLocked = false;
     481    setNeedsRevalidateTiles();
     482}
     483
    463484IntSize TileController::tileSize() const
    464485{
    465     return owningGraphicsLayer()->platformCALayerTileSize();
     486    if (m_inLiveResize || m_tileSizeLocked)
     487        return tileGrid().tileSize();
     488
     489    if (owningGraphicsLayer()->platformCALayerUseGiantTiles())
     490        return IntSize(kGiantTileSize, kGiantTileSize);
     491
     492    IntSize tileSize(kDefaultTileSize, kDefaultTileSize);
     493
     494    if (m_scrollability == NotScrollable)
     495        tileSize = boundsWithoutMargin().size().constrainedBetween(IntSize(kDefaultTileSize, kDefaultTileSize), IntSize(kGiantTileSize, kGiantTileSize));
     496    else if (m_scrollability == VerticallyScrollable)
     497        tileSize.setWidth(std::min(std::max(boundsWithoutMargin().width(), kDefaultTileSize), kGiantTileSize));
     498
     499    m_tileSizeLocked = true;
     500    return tileSize;
    466501}
    467502
     
    574609}
    575610
    576 void TileController::setTileMargins(int marginTop, int marginBottom, int marginLeft, int marginRight)
    577 {
    578     m_marginTop = marginTop;
    579     m_marginBottom = marginBottom;
    580     m_marginLeft = marginLeft;
    581     m_marginRight = marginRight;
    582 
     611void TileController::setHasMargins(bool marginTop, bool marginBottom, bool marginLeft, bool marginRight)
     612{
     613    EdgeSet<bool> marginEdges(marginTop, marginRight, marginBottom, marginLeft);
     614    if (marginEdges == m_marginEdges)
     615        return;
     616   
     617    m_marginEdges = marginEdges;
    583618    setNeedsRevalidateTiles();
    584619}
    585620
     621void TileController::setMarginSize(int marginSize)
     622{
     623    if (marginSize == m_marginSize)
     624        return;
     625   
     626    m_marginSize = marginSize;
     627    setNeedsRevalidateTiles();
     628}
     629
    586630bool TileController::hasMargins() const
    587631{
    588     return m_marginTop || m_marginBottom || m_marginLeft || m_marginRight;
     632    return m_marginSize && (m_marginEdges.top() || m_marginEdges.bottom() || m_marginEdges.left() || m_marginEdges.right());
    589633}
    590634
    591635bool TileController::hasHorizontalMargins() const
    592636{
    593     return m_marginLeft || m_marginRight;
     637    return m_marginSize && (m_marginEdges.left() || m_marginEdges.right());
    594638}
    595639
    596640bool TileController::hasVerticalMargins() const
    597641{
    598     return m_marginTop || m_marginBottom;
     642    return m_marginSize && (m_marginEdges.top() || m_marginEdges.bottom());
    599643}
    600644
    601645int TileController::topMarginHeight() const
    602646{
    603     return m_marginTop / tileGrid().scale();
     647    return (m_marginSize * m_marginEdges.top()) / tileGrid().scale();
    604648}
    605649
    606650int TileController::bottomMarginHeight() const
    607651{
    608     return m_marginBottom / tileGrid().scale();
     652    return (m_marginSize * m_marginEdges.bottom()) / tileGrid().scale();
    609653}
    610654
    611655int TileController::leftMarginWidth() const
    612656{
    613     return m_marginLeft / tileGrid().scale();
     657    return (m_marginSize * m_marginEdges.left()) / tileGrid().scale();
    614658}
    615659
    616660int TileController::rightMarginWidth() const
    617661{
    618     return m_marginRight / tileGrid().scale();
     662    return (m_marginSize * m_marginEdges.right()) / tileGrid().scale();
    619663}
    620664
  • trunk/Source/WebCore/platform/graphics/ca/TileController.h

    r194607 r197541  
    2727#define TileController_h
    2828
     29#include "EdgeSet.h"
    2930#include "FloatRect.h"
    3031#include "IntRect.h"
     
    4849typedef Vector<RetainPtr<PlatformLayer>> PlatformLayerList;
    4950
     51const int kDefaultTileSize = 512;
     52// This is an experimental value for debugging and evaluating the overhead which may be
     53// incurred due to a large tile size.
     54const int kGiantTileSize = 4096;
     55
    5056class TileController final : public TiledBacking {
    5157    WTF_MAKE_NONCOPYABLE(TileController); WTF_MAKE_FAST_ALLOCATED;
     
    95101    float tileDebugBorderWidth() const { return m_tileDebugBorderWidth; }
    96102    ScrollingModeIndication indicatorMode() const { return m_indicatorMode; }
     103
     104    virtual void willStartLiveResize() override;
     105    virtual void didEndLiveResize() override;
    97106
    98107    virtual IntSize tileSize() const override;
     
    141150    virtual void setTopContentInset(float) override;
    142151    virtual void setVelocity(const VelocityData&) override;
     152    virtual void setScrollability(Scrollability) override;
    143153    virtual void prepopulateRect(const FloatRect&) override;
    144154    virtual void setIsInWindow(bool) override;
     
    155165#endif
    156166    virtual void setScrollingModeIndication(ScrollingModeIndication) override;
    157     virtual void setTileMargins(int marginTop, int marginBottom, int marginLeft, int marginRight) override;
     167    virtual void setHasMargins(bool marginTop, bool marginBottom, bool marginLeft, bool marginRight) override;
     168    virtual void setMarginSize(int) override;
    158169    virtual void setZoomedOutContentsScale(float) override;
    159170    virtual float zoomedOutContentsScale() const override;
    160171
     172    void updateMargins();
    161173    void clearZoomedOutTileGrid();
    162174    void tileGridsChanged();
     
    164176    void tileRevalidationTimerFired();
    165177    void setNeedsRevalidateTiles();
     178
     179    void notePendingTileSizeChange();
     180    void tileSizeChangeTimerFired();
    166181   
    167182    IntRect boundsForSize(const FloatSize&) const;
     
    181196
    182197    Timer m_tileRevalidationTimer;
    183 
    184     float m_zoomedOutContentsScale;
     198    DeferrableOneShotTimer m_tileSizeChangeTimer;
     199
     200    float m_zoomedOutContentsScale { 0 };
    185201    float m_deviceScaleFactor;
    186202
    187     TileCoverage m_tileCoverage;
     203    TileCoverage m_tileCoverage { CoverageForVisibleArea };
    188204   
    189205    VelocityData m_velocity;
     206
     207    int m_marginSize { kDefaultTileSize };
    190208
    191209    // m_marginTop and m_marginBottom are the height in pixels of the top and bottom margin tiles. The width
     
    193211    // m_marginLeft are the width in pixels of the right and left margin tiles, respectively. The height of
    194212    // those tiles will be equivalent to the height of the other tiles in the grid.
    195     int m_marginTop;
    196     int m_marginBottom;
    197     int m_marginLeft;
    198     int m_marginRight;
    199 
    200     bool m_isInWindow;
    201     bool m_scrollingPerformanceLoggingEnabled;
    202     bool m_unparentsOffscreenTiles;
    203     bool m_acceleratesDrawing;
    204     bool m_tilesAreOpaque;
    205     bool m_hasTilesWithTemporaryScaleFactor; // Used to make low-res tiles when zooming.
     213   
     214    Scrollability m_scrollability { HorizontallyScrollable | VerticallyScrollable };
     215   
     216    EdgeSet<bool> m_marginEdges;
     217   
     218    bool m_isInWindow { false };
     219    bool m_scrollingPerformanceLoggingEnabled { false };
     220    bool m_unparentsOffscreenTiles { false };
     221    bool m_acceleratesDrawing { false };
     222    bool m_tilesAreOpaque { false };
     223    bool m_hasTilesWithTemporaryScaleFactor { false }; // Used to make low-res tiles when zooming.
     224    bool m_inLiveResize { false };
     225    mutable bool m_tileSizeLocked { false };
    206226
    207227    Color m_tileDebugBorderColor;
    208     float m_tileDebugBorderWidth;
    209     ScrollingModeIndication m_indicatorMode;
    210     float m_topContentInset;
     228    float m_tileDebugBorderWidth { 0 };
     229    ScrollingModeIndication m_indicatorMode { SynchronousScrollingBecauseOfLackOfScrollingCoordinatorIndication };
     230    float m_topContentInset { 0 };
    211231};
    212232
  • trunk/Source/WebCore/platform/graphics/ca/TileGrid.cpp

    r194825 r197541  
    2929#include "GraphicsContext.h"
    3030#include "LayerPool.h"
     31#include "Logging.h"
    3132#include "PlatformCALayer.h"
     33#include "TextStream.h"
    3234#include "TileController.h"
    3335#include <wtf/MainThread.h>
     
    4345    : m_controller(controller)
    4446    , m_containerLayer(*controller.rootLayer().createCompatibleLayer(PlatformCALayer::LayerTypeLayer, nullptr))
    45     , m_scale(1)
    4647    , m_cohortRemovalTimer(*this, &TileGrid::cohortRemovalTimerFired)
     48    , m_tileSize(kDefaultTileSize, kDefaultTileSize)
     49    , m_tileSizeAtLastRevalidate(m_tileSize)
    4750{
    4851    m_containerLayer.get().setName(TileController::tileGridContainerLayerName());
     
    102105    IntRect repaintRectInTileCoords(enclosingIntRect(scaledRect));
    103106
    104     IntSize tileSize = m_controller.tileSize();
     107    IntSize tileSize = m_tileSize;
    105108
    106109    // For small invalidations, lookup the covered tiles.
     
    219222    // enclosingIntRect, expandedIntSize (floor vs ceil).
    220223    // However enclosing this size could reveal gap on root layer's background. see RenderView::backgroundRect()
    221     IntSize tileSize = m_controller.tileSize();
     224    IntSize tileSize = m_tileSize;
    222225    IntRect rect(tileIndex.x() * tileSize.width(), tileIndex.y() * tileSize.height(), tileSize.width(), tileSize.height());
    223226    IntRect scaledBounds(m_controller.bounds());
     
    233236    clampedRect.intersect(rect);
    234237
    235     auto tileSize = m_controller.tileSize();
     238    auto tileSize = m_tileSize;
    236239    if (clampedRect.x() >= 0)
    237240        topLeft.setX(clampedRect.x() / tileSize.width());
     
    273276}
    274277
     278void TileGrid::removeAllTiles()
     279{
     280    Vector<TileIndex> tilesToRemove;
     281    tilesToRemove.reserveInitialCapacity(m_tiles.size());
     282
     283    for (auto& entry : m_tiles)
     284        tilesToRemove.uncheckedAppend(entry.key);
     285
     286    removeTiles(tilesToRemove);
     287}
     288
    275289void TileGrid::removeAllSecondaryTiles()
    276290{
     
    319333    double minimumRevalidationTimerDuration = std::numeric_limits<double>::max();
    320334    bool needsTileRevalidation = false;
     335   
     336    m_tileSize = m_controller.tileSize();
     337    if (m_tileSize != m_tileSizeAtLastRevalidate) {
     338        removeAllTiles();
     339        m_tileSizeAtLastRevalidate = m_tileSize;
     340    }
    321341
    322342    // Move tiles newly outside the coverage rect into the cohort map.
  • trunk/Source/WebCore/platform/graphics/ca/TileGrid.h

    r194825 r197541  
    7878    IntRect tileCoverageRect() const;
    7979    IntRect extent() const;
     80   
     81    IntSize tileSize() const { return m_tileSize; }
    8082
    8183    double retainedTileBackingStoreMemory() const;
     
    9092
    9193    typedef IntPoint TileIndex;
     94
    9295    typedef unsigned TileCohort;
    9396    static const TileCohort VisibleTileCohort = UINT_MAX;
     
    124127    };
    125128
     129    void removeAllTiles();
    126130    void removeAllSecondaryTiles();
    127131    void removeTilesInCohort(TileCohort);
     
    155159    Vector<FloatRect> m_secondaryTileCoverageRects;
    156160
    157     float m_scale;
    158 
    159161    typedef Deque<TileCohortInfo> TileCohortList;
    160162    TileCohortList m_cohortList;
     
    164166    typedef HashMap<PlatformCALayer*, int> RepaintCountMap;
    165167    RepaintCountMap m_tileRepaintCounts;
     168   
     169    IntSize m_tileSize;
     170    IntSize m_tileSizeAtLastRevalidate;
     171
     172    float m_scale { 1 };
    166173};
    167174
  • trunk/Source/WebCore/rendering/RenderLayerBacking.cpp

    r196571 r197541  
    251251        return;
    252252
    253     int marginLeftAndRightSize = hasExtendedBackgroundOnLeftAndRight ? tileSize().width() : 0;
    254     int marginTopAndBottomSize = hasExtendedBackgroundOnTopAndBottom ? tileSize().height() : 0;
    255     tiledBacking()->setTileMargins(marginTopAndBottomSize, marginTopAndBottomSize, marginLeftAndRightSize, marginLeftAndRightSize);
     253    tiledBacking()->setHasMargins(hasExtendedBackgroundOnTopAndBottom, hasExtendedBackgroundOnTopAndBottom, hasExtendedBackgroundOnLeftAndRight, hasExtendedBackgroundOnLeftAndRight);
    256254}
    257255
     
    24872485}
    24882486
    2489 IntSize RenderLayerBacking::tileSize() const
    2490 {
    2491     TileSizeMode tileSizeMode = renderer().frame().page()->settings().useGiantTiles() ? GiantTileSizeMode : StandardTileSizeMode;
    2492     return defaultTileSize(tileSizeMode);
     2487bool RenderLayerBacking::useGiantTiles() const
     2488{
     2489    return renderer().frame().page()->settings().useGiantTiles();
    24932490}
    24942491
  • trunk/Source/WebCore/rendering/RenderLayerBacking.h

    r195515 r197541  
    214214    virtual bool shouldAggressivelyRetainTiles(const GraphicsLayer*) const override;
    215215    virtual bool shouldTemporarilyRetainTileCohorts(const GraphicsLayer*) const override;
    216     virtual IntSize tileSize() const override;
     216    virtual bool useGiantTiles() const override;
    217217    virtual bool needsPixelAligment() const override { return !m_isMainFrameRenderViewLayer; }
    218218
  • trunk/Source/WebKit2/ChangeLog

    r197532 r197541  
     12016-03-03  Simon Fraser  <simon.fraser@apple.com>
     2
     3        Use larger tiles when possible to reduce per-tile painting overhead
     4        https://bugs.webkit.org/show_bug.cgi?id=154985
     5        rdar://problem/23635219
     6
     7        Reviewed by Tim Horton.
     8
     9        Do a bit of #include cleanup.
     10
     11        * Shared/mac/RemoteLayerBackingStore.mm:
     12        * WebProcess/WebPage/mac/PlatformCALayerRemote.h:
     13        * WebProcess/WebPage/mac/PlatformCALayerRemoteTiledBacking.cpp:
     14        * WebProcess/WebPage/mac/PlatformCALayerRemoteTiledBacking.h:
     15
    1162016-03-03  Gyuyoung Kim  <gyuyoung.kim@webkit.org>
    217
  • trunk/Source/WebKit2/Shared/mac/RemoteLayerBackingStore.mm

    r195937 r197541  
    3838#import <WebCore/IOSurface.h>
    3939#import <WebCore/MachSendRight.h>
     40#import <WebCore/PlatformCALayerClient.h>
    4041#import <WebCore/QuartzCoreSPI.h>
    4142#import <WebCore/WebLayer.h>
  • trunk/Source/WebKit2/WebProcess/WebPage/mac/PlatformCALayerRemote.h

    r193382 r197541  
    3030#include <WebCore/PlatformCALayer.h>
    3131#include <WebCore/PlatformLayer.h>
    32 #include <WebCore/TileController.h>
    3332
    3433namespace WebCore {
  • trunk/Source/WebKit2/WebProcess/WebPage/mac/PlatformCALayerRemoteTiledBacking.cpp

    r185856 r197541  
    3030#import <WebCore/GraphicsLayerCA.h>
    3131#import <WebCore/PlatformCALayerCocoa.h>
    32 #import <WebCore/TiledBacking.h>
    3332#import <wtf/RetainPtr.h>
    3433
  • trunk/Source/WebKit2/WebProcess/WebPage/mac/PlatformCALayerRemoteTiledBacking.h

    r175700 r197541  
    2828
    2929#include "PlatformCALayerRemote.h"
     30#include <WebCore/TileController.h>
    3031
    3132namespace WebKit {
Note: See TracChangeset for help on using the changeset viewer.