1# Rutabaga Virtual Graphics Interface 2 3The Rutabaga Virtual Graphics Interface (VGI) is a cross-platform abstraction for GPU and display 4virtualization. The virtio-gpu 5[context type](https://www.phoronix.com/news/VirtIO-Linux-5.16-Ctx-Type) feature is used to dispatch 6commands between various Rust, C++, and C implementations. The diagram below does not exhaustively 7depict all available context types. 8 9<!-- Image from https://goto.google.com/crosvm-rutabaga-diagram --> 10 11 12 13## Rust API 14 15Although hosted in the crosvm repository, the Rutabaga VGI is designed to be portable across VMM 16implementations. The Rust API is available on [crates.io](https://crates.io/crates/rutabaga_gfx). 17 18## Rutabaga C API 19 20The following documentation shows how to build Rutabaga's C API with gfxstream enabled, which is the 21common use case. 22 23### Build dependencies 24 25```sh 26sudo apt install libdrm libglm-dev libstb-dev 27``` 28 29### Build AEMU base 30 31```sh 32git clone https://android.googlesource.com/platform/hardware/google/aemu 33cd aemu/ 34cmake -DAEMU_COMMON_GEN_PKGCONFIG=ON \ 35 -DAEMU_COMMON_BUILD_CONFIG=gfxstream \ 36 -DENABLE_VKCEREAL_TESTS=OFF -B build 37cmake --build build -j 38sudo cmake --install build 39``` 40 41### Build gfxstream 42 43```sh 44git clone https://android.googlesource.com/platform/hardware/google/gfxstream 45cd gfxstream/ 46meson setup -Ddefault_library=static build/ 47meson install -C build 48``` 49 50### Build FFI bindings to Rutabaga 51 52```sh 53cd $(crosvm_dir)/rutabaga_gfx/ffi/ 54make 55sudo make install 56``` 57 58### Guest-side gfxstream libraries 59 60If your VMM boots to a Linux guest, it's possible to run gfxstream with that. 61 62```sh 63git clone https://android.googlesource.com/platform/hardware/google/gfxstream 64cd gfxstream/guest 65meson setup build/ 66meson install -C build 67``` 68 69Some headless Vulkan tests (`deqp-vk`, `vulkaninfo`) should work after that, but others may not 70(such as `vulkan-samples`). 71 72### Latest releases for potential packaging 73 74- [Rutabaga FFI v0.1.2](https://crates.io/crates/rutabaga_gfx_ffi) 75- [gfxstream v0.1.2](https://android-review.googlesource.com/c/platform/hardware/google/gfxstream/+/2710135) 76- [AEMU v0.1.2](https://android-review.googlesource.com/c/platform/hardware/google/aemu/+/2708637) 77