Skip to content

virtio-gpu api: vulkan / opengl interop

libvirvrenderer.so and libvirglrenderer.so will be different libraries, so we have to start thinking about inter-op.

When VIRTIO_GPU_F_VIRGL is enabled, opening the DRM driver fd always calls virtio_gpu_context_create, creating an OpenGL context.

We need to enable Vulkan somehow given this.

A few solutions have been presented:

  1. Emulating OpenGL via Vulkan.
    • Technically nice solution.
    • Don't know if it'll match Virgl performance or conformance
    • Adds another dependency to get Vulkan running -- a guest that renders correctly while Vulkan is under development would be nice
  2. virtio-vulkan device along with virtio-gpu device
    • Technically nice solution.
    • Code duplication
    • A lot more work
  3. New hypercalls go to libvirvrenderer, old hypercalls go to libvirglrenderer
  • Clear API level separation between host APIs
  • Some virgl hyercalls are reusable VIRTIO_GPU_CMD_SUBMIT_3D VIRTIO_GPU_CMD_CTX_ATTACH_RESOURCE VIRTIO_GPU_CMD_CTX_DETACH_RESOURCE VIRTIO_GPU_CMD_CTX_DESTROY
  • The metadata allocation ioctl would solve wayland/gralloc integration issues
  • No coherent memory for Virgl
  1. Add a routing hyercall -- when the value == VIRTGPU_SET_FEATURE_VULKAN, all hypercalls go to libvirvrenderer
  • Possible virgl reuse
  • Hypercall reuse
  • We will have to destroy the OpenGL CTX, before starting a Vulkan CTX

This patch goes with (4). Eventually, I think (1) is the way to go.

Merge request reports