class CoordinatorProxy
Defined at line 45 of file ../../src/ui/scenic/lib/display/coordinator_proxy.h
CoordinatorProxy is a client-side wrapper around the fuchsia.hardware.display.Coordinator FIDL
service. It optimizes interactions by batching configuration calls and caching CheckConfig
results.
Key features:
- Defers most Set*() FIDL calls until ApplyConfig() is called.
- Diffs the desired state against the last applied state to send only necessary FIDL commands.
- Caches the results of CheckConfig() to avoid redundant FIDL round-trips for
previously-validated configurations.
- Provides Inspect properties for monitoring API calls and cache behavior.
Thread-safety: This class is thread-unsafe; concurrent access must be externally synchronized.
Public Methods
void CoordinatorProxy (fidl::ClientEnd<fuchsia_hardware_display::Coordinator> coordinator, async_dispatcher_t * dispatcher, CheckConfigHeuristics check_config_heuristics, inspect::Node inspect_node)
Defined at line 23 of file ../../src/ui/scenic/lib/display/coordinator_proxy.cc
void CoordinatorProxy (fidl::WireSharedClient<fuchsia_hardware_display::Coordinator> coordinator, CheckConfigHeuristics check_config_heuristics, inspect::Node inspect_node)
Defined at line 31 of file ../../src/ui/scenic/lib/display/coordinator_proxy.cc
zx::result<> ImportImage (types::Extent2 image_dimensions, uint32_t image_tiling_type, WireBufferCollectionId buffer_collection_id, uint32_t buffer_index, ImageId image_id)
Corresponds to `fuchsia.hardware.display.Coordinator/ImportImage()`.
Two-way FIDL call is sent immediately, and the result is awaited synchronously.
Errors are either FIDL transport errors (most commonly ZX_ERR_PEER_CLOSED), or the error status
returned by the FIDL method. The latter are currently not specified by the Coordinator API.
Defined at line 71 of file ../../src/ui/scenic/lib/display/coordinator_proxy.cc
void ReleaseImage (const ImageId & image_id)
Corresponds to `fuchsia.hardware.display.Coordinator/ReleaseImage()`.
One-way FIDL call is sent immediately.
Defined at line 102 of file ../../src/ui/scenic/lib/display/coordinator_proxy.cc
void ImportEvent (zx::event event, const EventId & event_id)
Corresponds to `fuchsia.hardware.display.Coordinator/ImportEvent()`.
One-way FIDL call is sent immediately.
There are two flavors of `ImportEvent()`:
- basic: requires the caller to provide both a (consumed) event and an `EventId`
- convenient: generates an `EventId` and duplicates the event, then delegates to basic version
Defined at line 122 of file ../../src/ui/scenic/lib/display/coordinator_proxy.cc
EventId ImportEvent (const zx::event & event)
Defined at line 136 of file ../../src/ui/scenic/lib/display/coordinator_proxy.cc
void ReleaseEvent (const EventId & event_id)
Corresponds to `fuchsia.hardware.display.Coordinator/ReleaseEvent()`.
One-way FIDL call is sent immediately.
Defined at line 152 of file ../../src/ui/scenic/lib/display/coordinator_proxy.cc
uint64_t api_calls_received ()
Currently only used for testing, but OK to use for other purposes.
(remove this comment before using outside of tests)
Defined at line 163 of file ../../src/ui/scenic/lib/display/coordinator_proxy.h
LayerId CreateLayer ()
Corresponds to `fuchsia.hardware.display.Coordinator/CreateLayer()`.
Two-way FIDL call is sent immediately, and the result is awaited synchronously.
TODO(https://fxbug.dev/430976567): use one-way FIDL call after change to client-managed IDs.
Defined at line 163 of file ../../src/ui/scenic/lib/display/coordinator_proxy.cc
uint64_t api_calls_sent ()
Defined at line 164 of file ../../src/ui/scenic/lib/display/coordinator_proxy.h
uint64_t apply_config_calls_received ()
Defined at line 165 of file ../../src/ui/scenic/lib/display/coordinator_proxy.h
uint64_t apply_config_calls_sent ()
Defined at line 166 of file ../../src/ui/scenic/lib/display/coordinator_proxy.h
uint64_t check_config_calls_skipped ()
Defined at line 167 of file ../../src/ui/scenic/lib/display/coordinator_proxy.h
uint64_t check_config_calls_sent ()
Defined at line 168 of file ../../src/ui/scenic/lib/display/coordinator_proxy.h
fidl::WireSharedClient<fuchsia_hardware_display::Coordinator> & raw ()
TODO(https://fxbug.dev/447416966): Fix call sites to remove the need for this escape hatch, at
least in production; maybe some test-only use cases will remain.
Defined at line 172 of file ../../src/ui/scenic/lib/display/coordinator_proxy.h
bool is_valid ()
Defined at line 174 of file ../../src/ui/scenic/lib/display/coordinator_proxy.h
void DestroyLayer (const LayerId & layer_id)
Corresponds to `fuchsia.hardware.display.Coordinator/DestroyLayer()`.
One-way FIDL call is sent immediately.
Defined at line 186 of file ../../src/ui/scenic/lib/display/coordinator_proxy.cc
void SetDisplayMode (const DisplayId & display_id, const DisplayMode & mode)
Corresponds to `fuchsia.hardware.display.Coordinator/SetDisplayMode()`.
No FIDL call is sent immediately; it is deferred until it is (maybe) sent in `ApplyConfig()`.
`display_id` must not be `kInvalidDisplayId`. Each invocation must use the same ID; multiple
displays are not supported.
Defined at line 203 of file ../../src/ui/scenic/lib/display/coordinator_proxy.cc
void SetDisplayColorConversion (const DisplayId & display_id, const std::array<float, 3> & preoffsets, const std::array<float, 9> & coefficients, const std::array<float, 3> & postoffsets)
Corresponds to `fuchsia.hardware.display.Coordinator/SetDisplayColorConversion()`.
No FIDL call is sent immediately; it is deferred until it is (maybe) sent in `ApplyConfig()`.
`display_id` must not be `kInvalidDisplayId`. Each invocation must use the same ID; multiple
displays are not supported.
Defined at line 211 of file ../../src/ui/scenic/lib/display/coordinator_proxy.cc
void SetDisplayLayers (const DisplayId & display_id, const std::span<const LayerId> & layer_ids)
Corresponds to `fuchsia.hardware.display.Coordinator/SetDisplayLayers()`.
No FIDL call is sent immediately; it is deferred until it is (maybe) sent in `ApplyConfig()`.
`display_id` must not be `kInvalidDisplayId`. Each invocation must use the same ID; multiple
displays are not supported.
Defined at line 224 of file ../../src/ui/scenic/lib/display/coordinator_proxy.cc
void SetLayerPrimaryConfig (const LayerId & layer_id, const Extent2 & image_dimensions, uint32_t image_tiling_type)
Corresponds to `fuchsia.hardware.display.Coordinator/SetLayerPrimaryConfig()`.
No FIDL call is sent immediately; it is deferred until it is (maybe) sent in `ApplyConfig()`.
Defined at line 233 of file ../../src/ui/scenic/lib/display/coordinator_proxy.cc
void SetLayerPrimaryPosition (const LayerId & layer_id, const RotateFlip & transform, const Rectangle & image_source, const Rectangle & display_destination)
Corresponds to `fuchsia.hardware.display.Coordinator/SetLayerPrimaryPosition`.
No FIDL call is sent immediately; it is deferred until it is (maybe) sent in `ApplyConfig()`.
Defined at line 242 of file ../../src/ui/scenic/lib/display/coordinator_proxy.cc
void SetLayerPrimaryAlpha (const LayerId & layer_id, const BlendMode & blend_mode, float alpha_value)
Corresponds to `fuchsia.hardware.display.Coordinator/SetLayerPrimaryAlpha`.
No FIDL call is sent immediately; it is deferred until it is (maybe) sent in `ApplyConfig()`.
Defined at line 251 of file ../../src/ui/scenic/lib/display/coordinator_proxy.cc
void SetLayerImage (const LayerId & layer_id, const ImageId & image_id, const EventId & wait_event_id)
Corresponds to `fuchsia.hardware.display.Coordinator/SetLayerImage`.
No FIDL call is sent immediately; it is deferred until it is (maybe) sent in `ApplyConfig()`.
Defined at line 259 of file ../../src/ui/scenic/lib/display/coordinator_proxy.cc
void SetLayerColorConfig (const LayerId & layer_id, const WireColor & color, const Rectangle & display_destination)
Corresponds to `fuchsia.hardware.display.Coordinator/SetLayerColorConfig`.
No FIDL call is sent immediately; it is deferred until it is (maybe) sent in `ApplyConfig()`.
Defined at line 268 of file ../../src/ui/scenic/lib/display/coordinator_proxy.cc
zx::result<> ApplyConfig (const WireConfigStamp & config_stamp)
Augmented version of `fuchsia.hardware.display.Coordinator/ApplyConfig`.
Before the FIDL `ApplyConfig()` method is called, the following steps are taken:
- check whether the current draft configuration matches one that has already been cached
- exit early if `CheckConfig()` would fail
- send any diffs between the draft and last-applied config
- call FIDL `CheckConfig()` method, if necessary
- call FIDL `ApplyConfig()` method
Errors:
- ZX_BAD_STATE when `CheckConfig()` fails (or we know it would fail without calling it).
Defined at line 276 of file ../../src/ui/scenic/lib/display/coordinator_proxy.cc