⚠️ VeridianOS Kernel Documentation - This is low-level kernel code. All functions are unsafe unless explicitly marked otherwise. no_std

Module virtio_gpu

Module virtio_gpu 

Source
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§

VirtioGpuDisplayOne
Display mode information for one scanout.
VirtioGpuDriver
VirtIO GPU Driver
VirtioGpuRect
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).