一 GL ICS
1.
Layer.h
Layer.cpp
LayerAndroid.h
LayerAndroid.cpp
MediaLayer.h
MediaLayer.cpp
MediaTexture.h
MediaTexture.cpp
TreeManager.h
TreeManager.cpp
GLWebViewState.h
GLWebViewState.cpp
TiledPage.h
TiledPage.cpp
PaintedSurface.h
PaintedSurface.cpp
TilePainter.h
MediaListener.h
2
//file or so?
SurfaceTexture.h //gui
SurfaceTexture.cpp //gui
ISurfaceTexture.h
ISurfaceTexture.cpp
SurfaceTextureClient.h
SurfaceTextureClient.cpp
3.
MediaLayer:
1.SurfaceTexture
2.LayerAndroid
3.MediaTexture
4.TilesManager
1.SurfaceTexture: libgui.
2.LayerAndroid.
3.MediaTexture:
3.1MediaListener.
3.2SurfaceTextureClient
二 AC
RendrObject present contents on a display surface by issuing draw call to GraphicsContext.
In Chrome most GraphicsContext calls become calls to an SkCanvas or SkPlatformCanvas. There is one GraphicsContext for the entire page.
From RenderOjbects to RenerLayers
Each RenderObject is associated with a RenderLayer either directly or indirectly via an ancestor
RenderObject.
1.
RenderLayer tree hierarchy
the root Layer has two list. negZOrderList, child layers with negative z-indices(go above the current layers). posZOrderList child layers with positive z-indices (layers go under the current layer)
2
Trees
DOM tree, RenderObject tree, RenderLayer tree.
3
Render Path
software path and hardware accelerated path.
3.1.software:
a.Determines whether the layer intersects the damage rect for an early out.
b.Recursively paints the layers below this one by calling paintLayer() for the layers in the
negZOrderList.
c.Asks RenderObjects associated with this RenderLayer to paint themselves.
d.This is done by recursing down the RenderObject tree starting with the RenderObject which created the layer. Traversal stops whenever a RenderObject associated with a different RenderLayer is found.
e.Recursively paints the layers above this one by calling paintLayer() for the layers in the
posZOrderList.
RenderProcess->Shared Memory->BrowserProcess
Once all the RenderLayers are done painting into the shared bitmap the bitmap still needs to make it onto the screen.
3.2.Hardware Basics
some (but not all) of the RenderLayers get their own backing surface,layers with their own backing
surfaces are called compositing layers。
Layer to surface, A subsequent compositing pass composites all the backing surface onto the destination bitmap. It's a two-phase approach.
Further, since painting of the layers is decoupled from compositing, invalidating one of these layers only results in repainting the contents of that layer alone and recompositing.
In contrast, with the software path, invalidating any layer requires repainting all layers (at least the overlapping portions of them) below and above it which unnecessarily taxes the CPU RenderLayerCompositor-->GraphicsLayerClient
4
tree for Compositor
With accelerated compositing, we need a GraphicsContext for each compositing layer.
DOMTree/RenderTree/RenderLayerTree/GraphicsLayer()
Every single RenderLayer could paint itself into a separate backing surface could be a wasteful.
In webkit one of the following condition must to be met for a RenderLayer to get it's own compositing layer.
Layer has 3D or perspective transform CSS properties
Layer is used by <video> element using accelerated video decoding
Layer is used by a <canvas> element with a 3D context or accelerated 2D context
Layer is used for a composited plugin
Layer uses a CSS animation for its opacity or uses an animated webkit transform
Layer uses accelerated CSS filters
Layer has a descendant that is a compositing layer
Layer has a sibling with a lower z-index which has a compositing layer (in other words the layer is rendered on top of a composited layer)
5.where is GPU
the compositor will render the Layer to GPU. The compositor can't directly issue calls to the 3D apis prividered by the OS(use D3D on Windows , opengl everywhere else.)
client.putBuffer--->Server.pickupandperform
(whole process:
layer->Surface, compositor->3D server,3D server->screen.
4
tree for Compositor
With accelerated compositing, we need a GraphicsContext for each compositing layer.
DOMTree/RenderTree/RenderLayerTree/GraphicsLayer()
Every single RenderLayer could paint itself into a separate backing surface could be a wasteful.
In webkit one of the following condition must to be met for a RenderLayer to get it's own compositing layer.
Layer has 3D or perspective transform CSS properties
Layer is used by <video> element using accelerated video decoding
Layer is used by a <canvas> element with a 3D context or accelerated 2D context
Layer is used for a composited plugin
Layer uses a CSS animation for its opacity or uses an animated webkit transform
Layer uses accelerated CSS filters
Layer has a descendant that is a compositing layer
Layer has a sibling with a lower z-index which has a compositing layer (in other words the layer is rendered on top of a composited layer)
5.where is GPU
the compositor will render the Layer to GPU. The compositor can't directly issue calls to the 3D apis prividered by the OS(use D3D on Windows , opengl everywhere else.)
client.putBuffer--->Server.pickupandperform
(whole process:
layer->Surface, compositor->3D server,3D server->screen.
6.Tiling
rasterizing the RenderLayer to GPU as a texture, the RenderLayers can be arbitratily.
The solution is tiling. Each layer is split up into tiles. We determine which parts the layer are need on the GPU and only paint+upload these tiles.
三
1.Display process
DOM node produces RenderObject. RenderObject paint the contents on a display surface. RenderObject do this by call draw to GraphicsContext, GraphicsContext writes pixels into a bitmap.
Skia is GraphicsContext wrapper.
2.RenderObjects and RenderLayer
each RenderObject has a RenderLayer.
So, there are three trees.
DOM tree,
RenderObject tree,
RenderLayer tree.
3.Software Rendering Path
Traversing the RenderLayer hierachy renders a web page.
?How does RenderObject to GraphicsContext, and where is RenderLayer?
FrameView.paintContents->RenderLayer.paint->paintLayer->paintLayerContents->Render.paint()->SubRennder.paint()
4.Hardware path
in hardware accelerated path, RenderLayers has surface. So they will paint on the surface.
The compositor work start with a RenderLayer tree and end up with a single bitmap.
5. GraphicsLayers
for hardware path, each RenderLayer has a GraphicsContext.
RenderLayer::updateCompositingAndLayerListsIfNeeded->compositor().updateCompositingLayers
a.GraphicsLayerAndroid owns LayerAndroid?
b.RenderLayer has RenderLayerBacking/RenderBoxModelObject;
c.RenderView has RenderLayerCompositor