rutabaga_gfx

Crates.iorutabaga_gfx
lib.rsrutabaga_gfx
version0.1.71
created_at2022-12-15 00:16:19.973203+00
updated_at2025-09-16 15:04:19.978974+00
descriptionCross-platform, open-source, Rust-based graphics paravirtualization
homepage
repositoryhttps://github.com/magma-gpu/rutabaga_gfx
max_upload_size
id737426
size472,117
(gurchetansingh)

documentation

README

The Rutabaga Virtual Graphics Interface (VGI): Cross-platform, Rust-based GPU paravirtualization

License Crates.io rustc 1.81.0 Documentation

The Rutabaga Virtual Graphics Interface (VGI) is a cross-platform abstraction for GPU and display virtualization. The virtio-gpu context type feature is used to dispatch commands between various Rust, C++, and C implementations. The diagram below does not exhaustively depict all available context types.

rutabaga diagram

Rust API

The Rutabaga VGI is designed to be portable across VMM implementations. The Rust API is available on crates.io.

Rutabaga C API

The following documentation shows how to build Rutabaga's C API with gfxstream enabled, which is the common use case.

Build dependencies

sudo apt install libdrm libglm-dev libstb-dev

Install gfxstream host

git clone https://github.com/google/gfxstream
cd gfxstream/
meson setup host-build/
meson install -C host-build/

Install FFI bindings to Rutabaga

cd $(rutabaga_gfx_dir)/ffi/
meson setup rutabaga-ffi-build/
meson install -C rutabaga-ffi-build/

Install virglrenderer host

Rutabaga's C API can also be built with virglrenderer enabled. To use virglrenderer feature first install virglrenderer on the host.

git clone https://gitlab.freedesktop.org/virgl/virglrenderer.git
cd virglrenderer/
git checkout virglrenderer-1.0.1
meson setup build/
meson install -C build/

Latest releases for potential packaging

Kumquat Media Server

The Kumquat Media server provides a way to test virtio multi-media protocols without a virtual machine. The following example shows how to run GL and Vulkan apps with virtio-gpu + gfxstream-vulkan. Full windowing will only work on platforms that support dma_buf and dma_fence.

Only headless apps are likely to work on Nvidia, and requires this change.

Build GPU-enabled server

First install the gfxstream-host, then:

cd $(rutabaga_gfx_dir)/kumquat/server/
cargo build --features=gfxstream

Build gfxstream guest

Mesa provides gfxstream vulkan guest libraries.

git clone https://gitlab.freedesktop.org/mesa/mesa.git
cd mesa
meson setup guest-build -Dvulkan-drivers="gfxstream" -Dgallium-drivers="" -Dvirtgpu_kumquat=true -Dopengl=false -Drust_std=2021
ninja -C guest-build/

Run apps

In one terminal:

cd $(rutabaga_gfx_dir)/kumquat/server/
./target/debug/kumquat

In another terminal, run:

export MESA_LOADER_DRIVER_OVERRIDE=zink
export VIRTGPU_KUMQUAT=1
export VK_ICD_FILENAMES=$(mesa_dir)/guest-build/src/gfxstream/guest/vulkan/gfxstream_vk_devenv_icd.x86_64.json
vkcube

Linux guests

To test gfxstream with Debian guests, make sure your display environment is headless.

systemctl set-default multi-user.target

Build gfxstream guest as previously and start the compositor. The VIRTGPU_KUMQUAT variable is no longer needed:

export MESA_LOADER_DRIVER_OVERRIDE=zink
export VK_ICD_FILENAMES=$(mesa_dir)/guest-build/src/gfxstream/guest/vulkan/gfxstream_vk_devenv_icd.x86_64.json
weston --backend=drm

Magma

Magma is an effort to standardize GPU system call interfaces, in a way that is optimized for remoting and microkernels. This takes direct inspiration from the Fuchsia Magma interface: in that design, the library interface and protocol are OS-agnostic. An OS-specific virtgpu implementation handles paravirtualization.

Follow along with the Mesa MR to see if it works or we fall flat on our face.

magma diagram

Commit count: 451

cargo fmt