Scene Elements

This topic provides an introduction to the concept of scene elements within the context of graphics composition. Scene elements are sometimes referred to as layers.

Variant: ScreenPlay. Target audience: Device creators.

Within a composition scene, elements map surfaces to screen rectangles. Depth ordering (z-order) is used to resolve how the elements overlap each other. The elements support some basic pixel rectangle transformations such as scaling and rotation in 90 degree increments.

The following diagram shows the three elements in a video telephony use case. The uppermost element (with a red border) contains the UI content (called the UI surface). This is semi-transparent and is owned by the Window Server. The next element down is the camera viewfinder (green border). The surface associated with this element is owned by the camera. The final element (blue border) shows a video of the caller. The surface associated with this element is owned by the video renderer.

Figure 1. The elements in a video telephony use case

A similar principle applies when a game is running on the phone. The semi-transparent UI surface would overlay the element containing the EGL-owned surface. When the game or a video is in full screen mode, the composition engine can enter fast path mode. This indicates to the LCD controller that there is no UI content to blend with the background element.

Figure 2. Fast path mode

The z-order of an element is determined by its position in the list of elements. Several additional pieces of positional information are stored as element metadata. The element maps the surface to the device screen. More specifically it maps a part of the surface, the source rectangle, to a destination rectangle on the screen. The destination rectangle defines the position and size of the element itself.

Figure 3. Element terminology

The source rectangle corresponds to the viewport in the Window Server documentation and the destination rectangle corresponds to the extent.

The source and destination rectangles do not have to be the same sizeā€”the composition engine can clip or scale the data to fit.

The following concepts are related to elements:

  • Scene structure

    A set of elements, all with a specific size, visible region and z-order, which when composed form an entire scene.

  • Scene content

    A set of surfaces bound with elements that contain the pixels to be composed according to the structure described by the scene structure.

This distinction between the scene structure and scene content is important. The architecture is split so that the Window Server deals only with the scene structure and UI content and not with the scene content. This allows optimal data and control paths. For example, it has the advantage that the Window Server does not need to take any action when the content of a video surface changes but the UI does not change.

The components in the Graphics Composition collection are divided between those that manage the scene structure and those that manage scene content:

  • The composition engine manages scene structure. This means that the composition engine mainly deals in elements and dictates how the scene is composed.

  • The Surface Manager and the Surface Update Server manage scene content. This means that they mainly deal in surfaces.