1 of 16

Tile Management

vmpstr@

2 of 16

Trees (renderer)

Main thread tree

Pending tree

commit

Active tree

activation

3 of 16

Picture layers

  • PictureLayers
    • RecordingSource (DisplayListRecordingSource, PicturePile)
      • Recorded by Blink
  • PictureLayerImpl
    • RasterSource (DisplayListRasterSource, PicturePileImpl)
      • Scale agnostic
      • Can raster itself into a canvas

4 of 16

Tiles, tilings, tiling sets

5 of 16

6 of 16

PictureLayerTiling regions

  • Viewport
    • Given by the layer (UDP)
  • Soon border
    • Padded viewport
  • Skewport
    • Viewport projected in time
  • Eventually
    • Padded viewport

7 of 16

Tiling set raster queue

  • Viewport
    • Left-to-right, top-to-bottom
  • Skewport
    • Spiral around viewport
  • Soon border
    • Spiral around viewport
    • Except skewport
  • Eventually
    • Spiral around soon border
    • Except skewport

8 of 16

Tiling set raster queue

  • Multiple tilings
    • Smoothness takes priority?
      • Yes: process LOW_RESOLUTION and HIGH_RESOLUTION.
      • No: process only HIGH_RESOLUTION.
  • Visit only tiles that need raster

9 of 16

10 of 16

Raster tile priority queue

  • Construction
    • For all picture layer impls,
      • Construct a tiling set raster queue for each layer’s tiling set
      • Construct a heap of tiling raster queues
        • Top tile of each queue determines priority
  • Look at top tile
    • Top tile in the top tiling raster queue
  • Remove top tile
    • Remove top tiling raster queue from heap,
    • Remove top tile from the tiling raster queue
    • Insert the tiling raster queue back into the heap

11 of 16

12 of 16

Eviction tile priority queue

  • Same as raster, but in reverse *handwave*
  • Processes all tilings

13 of 16

Tile manager

  • cc::Scheduler calls PrepareTiles
  • Schedules tiles to be rasterized
  • Evicts tiles to free up memory for other tiles
  • Informs cc::Scheduler when “interesting” events happen
    • All tiles required for draw are rasterized
    • All tiles required for activation are rasterized

14 of 16

Tile manager

  • Constructs a raster queue, gets up to 32 tiles
    • If it needs eviction, construct an eviction queue
  • Stops when memory policy says we should stop
    • Android: raster everything
    • Desktop: raster everything except the eventually rect
  • Schedules the work into a tile task worker pool
    • Previous work is canceled
  • Waits for one of three signals
    • All tiles required for draw are rasterized
    • All tiles required for activation are rasterized
    • All tiles are rasterized

15 of 16

Completion signals

  • All tiles required for {draw, activation} are rasterized
    • Construct another raster queue that only cares about “required” tiles
    • Check whether every tile in the queue is ready to draw
      • Yes: issue the signal to the client
      • No: do nothing
  • All tiles are rasterized
    • Schedule more!

16 of 16

Questions