Flatland is Scenic’s 2D composition API. Flatland offers functionality for Fuchsia’s graphics clients to construct their scene graph and submit to Scenic. Scenic then composes these into a united scene graph that is presented on the display.
Scenic provided graphics clients with a 3D API under the fuchsia.ui.gfx
namespace (the “Gfx api”). However, Fuchsia‘s current customers are fundamentally 2D products. This led to a mismatch between Scenic’s 3D scene representation and the 2D representation experienced by the user. Fuchsia decided that Gfx API is no longer suitable for the demands being placed on Scenic, both from a product standpoint and a performance standpoint. See Flatland roadmap entry for details on this decision. All of Fuchsia's graphics clients are being migrated to Flatland API.
Flatland aims to provide a lightweight composition API optimized for 2D rectangular layers only.
Flatland clients create content with rectangular layers that are positioned in X/Y. They submit their contents with the goal of reaching the display in a future vsync. Each Flatland client's content is submitted to Scenic independently.
Scenic, as the system compositor, processes these scene graphs to produce a united scene graph. Scenic may pass these graphical layers directly to the display. If not, Scenic may use Vulkan to render these graphical content to a single layer that is submitted to the display.
Here are some high level design decisions made around Flatland API:
fuchsia.ui.composition/Allocator
. No copies are made when transferring Image resources.The main protocol for creating and submitting a 2D scene graph. Connecting to Flatland protocol does not mean the submitted content can reach display. Flatland instance is still expected to connect to the global View Tree by creating its own View.
The input protocols that operate on the View that is created in this Flatland instance.
The protocol that provides information about the parent Flatland instance to the child Flatland instance.
The protocol that provides information about the child Flatland instance to the parent Flatland instance.