Expand description
VirtIO GPU Driver
Driver for paravirtualized GPU devices using the VirtIO protocol. Commonly used in QEMU/KVM virtual machines for 2D/3D rendering.
Implements the VirtIO MMIO transport with proper status negotiation, virtqueue setup via frame allocator DMA buffers, and 2D rendering operations (resource creation, scanout, transfer, flush).
§Architecture
The driver uses the VirtIO 1.0+ modern MMIO transport interface with two virtqueues:
- controlq (queue 0): All 2D/3D commands and responses
- cursorq (queue 1): Hardware cursor updates (optional)
§Supported Operations
- Display info query (GET_DISPLAY_INFO)
- 2D resource creation (RESOURCE_CREATE_2D)
- Backing store attachment (RESOURCE_ATTACH_BACKING)
- Scanout configuration (SET_SCANOUT)
- Host transfer (TRANSFER_TO_HOST_2D)
- Display flush (RESOURCE_FLUSH)
- EDID query (GET_EDID, if supported)
Structs§
- Virtio
GpuDisplay One - Display mode information for one scanout.
- Virtio
GpuDriver - VirtIO GPU Driver
- Virtio
GpuRect - Rectangle structure for GPU commands.
Functions§
- enumerate_
gpu_ devices - Probe PCI bus for display-class devices and return a summary.
- flush_
framebuffer - Flush the VirtIO GPU framebuffer to the display.
- get_
display_ size - Get the display dimensions (width, height) if a VirtIO GPU is available.
- init
- Initialize the VirtIO GPU driver.
- is_
available - Check if a VirtIO GPU driver is available and initialized.
- probe_
pci - Probe PCI bus for a VirtIO GPU device (vendor 0x1AF4, device 0x1050).
- with_
driver - Execute a closure with the VirtIO GPU driver (mutable access).