Date post: | 15-Jan-2015 |
Category: |
Technology |
Upload: | chen-tankery |
View: | 822 times |
Download: | 3 times |
How to Achieve 60 fpsHW Rendering in WebKit for Android
Xijun Chen
2
Agenda
• Overview of rendering in Android WebKit
• Key process of rendering and bottlenecks
• Break bottlenecks• Details of HW rendering
3
Overview of rendering (flattened)
DOM Tree(Render Object Tree)
Render Layer Tree
Layout Painting
Screen
RasterizationContent
Web Contents
4
rendering bottleneck
Reasonscroll & zoom
(viewport change)
animation
content change
ImpactRasterization
Painting
Layout
5
Things we can do
• Reduce work• Avoid duplicate work (cache)• Avoid useless work (only work for visible
area)
• Parallelization• Bring complicate things to extra thread• Bring things to other graphics devices
6
Layers for cache
• Render Layer• Avoid layout• Separate the render objects to diff layer
• Graphics Layer (Layer Android)• Avoid painting• Merge render layers by graphic property
• Tile Grids• Avoid rasterization• Merge and raster android layers to Surfaces
with tile grids in it.• Composite and display Surface using GPU
7
Overview of rendering (composited)
DOM Tree(Render Object Tree)
Render Layer TreeDisplay Tree
(LayerAndroid Tree)
Layout Painting
Screen
Rasterization (SW)
Raste
rizati
on (H
W)
Tile Grid
Display (HW)
(Ren
derin
g thr
ead)
(GPU)
8
HW Rendering Structure
Drawing Collection
Painting Collection
Queued Collection
SurfaceCollectionManager Surfaces
SurfaceCollection
Surface Backing
Display Layers
Surface
9
HW Rendering Structure
Front TileGrid
Back TileGrid
Low Res TileGrid
SurfaceBacking
(0, 0) (0, 1)
(1, 0) (1, 1)
(2, 0) (2, 1)
TileGrid
TileGrid
ImageTexture
10
HW Rendering Structure
Front Texture
Back Texture
Tile Tile Texture
• TextureInfo• Size
11
HW Rendering Process
12
Some code – SurfaceCollectionManager::drawGL
13
Some code - SurfaceBacking::prepareGL
14
Some code - PaintTileOperation
TileGrid::prepareTile
Use painter to paint tile.The painter is either Surface or ImageTexture
15
Some code - Tile
16
Some code – Interact with GLTransferQueue::updateDirtyTiles
TileTexture::drawGL
17
Q & AThanks!