pub struct VirtioGpu {
ctrl_queue: Mutex<Virtqueue>,
_cursor_queue: Mutex<Option<Virtqueue>>,
info: GpuInfo,
_framebuffer_pages: Vec<PhysFrame>,
backing: Mutex<BackingState>,
dirty: Mutex<DirtyRect>,
}Fields§
§ctrl_queue: Mutex<Virtqueue>§_cursor_queue: Mutex<Option<Virtqueue>>§info: GpuInfo§_framebuffer_pages: Vec<PhysFrame>§backing: Mutex<BackingState>§dirty: Mutex<DirtyRect>Implementations§
Source§impl VirtioGpu
impl VirtioGpu
Sourcefn init_display(&mut self) -> Result<(), &'static str>
fn init_display(&mut self) -> Result<(), &'static str>
Initializes display.
Sourcefn get_display_info(&mut self) -> Result<(), &'static str>
fn get_display_info(&mut self) -> Result<(), &'static str>
Returns display info.
Sourcefn resource_create_2d(
&self,
resource_id: u32,
width: u32,
height: u32,
) -> Result<(), &'static str>
fn resource_create_2d( &self, resource_id: u32, width: u32, height: u32, ) -> Result<(), &'static str>
Performs the resource create 2d operation.
Sourcefn resource_attach_backing(
&self,
resource_id: u32,
entries: &[MemEntry],
) -> Result<(), &'static str>
fn resource_attach_backing( &self, resource_id: u32, entries: &[MemEntry], ) -> Result<(), &'static str>
Performs the resource attach backing operation.
Sourcefn set_scanout(
&self,
scanout_id: u32,
resource_id: u32,
) -> Result<(), &'static str>
fn set_scanout( &self, scanout_id: u32, resource_id: u32, ) -> Result<(), &'static str>
Sets scanout.
Sourcefn transfer_to_host_2d(
&self,
resource_id: u32,
x: u32,
y: u32,
width: u32,
height: u32,
) -> Result<(), &'static str>
fn transfer_to_host_2d( &self, resource_id: u32, x: u32, y: u32, width: u32, height: u32, ) -> Result<(), &'static str>
Performs the transfer to host 2d operation.
Sourcefn resource_flush(
&self,
resource_id: u32,
x: u32,
y: u32,
width: u32,
height: u32,
) -> Result<(), &'static str>
fn resource_flush( &self, resource_id: u32, x: u32, y: u32, width: u32, height: u32, ) -> Result<(), &'static str>
Performs the resource flush operation.
Sourcefn send_command<T: Copy, R: Copy>(&self, cmd: &T) -> Result<R, &'static str>
fn send_command<T: Copy, R: Copy>(&self, cmd: &T) -> Result<R, &'static str>
Performs the send command operation.
Sourcefn send_command_with_payload<T: Copy, R: Copy>(
&self,
cmd: &T,
payload: Option<&[u8]>,
) -> Result<R, &'static str>
fn send_command_with_payload<T: Copy, R: Copy>( &self, cmd: &T, payload: Option<&[u8]>, ) -> Result<R, &'static str>
Performs the send command with payload operation.
Sourcefn copy_to_backing(
&self,
src: *const u8,
dst_offset: usize,
len: usize,
) -> Result<(), &'static str>
fn copy_to_backing( &self, src: *const u8, dst_offset: usize, len: usize, ) -> Result<(), &'static str>
Performs the copy to backing operation.
Walks backing segments by cumulative offset (works both for the legacy page-granular layout and for a single contiguous external backing).
Sourcepub fn attach_external_backing(
&self,
phys: u64,
len: usize,
) -> Result<(), &'static str>
pub fn attach_external_backing( &self, phys: u64, len: usize, ) -> Result<(), &'static str>
Attach an externally-owned, physically contiguous buffer as the scanout resource backing.
After a successful attach, draw targets writing into [phys, phys+len) are directly what TRANSFER_TO_HOST_2D reads, so
Self::present_scanout_rect becomes zero-copy. The caller keeps
ownership of the memory (it must outlive the device or re-attach).
Sourcepub fn using_external_backing(&self) -> bool
pub fn using_external_backing(&self) -> bool
Whether an externally-provided contiguous backing is attached.
Sourcepub fn present_scanout_rect(
&self,
x: u32,
y: u32,
width: u32,
height: u32,
) -> Result<(), &'static str>
pub fn present_scanout_rect( &self, x: u32, y: u32, width: u32, height: u32, ) -> Result<(), &'static str>
Zero-copy presentation: TRANSFER_TO_HOST_2D + RESOURCE_FLUSH for the given rectangle, reading straight from the attached backing.
Auto Trait Implementations§
impl !Freeze for VirtioGpu
impl !RefUnwindSafe for VirtioGpu
impl Send for VirtioGpu
impl Sync for VirtioGpu
impl Unpin for VirtioGpu
impl UnsafeUnpin for VirtioGpu
impl UnwindSafe for VirtioGpu
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more