VHOST-DEVICE-GPU(1)

πŸ“¦ version 0.2.0, in fedora 43, fedora 44

πŸ’– NAME πŸ’–

okay bestie, meet vhost-device-gpu β€” it's a vhost-user backend for a VirtIO GPU device ✨

🌸 SYNOPSIS 🌸

vhost-device-gpu --socket-path <path> --gpu-mode <GPU_MODE>

πŸ¦‹ DESCRIPTION πŸ¦‹

It's a virtio-gpu device, and it talks to everybody through the vhost-user protocol. That's the whole vibe πŸ’…

✨ OPTIONS ✨

  • -s, --socket-path <SOCKET> β€” the vhost-user Unix domain socket, aka where the magic little connection lives πŸ”Œ
  • -g, --gpu-mode <GPU_MODE> β€” this one picks which backend implementation you're running with, so choose wisely bestie:
    • virglrenderer: the OpenGL implementation β€” note that it's been superseded by Virgl2 πŸ™ˆ
    • gfxstream: the Vulkan implementation (partial support only, so like… it's trying its best 🫢)
  • -c, --capset <CAPSET> β€” a comma-separated list of the enabled capsets. The lineup:
    • virgl: OpenGL implementation, superseded by Virgl2 πŸ’€
    • virgl2: OpenGL implementation πŸ‘‘
    • gfxstream-vulkan: Vulkan implementation (partial support only).
NOTE: Can only be used for 2D display output for now, no hardware acceleration yet.
  • gfxstream-gles: OpenGL ES implementation (partial support only).
NOTE: Can only be used for 2D display output for now, no hardware acceleration yet.
  • --use-egl <USE_EGL> β€” enables the backend to use EGL. Default: true. Possible values: true, false
  • --use-glx <USE_GLX> β€” enables the backend to use GLX. Default: false. Possible values: true, false
  • --use-gles <USE_GLES> β€” enables the backend to use GLES. Default: true. Possible values: true, false
  • --use-surfaceless <USE_SURFACELESS> β€” turns on the surfaceless backend option. Default: true. Possible values: true, false
  • -h, --help β€” prints help and usage info, for when you're lost (no shame, we've all been there) 🧚
  • -V, --version β€” prints version info, slay ⭐

😭 LIMITATIONS 😭

bestie, sit down, we need to talk:

  • This device links native libraries (because of the usage of Rutabaga) that are compiled with GNU libc. The CI is set up to not build this device for musl targets, periodt.
  • It might be possible to build those libraries using musl and then build the GPU device, but honestly? That's untested. Nobody knows. Mystery behavior 🌈
  • Currently, the only supported thing is sharing the display output to QEMU through a socket using the transfer_read operation (VIRTIO_GPU_CMD_TRANSFER_FROM_HOST_3D).
  • Directly sharing display output resources using dmabuf is not yet supported. Not yet, babe.
  • These features are not yet supported:
    • VIRTIO_GPU_CMD_RESOURCE_CREATE_BLOB
    • VIRTIO_GPU_CMD_SET_SCANOUT_BLOB
    • VIRTIO_GPU_CMD_RESOURCE_ASSIGN_UUID β€” these require rust-vmm/vhost#251, which in turn requires QEMU API stabilization. So we wait 🫠
  • And because blob resources are not yet supported, some capsets are limited:
    • Venus (the Vulkan implementation in virglrenderer) support is unavailable 😭
    • gfxstream-vulkan and gfxstream-gles are exposed but can only be used for display output (no hardware acceleration yet).

πŸ”₯ FEATURES πŸ”₯

The device leverages the rutabaga_gfx crate to provide rendering with virglrenderer and gfxstream. Iconic collaboration tbh 🀝

  • Gfxstream support is compiled by default, but you can disable it by building without the gfxstream feature flag:
cargo build --no-default-features
  • With Virglrenderer, Rutabaga translates OpenGL and Vulkan calls to an intermediate representation, which allows OpenGL acceleration on the host ✨
  • With the gfxstream rendering mode, GLES and Vulkan calls are forwarded to the host with minimal modification πŸ’«

πŸŽ€ EXAMPLES πŸŽ€

Start the daemon on the host machine using either GPU mode:

1. Virglrenderer

2. Gfxstream (if the crate has been compiled with the gfxstream feature)

   host# vhost-device-gpu --socket-path /tmp/gpu.socket --gpu-mode virglrenderer

With QEMU, two device frontends can be used:

1. vhost-user-gpu-pci

2. vhost-user-vga (also implements VGA, allowing visibility of boot
   messages before GPU initialization)

By default, QEMU adds another VGA output. Disable it using -vga none.

🌟 Using vhost-user-gpu-pci

qemu-system-x86_64 \
  -chardev socket,id=vgpu,path=/tmp/gpu.socket \
  -device vhost-user-gpu-pci,chardev=vgpu,id=vgpu \
  -object memory-backend-memfd,share=on,id=mem0,size=4G \
  -machine q35,memory-backend=mem0,accel=kvm \
  -display gtk,gl=on,show-cursor=on \
  -vga none

πŸ’œ Using vhost-user-vga

qemu-system-x86_64 \
  -chardev socket,id=vgpu,path=/tmp/gpu.socket \
  -device vhost-user-vga,chardev=vgpu,id=vgpu \
  -object memory-backend-memfd,share=on,id=mem0,size=4G \
  -machine q35,memory-backend=mem0,accel=kvm \
  -display gtk,gl=on,show-cursor=on \
  -vga none

🌈 ENVIRONMENT 🌈

  • RUST_LOG β€” the logging level, bestie. Set it to debug for maximum output, aka the full tea β˜•

πŸ’€ BUGS πŸ’€

See GitHub Issues: https://github.com/rust-vmm/vhost-device/issues

πŸ‘‘ AUTHORS πŸ‘‘

  • Dorinda Bassey dbassey@redhat.com
  • Matej Hrica mhrica@redhat.com

🫢 SEE ALSO 🫢


okay that's the whole page, you're fully caught up πŸ’– this was Version 0.1.0 of vhost-device-gpu, straight out of rust-vmm/vhost-device β€” go forth and GPU, bestie, no cap βœ¨πŸŽ€πŸ¦‹

πŸ“¦ where this page comes from
  • fedora 43: vhost-device-gpu 0.1.0-4.fc43 Β· (Apache-2.0 OR BSD-3-Clause) AND ((MIT OR Apache-2.0) AND Unicode-DFS-2016) AND (Apache-2.0 OR MIT) AND (Apache-2.0 WITH LLVM-exception OR Apache-2.0 OR MIT) AND Apache-2.0 AND BSD-3-Clause AND MIT AND (Unlicense OR MIT)
  • fedora 43: vhost-device-gpu 0.2.0-1.fc43 Β· (Apache-2.0 OR BSD-3-Clause) AND ((MIT OR Apache-2.0) AND Unicode-DFS-2016) AND (Apache-2.0 OR MIT) AND (Apache-2.0 WITH LLVM-exception OR Apache-2.0 OR MIT) AND Apache-2.0 AND BSD-3-Clause AND MIT AND (Unlicense OR MIT)
  • fedora 44: vhost-device-gpu 0.2.0-2.fc44 Β· (Apache-2.0 OR BSD-3-Clause) AND ((MIT OR Apache-2.0) AND Unicode-DFS-2016) AND (Apache-2.0 OR MIT) AND (Apache-2.0 WITH LLVM-exception OR Apache-2.0 OR MIT) AND Apache-2.0 AND BSD-3-Clause AND MIT AND (Unlicense OR MIT)
  • πŸ’– girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms