Struct gpu_display::GpuDisplay
source · pub struct GpuDisplay {
pub(crate) next_id: u32,
pub(crate) event_devices: BTreeMap<u32, EventDevice>,
pub(crate) surfaces: BTreeMap<u32, Box<dyn GpuDisplaySurface>>,
pub(crate) wait_ctx: WaitContext<DisplayEventToken>,
pub(crate) inner: Box<dyn SysDisplayT>,
}
Expand description
A connection to the compositor and associated collection of state.
The user of GpuDisplay
can use AsRawDescriptor
to poll on the compositor connection’s file
descriptor. When the connection is readable, dispatch_events
can be called to process it.
Fields§
§next_id: u32
§event_devices: BTreeMap<u32, EventDevice>
§surfaces: BTreeMap<u32, Box<dyn GpuDisplaySurface>>
§wait_ctx: WaitContext<DisplayEventToken>
§inner: Box<dyn SysDisplayT>
Implementations§
source§impl GpuDisplay
impl GpuDisplay
sourcepub fn open_x(display_name: Option<&str>) -> GpuDisplayResult<GpuDisplay>
pub fn open_x(display_name: Option<&str>) -> GpuDisplayResult<GpuDisplay>
Opens a connection to X server
pub fn open_android(service_name: &str) -> GpuDisplayResult<GpuDisplay>
pub fn open_stub() -> GpuDisplayResult<GpuDisplay>
pub fn take_event_devices(&mut self) -> Vec<EventDevice>
pub(crate) fn dispatch_display_events(&mut self) -> GpuDisplayResult<()>
sourcepub fn dispatch_events(&mut self) -> GpuDisplayResult<()>
pub fn dispatch_events(&mut self) -> GpuDisplayResult<()>
Dispatches internal events that were received from the compositor since the last call to
dispatch_events
.
sourcepub fn create_surface(
&mut self,
parent_surface_id: Option<u32>,
scanout_id: Option<u32>,
display_params: &DisplayParameters,
surf_type: SurfaceType
) -> GpuDisplayResult<u32>
pub fn create_surface( &mut self, parent_surface_id: Option<u32>, scanout_id: Option<u32>, display_params: &DisplayParameters, surf_type: SurfaceType ) -> GpuDisplayResult<u32>
Creates a surface on the the compositor as either a top level window, or child of another surface, returning a handle to the new surface.
sourcepub fn release_surface(&mut self, surface_id: u32)
pub fn release_surface(&mut self, surface_id: u32)
Releases a previously created surface identified by the given handle.
sourcepub fn framebuffer(
&mut self,
surface_id: u32
) -> Option<GpuDisplayFramebuffer<'_>>
pub fn framebuffer( &mut self, surface_id: u32 ) -> Option<GpuDisplayFramebuffer<'_>>
Gets a reference to an unused framebuffer for the identified surface.
sourcepub fn framebuffer_region(
&mut self,
surface_id: u32,
x: u32,
y: u32,
width: u32,
height: u32
) -> Option<GpuDisplayFramebuffer<'_>>
pub fn framebuffer_region( &mut self, surface_id: u32, x: u32, y: u32, width: u32, height: u32 ) -> Option<GpuDisplayFramebuffer<'_>>
Gets a reference to an unused framebuffer for the identified surface.
sourcepub fn next_buffer_in_use(&self, surface_id: u32) -> bool
pub fn next_buffer_in_use(&self, surface_id: u32) -> bool
Returns true if the next buffer in the buffer queue for the given surface is currently in use.
If the next buffer is in use, the memory returned from framebuffer_memory
should not be
written to.
sourcepub fn flip(&mut self, surface_id: u32)
pub fn flip(&mut self, surface_id: u32)
Changes the visible contents of the identified surface to the contents of the framebuffer
last returned by framebuffer_memory
for this surface.
sourcepub fn close_requested(&self, surface_id: u32) -> bool
pub fn close_requested(&self, surface_id: u32) -> bool
Returns true if the identified top level surface has been told to close by the compositor, and by extension the user.
sourcepub fn import_resource(
&mut self,
surface_id: u32,
external_display_resource: DisplayExternalResourceImport<'_>
) -> Result<u32>
pub fn import_resource( &mut self, surface_id: u32, external_display_resource: DisplayExternalResourceImport<'_> ) -> Result<u32>
Imports a resource to the display backend. This resource may be an image for the compositor or a synchronization object.
sourcepub fn release_import(&mut self, import_id: u32, surface_id: u32)
pub fn release_import(&mut self, import_id: u32, surface_id: u32)
Releases a previously imported resource identified by the given handle.
sourcepub fn commit(&mut self, surface_id: u32) -> GpuDisplayResult<()>
pub fn commit(&mut self, surface_id: u32) -> GpuDisplayResult<()>
Commits any pending state for the identified surface.
sourcepub fn flip_to(
&mut self,
surface_id: u32,
import_id: u32,
acquire_timepoint: Option<SemaphoreTimepoint>,
release_timepoint: Option<SemaphoreTimepoint>,
extra_info: Option<FlipToExtraInfo>
) -> Result<Waitable>
pub fn flip_to( &mut self, surface_id: u32, import_id: u32, acquire_timepoint: Option<SemaphoreTimepoint>, release_timepoint: Option<SemaphoreTimepoint>, extra_info: Option<FlipToExtraInfo> ) -> Result<Waitable>
Changes the visible contents of the identified surface to that of the identified imported buffer.
sourcepub fn set_mouse_mode(
&mut self,
surface_id: u32,
mouse_mode: MouseMode
) -> GpuDisplayResult<()>
pub fn set_mouse_mode( &mut self, surface_id: u32, mouse_mode: MouseMode ) -> GpuDisplayResult<()>
Sets the mouse mode used on this surface.
sourcepub fn set_position(
&mut self,
surface_id: u32,
x: u32,
y: u32
) -> GpuDisplayResult<()>
pub fn set_position( &mut self, surface_id: u32, x: u32, y: u32 ) -> GpuDisplayResult<()>
Sets the position of the identified subsurface relative to its parent.
The change in position will not be visible until commit
is called for the parent surface.
Trait Implementations§
source§impl AsRawDescriptor for GpuDisplay
impl AsRawDescriptor for GpuDisplay
source§fn as_raw_descriptor(&self) -> RawDescriptor
fn as_raw_descriptor(&self) -> RawDescriptor
source§impl GpuDisplayExt for GpuDisplay
impl GpuDisplayExt for GpuDisplay
source§fn import_event_device(
&mut self,
event_device: EventDevice
) -> GpuDisplayResult<u32>
fn import_event_device( &mut self, event_device: EventDevice ) -> GpuDisplayResult<u32>
event_device
into the display, returning an event device id on success.
This device may be used to dispatch input events to the guest.source§fn handle_event_device(&mut self, event_device_id: u32)
fn handle_event_device(&mut self, event_device_id: u32)
source§impl UnixGpuDisplayExt for GpuDisplay
impl UnixGpuDisplayExt for GpuDisplay
source§fn open_wayland<P: AsRef<Path>>(
wayland_path: Option<P>
) -> GpuDisplayResult<GpuDisplay>
fn open_wayland<P: AsRef<Path>>( wayland_path: Option<P> ) -> GpuDisplayResult<GpuDisplay>
Auto Trait Implementations§
impl !RefUnwindSafe for GpuDisplay
impl !Send for GpuDisplay
impl !Sync for GpuDisplay
impl Unpin for GpuDisplay
impl !UnwindSafe for GpuDisplay
Blanket Implementations§
§impl<T> AsRawDescriptors for Twhere
T: AsRawDescriptor,
impl<T> AsRawDescriptors for Twhere
T: AsRawDescriptor,
§fn as_raw_descriptors(&self) -> Vec<i32>
fn as_raw_descriptors(&self) -> Vec<i32>
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<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.