graphics/virtio-gpud: Add helper to submit a fenced request

This is necessary for implementing hardware cursor support.
This commit is contained in:
bjorn3
2025-03-06 19:23:45 +01:00
parent fc92f0b0ce
commit ee3382aed0
2 changed files with 15 additions and 0 deletions
+3
View File
@@ -109,6 +109,9 @@ pub enum CommandTy {
static_assertions::const_assert_eq!(core::mem::size_of::<CommandTy>(), 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 {
+12
View File
@@ -66,6 +66,18 @@ impl VirtGpuAdapter<'_> {
Ok(header)
}
async fn send_request_fenced<T>(&self, request: Dma<T>) -> Result<Dma<ControlHeader>, 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<Dma<GetDisplayInfo>, Error> {
let header = Dma::new(ControlHeader::with_ty(CommandTy::GetDisplayInfo))?;