More Efficient VirtIO DRM Driver To Import Scanout Buffers From Other Devices

Written by Michael Larabel in Virtualization on 28 March 2024 at 06:47 AM EDT. 4 Comments
VIRTUALIZATION
Patches posted today by an Intel engineer allow for importing scanout buffers from other devices with the VirtIO DRM driver that is used in the virtualization space. The importing of scanout buffers from other devices/drivers can allow for more efficient use by avoiding excess copies.

A set of seven patches were posted today for allowing the import of scanout buffers from other devices with VirtIO DRM. With QEMU DMA-BUF support, this can mean avoiding copies of the scanout buffer when it is displayed locally on the host and already in vRAM before encoding and streaming to a remote client for other use-cases.

Intel engineer Vivek Kasireddy explained with these VirtIO DRM patches:
"Having virtio-gpu import scanout buffers (via prime) from other devices means that we'd be adding a head to headless GPUs assigned to a Guest VM or additional heads to regular GPU devices that are passthrough'd to the Guest. In these cases, the Guest compositor can render into the scanout buffer using a primary GPU and has the secondary GPU (virtio-gpu) import it for display purposes.

The main advantage with this is that the imported scanout buffer can either be displayed locally on the Host (e.g, using Qemu + GTK UI) or encoded and streamed to a remote client (e.g, Qemu + Spice UI). Note that since Qemu uses udmabuf driver, there would be no copies made of the scanout buffer as it is displayed. This should be possible even when it might reside in device memory such has VRAM.

The specific use-case that can be supported with this series is when running Weston or other guest compositors with "additional-devices" feature (./weston --drm-device=card1 --additional-devices=card0).

In the above scenario, card1 could be a dGPU or an iGPU and card0 would be virtio-gpu in KMS only mode. However, the case where this patch series could be particularly useful is when card1 is a GPU VF that needs to share its scanout buffer (in a zero-copy way) with the GPU PF on the Host. Or, it can also be useful when the scanout buffer needs to be shared between any two GPU devices (assuming one of them is assigned to a Guest VM) as long as they are P2P DMA compatible."

These VirtIO DRM driver patches are now undergoing review as another useful improvement to benefit the open-source virtualization stack.
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