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

source

pub fn open_x(display_name: Option<&str>) -> GpuDisplayResult<GpuDisplay>

Opens a connection to X server

source

pub fn open_android(service_name: &str) -> GpuDisplayResult<GpuDisplay>

source

pub fn open_stub() -> GpuDisplayResult<GpuDisplay>

source

pub fn take_event_devices(&mut self) -> Vec<EventDevice>

source

pub(crate) fn dispatch_display_events(&mut self) -> GpuDisplayResult<()>

source

pub fn dispatch_events(&mut self) -> GpuDisplayResult<()>

Dispatches internal events that were received from the compositor since the last call to dispatch_events.

source

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.

source

pub fn release_surface(&mut self, surface_id: u32)

Releases a previously created surface identified by the given handle.

source

pub fn framebuffer( &mut self, surface_id: u32 ) -> Option<GpuDisplayFramebuffer<'_>>

Gets a reference to an unused framebuffer for the identified surface.

source

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.

source

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.

source

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.

source

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.

source

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.

source

pub fn release_import(&mut self, import_id: u32, surface_id: u32)

Releases a previously imported resource identified by the given handle.

source

pub fn commit(&mut self, surface_id: u32) -> GpuDisplayResult<()>

Commits any pending state for the identified surface.

source

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.

source

pub fn set_mouse_mode( &mut self, surface_id: u32, mouse_mode: MouseMode ) -> GpuDisplayResult<()>

Sets the mouse mode used on this surface.

source

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

source§

fn as_raw_descriptor(&self) -> RawDescriptor

Returns the underlying raw descriptor. Read more
source§

impl GpuDisplayExt for GpuDisplay

source§

fn import_event_device( &mut self, event_device: EventDevice ) -> GpuDisplayResult<u32>

Imports the given 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)

Called when an event device is readable.
source§

impl UnixGpuDisplayExt for GpuDisplay

source§

fn open_wayland<P: AsRef<Path>>( wayland_path: Option<P> ) -> GpuDisplayResult<GpuDisplay>

Opens a fresh connection to the compositor.

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<T> AsRawDescriptors for T
where T: AsRawDescriptor,

§

fn as_raw_descriptors(&self) -> Vec<i32>

Returns the underlying raw descriptors. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> Downcast for T
where T: Any,

§

fn into_any(self: Box<T>) -> Box<dyn Any>

Convert 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>

Convert 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)

Convert &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)

Convert &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.