Cuttlefish's accelerated graphics mode uses your host machine's physical graphics processing unit (GPU) for rendering by passing guest rendering commands to your host machine, running the rendering commands calls on your host machine, and passing the rendered results back to the guest.
By default, guest-side rendering (for example, UI and video playback) in your Cuttlefish device is handled by SwiftShader. SwiftShader is a software implementation of the OpenGL and Vulkan APIs. Because SwiftShader is a software implementation, it provides a universally accessible rendering solution for Cuttlefish capable of running on any host machine.
However, using SwiftShader isn't as performant as a normal device. Rendering is a parallel problem that can be massively parallelized, as pixel values can be computed independently. Graphics processing units (GPUs) are hardware units that address this problem by accelerating rendering.
Accelerated graphics mode requires that the host have:
- EGL capable driver supporting the
- OpenGL ES capable driver
- Vulkan capable driver
Using accelerated graphics modes
To use the GfxStream accelerated graphics mode, launch your local Cuttlefish
device with the
--gpu_mode=gfxstream flag. Using this mode, OpenGL and Vulkan
API calls are forwarded directly to the host.
To use the Virgl accelerated graphics mode, launch your local Cuttlefish device
When using the Virgl accelerated graphics mode, OpenGL API calls are translated into an intermediate representation (see Gallium3D). The intermediate representation is communicated to the host and the virglrenderer library on the host translates the intermediate representation back to OpenGL API calls.