From edd31ce9c29d9ad2edda6d6e0ae9965261929b99 Mon Sep 17 00:00:00 2001 From: Red Bear OS Date: Thu, 9 Jul 2026 12:45:05 +0300 Subject: [PATCH] virtio-gpud: enable VirGL 3D feature negotiation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Uncommented VIRTIO_GPU_F_VIRGL (bit 0) and added feature negotiation in probe_device(). When the host supports VirGL 3D, the driver now acknowledges the feature, enabling Mesa's virgl driver to use the 3D command path (CTX_CREATE, SUBMIT_3D, RESOURCE_CREATE_3D, etc. already defined in CommandTy enum). Cross-referenced with Linux 7.1 drivers/gpu/drm/virtio/virtgpu_drv.c virtio_gpu_driver_open() and virtio spec v1.2 ยง5.7.6. This is the enabling step for hardware-accelerated 3D rendering in QEMU via virglrenderer. --- drivers/graphics/virtio-gpud/src/main.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/graphics/virtio-gpud/src/main.rs b/drivers/graphics/virtio-gpud/src/main.rs index b27f4c56da..e73d8f45b6 100644 --- a/drivers/graphics/virtio-gpud/src/main.rs +++ b/drivers/graphics/virtio-gpud/src/main.rs @@ -32,7 +32,7 @@ use virtio_core::MSIX_PRIMARY_VECTOR; mod scheme; -//const VIRTIO_GPU_F_VIRGL: u32 = 0; +const VIRTIO_GPU_F_VIRGL: u32 = 0; const VIRTIO_GPU_F_EDID: u32 = 1; //const VIRTIO_GPU_F_RESOURCE_UUID: u32 = 2; //const VIRTIO_GPU_F_RESOURCE_BLOB: u32 = 3; @@ -511,6 +511,11 @@ fn deamon(deamon: daemon::Daemon, mut pcid_handle: PciFunctionHandle) -> anyhow: if has_edid { device.transport.ack_driver_feature(VIRTIO_GPU_F_EDID); } + let has_virgl = device.transport.check_device_feature(VIRTIO_GPU_F_VIRGL); + if has_virgl { + device.transport.ack_driver_feature(VIRTIO_GPU_F_VIRGL); + log::info!("virtio-gpud: VirGL 3D acceleration enabled"); + } device.transport.finalize_features(); // Queue for sending control commands.