pub struct Coordinator { /* private fields */ }
Expand description
Client abstraction for the fuchsia.hardware.display.Coordinator
protocol. Instances can be
safely cloned and passed across threads.
Implementations§
Source§impl Coordinator
impl Coordinator
Sourcepub async fn init() -> Result<Coordinator>
pub async fn init() -> Result<Coordinator>
Establishes a connection to the display-coordinator device and initialize a Coordinator
instance with the initial set of available displays. The returned Coordinator
will
maintain FIDL connection to the underlying device as long as it is alive or the connection
is closed by the peer.
Returns an error if
- No display-coordinator device is found within
TIMEOUT
. - An initial OnDisplaysChanged event is not received from the display driver within
TIMEOUT
seconds.
Current limitations:
- This function connects to the first display-coordinator device that it observes. It currently does not support selection of a specific device if multiple display-coordinator devices are present.
Sourcepub async fn init_with_proxy_and_listener_requests(
coordinator_proxy: CoordinatorProxy,
listener_requests: CoordinatorListenerRequestStream,
) -> Result<Coordinator>
pub async fn init_with_proxy_and_listener_requests( coordinator_proxy: CoordinatorProxy, listener_requests: CoordinatorListenerRequestStream, ) -> Result<Coordinator>
Initialize a Coordinator
instance from pre-established Coordinator and
CoordinatorListener channels.
Returns an error if
- An initial OnDisplaysChanged event is not received from the display driver within
TIMEOUT
seconds.
Sourcepub fn displays(&self) -> Vec<DisplayInfo>
pub fn displays(&self) -> Vec<DisplayInfo>
Returns a copy of the list of displays that are currently known to be present on the system.
Sourcepub fn proxy(&self) -> CoordinatorProxy
pub fn proxy(&self) -> CoordinatorProxy
Returns a clone of the underlying FIDL client proxy.
Note: This can be helpful to prevent holding the inner RwLock when awaiting a chained FIDL call over a proxy.
Sourcepub fn add_vsync_listener(
&self,
id: Option<DisplayId>,
) -> Result<UnboundedReceiver<VsyncEvent>>
pub fn add_vsync_listener( &self, id: Option<DisplayId>, ) -> Result<UnboundedReceiver<VsyncEvent>>
Tell the driver to enable vsync notifications and register a channel to listen to vsync events.
Sourcepub async fn handle_events(&self) -> Result<()>
pub async fn handle_events(&self) -> Result<()>
Returns a Future that represents the FIDL event handling task. Once scheduled on an executor, this task will continuously handle incoming FIDL events from the display stack and the returned Future will not terminate until the FIDL channel is closed.
This task can be scheduled safely on any thread.
Sourcepub async fn create_layer(&self) -> Result<LayerId>
pub async fn create_layer(&self) -> Result<LayerId>
Allocates a new virtual hardware layer that is not associated with any display and has no configuration.
Sourcepub fn create_event(&self) -> Result<Event>
pub fn create_event(&self) -> Result<Event>
Creates and registers a zircon event with the display driver. The returned event can be used as a fence in a display configuration.
Sourcepub async fn apply_config(
&self,
configs: &[DisplayConfig],
) -> Result<u64, ConfigError>
pub async fn apply_config( &self, configs: &[DisplayConfig], ) -> Result<u64, ConfigError>
Apply a display configuration. The client is expected to receive a vsync event once the configuration is successfully applied. Returns an error if the FIDL message cannot be sent.
Sourcepub async fn get_recent_applied_config_stamp(&self) -> Result<u64, Error>
pub async fn get_recent_applied_config_stamp(&self) -> Result<u64, Error>
Get the config stamp value of the most recent applied config in
apply_config
. Returns an error if the FIDL message cannot be sent.
Trait Implementations§
Source§impl Clone for Coordinator
impl Clone for Coordinator
Source§fn clone(&self) -> Coordinator
fn clone(&self) -> Coordinator
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreAuto Trait Implementations§
impl Freeze for Coordinator
impl !RefUnwindSafe for Coordinator
impl Send for Coordinator
impl Sync for Coordinator
impl Unpin for Coordinator
impl !UnwindSafe for Coordinator
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)