diff --git a/graphics/virtio-gpud/src/main.rs b/graphics/virtio-gpud/src/main.rs index 2313808470..fa2a5da6f5 100644 --- a/graphics/virtio-gpud/src/main.rs +++ b/graphics/virtio-gpud/src/main.rs @@ -109,6 +109,9 @@ pub enum CommandTy { static_assertions::const_assert_eq!(core::mem::size_of::(), 4); +const VIRTIO_GPU_FLAG_FENCE: u32 = 1 << 0; +//const VIRTIO_GPU_FLAG_INFO_RING_IDX: u32 = 1 << 1; + #[derive(Debug)] #[repr(C)] pub struct ControlHeader { diff --git a/graphics/virtio-gpud/src/scheme.rs b/graphics/virtio-gpud/src/scheme.rs index 3241294db3..95714e9a77 100644 --- a/graphics/virtio-gpud/src/scheme.rs +++ b/graphics/virtio-gpud/src/scheme.rs @@ -66,6 +66,18 @@ impl VirtGpuAdapter<'_> { Ok(header) } + async fn send_request_fenced(&self, request: Dma) -> Result, Error> { + let mut header = Dma::new(ControlHeader::default())?; + header.flags |= VIRTIO_GPU_FLAG_FENCE; + let command = ChainBuilder::new() + .chain(Buffer::new(&request)) + .chain(Buffer::new(&header).flags(DescriptorFlags::WRITE_ONLY)) + .build(); + + self.control_queue.send(command).await; + Ok(header) + } + async fn get_display_info(&self) -> Result, Error> { let header = Dma::new(ControlHeader::with_ty(CommandTy::GetDisplayInfo))?;