pub struct VirtioGpuDeviceCore {
base_addr: usize,
virtqueues: Mutex<[VirtQueue<'static>; 2]>,
display_info: RwLock<Option<VirtioGpuRespDisplayInfo>>,
framebuffer_addr: RwLock<Option<usize>>,
shadow_framebuffer_addr: RwLock<Option<usize>>,
boxed_framebuffer: RwLock<Option<Box<[Page]>>>,
boxed_shadow_framebuffer: RwLock<Option<Box<[Page]>>>,
resource_id: Mutex<u32>,
initialized: Mutex<bool>,
resources: Mutex<BTreeMap<u32, (usize, usize)>>,
}Expand description
VirtIO GPU Device Core
Fields§
§base_addr: usize§virtqueues: Mutex<[VirtQueue<'static>; 2]>§display_info: RwLock<Option<VirtioGpuRespDisplayInfo>>§framebuffer_addr: RwLock<Option<usize>>§shadow_framebuffer_addr: RwLock<Option<usize>>§boxed_framebuffer: RwLock<Option<Box<[Page]>>>§boxed_shadow_framebuffer: RwLock<Option<Box<[Page]>>>§resource_id: Mutex<u32>§initialized: Mutex<bool>§resources: Mutex<BTreeMap<u32, (usize, usize)>>Implementations§
Source§impl VirtioGpuDeviceCore
impl VirtioGpuDeviceCore
Sourcefn next_resource_id(&self) -> u32
fn next_resource_id(&self) -> u32
Get next resource ID
Sourcefn send_control_command<T>(&self, cmd: &T) -> Result<(), &'static str>
fn send_control_command<T>(&self, cmd: &T) -> Result<(), &'static str>
Send a command to the control queue
Sourcefn send_control_command_with_resp_buffer<T>(
&self,
cmd: &T,
resp_buffer: &mut [u8],
) -> Result<(), &'static str>
fn send_control_command_with_resp_buffer<T>( &self, cmd: &T, resp_buffer: &mut [u8], ) -> Result<(), &'static str>
Send a command to the control queue, using a caller-provided response buffer.
Sourcefn get_display_info_internal(&mut self) -> Result<(), &'static str>
fn get_display_info_internal(&mut self) -> Result<(), &'static str>
Get display information from the device
Sourcefn create_2d_resource(
&self,
width: u32,
height: u32,
format: u32,
) -> Result<u32, &'static str>
fn create_2d_resource( &self, width: u32, height: u32, format: u32, ) -> Result<u32, &'static str>
Create a 2D resource
Sourcefn attach_backing_to_resource(
&self,
resource_id: u32,
addr: usize,
size: usize,
) -> Result<(), &'static str>
fn attach_backing_to_resource( &self, resource_id: u32, addr: usize, size: usize, ) -> Result<(), &'static str>
Attach backing memory to a resource
Sourcefn setup_framebuffer(&self) -> Result<(), &'static str>
fn setup_framebuffer(&self) -> Result<(), &'static str>
Set up framebuffer
fn get_display_name(&self) -> &'static str
fn get_framebuffer_config(&self) -> Result<FramebufferConfig, &'static str>
fn get_framebuffer_address(&self) -> Result<usize, &'static str>
fn flush_framebuffer( &self, x: u32, y: u32, width: u32, height: u32, ) -> Result<(), &'static str>
Trait Implementations§
Source§impl VirtioDevice for VirtioGpuDeviceCore
impl VirtioDevice for VirtioGpuDeviceCore
fn get_base_addr(&self) -> usize
fn get_virtqueue_count(&self) -> usize
fn get_virtqueue_size(&self, queue_idx: usize) -> usize
Source§fn get_queue_desc_addr(&self, queue_idx: usize) -> Option<u64>
fn get_queue_desc_addr(&self, queue_idx: usize) -> Option<u64>
Get the descriptor address for a virtqueue
Source§fn get_queue_driver_addr(&self, queue_idx: usize) -> Option<u64>
fn get_queue_driver_addr(&self, queue_idx: usize) -> Option<u64>
Get the driver area address for a virtqueue
Source§fn get_queue_device_addr(&self, queue_idx: usize) -> Option<u64>
fn get_queue_device_addr(&self, queue_idx: usize) -> Option<u64>
Get the device area address for a virtqueue
Source§fn get_supported_features(&self, _device_features: u32) -> u32
fn get_supported_features(&self, _device_features: u32) -> u32
Get device features supported by this driver Read more
fn debug_dump_mmio_state(&self, tag: &'static str)
fn debug_log_status_transition( &self, tag: &'static str, old: u32, new: u32, readback: u32, )
fn wait_for_status_zero( &self, tag: &'static str, max_iters: usize, ) -> Result<(), &'static str>
fn is_modern_device(&self) -> bool
fn supports_feature(&self, feature: u32) -> bool
Source§fn reset(&mut self) -> Result<(), &'static str>
fn reset(&mut self) -> Result<(), &'static str>
Reset the device by writing 0 to the Status register
Source§fn acknowledge(&mut self)
fn acknowledge(&mut self)
Set ACKNOWLEDGE status bit
Source§fn set_failed(&mut self)
fn set_failed(&mut self)
Set FAILED status bit
Source§fn negotiate_features(&mut self) -> Result<u32, &'static str>
fn negotiate_features(&mut self) -> Result<u32, &'static str>
Negotiate device features Read more
fn allow_ring_features(&self) -> bool
Source§fn setup_queue(&mut self, queue_idx: usize, queue_size: usize) -> bool
fn setup_queue(&mut self, queue_idx: usize, queue_size: usize) -> bool
Set up a virtqueue Read more
Source§fn read_config<T: Sized>(&self, offset: usize) -> T
fn read_config<T: Sized>(&self, offset: usize) -> T
Read device-specific configuration Read more
Source§fn write_config<T: Sized>(&self, offset: usize, value: T)
fn write_config<T: Sized>(&self, offset: usize, value: T)
Write device-specific configuration Read more
Source§fn get_device_info(&self) -> (u32, u32)
fn get_device_info(&self) -> (u32, u32)
Get device and vendor IDs Read more
Source§fn get_interrupt_status(&self) -> u32
fn get_interrupt_status(&self) -> u32
Get interrupt status Read more
Source§fn process_interrupts(&mut self) -> u32
fn process_interrupts(&mut self) -> u32
Process interrupts (polling method) Read more
Source§fn memory_barrier(&self)
fn memory_barrier(&self)
Memory barrier for ensuring memory operations ordering
Source§fn notify(&self, virtqueue_idx: usize)
fn notify(&self, virtqueue_idx: usize)
Notify the device about new buffers in a specified virtqueue Read more
Source§fn read32_register(&self, register: Register) -> u32
fn read32_register(&self, register: Register) -> u32
Read a 32-bit value from a device register Read more
Source§fn write32_register(&self, register: Register, value: u32)
fn write32_register(&self, register: Register, value: u32)
Write a 32-bit value to a device register Read more
Source§fn read64_register(&self, register: Register) -> u64
fn read64_register(&self, register: Register) -> u64
Read a 64-bit value from a device register Read more
Source§fn write64_register(&self, register: Register, value: u64)
fn write64_register(&self, register: Register, value: u64)
Write a 64-bit value to a device register Read more