Gfxstream Merged Into Mesa For Vulkan Virtualization

Written by Michael Larabel in Mesa on 20 September 2024 at 06:42 AM EDT. 8 Comments
MESA
After seven months under review, Google's Gfxstream code has been upstreamed into Mesa 24.3 as a Vulkan virtualization solution.

Google/Chromium engineers have been working on Gfxstream as part of their Rutabaga Virtual Graphics Interface as a cross-platform abstraction for GPU and display virtualization. This goes in-step with their CrosVM efforts. Those learning about the Rutabaga Virtual Graphics Interface for the first time can learn more via the CrosVM.dev documentation.

VGI slide


Gfxstream within Mesa exists as another new Vulkan driver "gfxstream-experimental" and consists of around 26k lines of new code.

The merge request sums up the Mesa-side Gfxstream code as:
Graphics Streaming Kit is a code generator that makes it easier to serialize and forward graphics API calls from one place to another.

- 1:1 threading model - each guest Vulkan encoder thread gets host side decoding thread
- Support for both virtio-gpu, goldish and testing transports.
- Support for Android, Fuchsia, and Linux guests.
- Ring Buffer to stream commands, in the style of io_uring.
- Currently, there are a set of Mesa objects and gfxstream objects. For example, struct gfxstream_vk_device and the gfxstream object goldfish_device both are internal representations of Vulkan opaque handle VkDevice. The Mesa object is used first, since Mesa provides dispatch. The Mesa object contains a key to the hash table to get a gfxstream internal object (for example, gfxstream_vk_device::internal_object). Eventually, gfxstream objects will be phased out and Mesa objects used exclusively.
- Codegen is done in the codgen directory. It adds another generator to Vulkan-Docs generator, and our goal has been to upstream it eventually.

Google uses Gfxstream within the Android Emulator, Cuttlefish. Google Play Games, Fuchsia guests, AAOS reference guests, and various experimental projects.

More background information on Gfxstream for Mesa can be found within this mailing list thread.
Related News
About The Author
Michael Larabel

Michael Larabel is the principal author of Phoronix.com and founded the site in 2004 with a focus on enriching the Linux hardware experience. Michael has written more than 20,000 articles covering the state of Linux hardware support, Linux performance, graphics drivers, and other topics. Michael is also the lead developer of the Phoronix Test Suite, Phoromatic, and OpenBenchmarking.org automated benchmarking software. He can be followed via Twitter, LinkedIn, or contacted via MichaelLarabel.com.

Popular News This Week