wiki:AGC

Version 1 (modified by noam.rosenthal@nokia.com, 9 years ago) (diff)

--

AGC - or Accelerated Graphics Context

AGC is an initiative to support hardware acceleration in WebKit, at a lower level than today's accelerated compositing.

Right now the architecture looks something like the following: Document -> Renderer -> Compositor -> Platform-specific layer system (QGraphicsView, CoreAnimations, Chromium layers...)

... where the compositor is invoked for CSS opacity/transform animations and 3D transforms.

The idea is to share the layer system across platforms, with a common GLES2 implementation, and to have the following as platform specific parts:

  1. Content rasterizer: each layer's content is still handled in software by the platform.
  2. Setting up the GL context: The web-view has to initiate a GL context and make it current before letting WebCore render into it
  3. Optionally, a platform-specific implementation of AGC.

The purpose

The purpose for this is to make it easy for ports to use the accelerated-compositing feature of webkit, without having to write a whole scene-graph library. The theory is that WebCore already retains the scene-graph, so there's no need for an additional scene-graph library underneath it, and what's needed is simple translation from the model to a paint sequence.

The API

AGC is a low level API tuned to what GPU and blitter hardware can actually accelerate, unlike the GraphicsContext API which is more of a classic 2D software API. The only primitives available to AGC are Texture, Surface and Quad. The idea is that the backend for AGC would know how to draw a texture on a surface in a given quad (which is usually represented as a rectangle + matrix), and the frontend, which is GraphicsLayerAGC, would translate the retainable-scenegraph model it gets from WebCore into a paint sequence that includes almost exclusively mapping textures between surfaces (other functions may include rudimentary clipping). This allows, for example, accelerated reflections and accelerated masks with multi-texturing.

Files

Currently in http://gitorious.org/~noamr/webkit/noamrs-webkit/commits/AGC See:

platform/graphics/AcceleratedGraphicsContext.h
platform/graphics/GraphicsLayerAGC.h
platform/graphics/GraphicsLayerAGC.cpp
platform/graphics/AGCOpenGL.h
platform/graphics/AGCOpenGL.cpp
platform/graphics/qt/AGCQt.h
platform/graphics/qt/AGCQt.cpp