Skip to main content

fidl_fuchsia_hardware_display/
fidl_fuchsia_hardware_display.rs

1// WARNING: This file is machine generated by fidlgen.
2
3#![warn(clippy::all)]
4#![allow(unused_parens, unused_mut, unused_imports, nonstandard_style)]
5
6use bitflags::bitflags;
7use fidl::client::QueryResponseFut;
8use fidl::encoding::{MessageBufFor, ProxyChannelBox, ResourceDialect};
9use fidl::endpoints::{ControlHandle as _, Responder as _};
10pub use fidl_fuchsia_hardware_display_common::*;
11use futures::future::{self, MaybeDone, TryFutureExt};
12use zx_status;
13
14#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
15pub struct CoordinatorImportBufferCollectionRequest {
16    pub buffer_collection_id: BufferCollectionId,
17    pub buffer_collection_token:
18        fidl::endpoints::ClientEnd<fidl_fuchsia_sysmem2::BufferCollectionTokenMarker>,
19}
20
21impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
22    for CoordinatorImportBufferCollectionRequest
23{
24}
25
26#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
27pub struct CoordinatorImportEventRequest {
28    pub event: fidl::Event,
29    pub id: EventId,
30}
31
32impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
33    for CoordinatorImportEventRequest
34{
35}
36
37#[derive(Debug, Default, PartialEq)]
38pub struct CoordinatorCommitConfigRequest {
39    /// Required. Must be valid and strictly monotonically-increasing.
40    pub stamp: Option<ConfigStamp>,
41    #[doc(hidden)]
42    pub __source_breaking: fidl::marker::SourceBreaking,
43}
44
45impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
46    for CoordinatorCommitConfigRequest
47{
48}
49
50#[derive(Debug, Default, PartialEq)]
51pub struct ProviderOpenCoordinatorRequest {
52    /// Required.
53    pub coordinator: Option<fidl::endpoints::ServerEnd<CoordinatorMarker>>,
54    /// Required.
55    pub coordinator_listener: Option<fidl::endpoints::ClientEnd<CoordinatorListenerMarker>>,
56    /// Required. Must be a valid priority.
57    pub priority: Option<ClientPriority>,
58    #[doc(hidden)]
59    pub __source_breaking: fidl::marker::SourceBreaking,
60}
61
62impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
63    for ProviderOpenCoordinatorRequest
64{
65}
66
67#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
68pub struct CoordinatorMarker;
69
70impl fidl::endpoints::ProtocolMarker for CoordinatorMarker {
71    type Proxy = CoordinatorProxy;
72    type RequestStream = CoordinatorRequestStream;
73    #[cfg(target_os = "fuchsia")]
74    type SynchronousProxy = CoordinatorSynchronousProxy;
75
76    const DEBUG_NAME: &'static str = "(anonymous) Coordinator";
77}
78pub type CoordinatorImportImageResult = Result<(), i32>;
79pub type CoordinatorCreateLayerResult = Result<(), i32>;
80pub type CoordinatorImportBufferCollectionResult = Result<(), i32>;
81pub type CoordinatorSetBufferCollectionConstraintsResult = Result<(), i32>;
82pub type CoordinatorIsCaptureSupportedResult = Result<bool, i32>;
83pub type CoordinatorStartCaptureResult = Result<(), i32>;
84pub type CoordinatorSetMinimumRgbResult = Result<(), i32>;
85pub type CoordinatorSetDisplayPowerModeResult = Result<(), i32>;
86
87pub trait CoordinatorProxyInterface: Send + Sync {
88    type ImportImageResponseFut: std::future::Future<Output = Result<CoordinatorImportImageResult, fidl::Error>>
89        + Send;
90    fn r#import_image(
91        &self,
92        image_metadata: &fidl_fuchsia_hardware_display_types::ImageMetadata,
93        buffer_collection_id: &BufferCollectionId,
94        buffer_index: u32,
95        image_id: &ImageId,
96    ) -> Self::ImportImageResponseFut;
97    fn r#release_image(&self, image_id: &ImageId) -> Result<(), fidl::Error>;
98    fn r#import_event(&self, event: fidl::Event, id: &EventId) -> Result<(), fidl::Error>;
99    fn r#release_event(&self, id: &EventId) -> Result<(), fidl::Error>;
100    type CreateLayerResponseFut: std::future::Future<Output = Result<CoordinatorCreateLayerResult, fidl::Error>>
101        + Send;
102    fn r#create_layer(&self, layer_id: &LayerId) -> Self::CreateLayerResponseFut;
103    fn r#destroy_layer(&self, layer_id: &LayerId) -> Result<(), fidl::Error>;
104    fn r#set_display_mode(
105        &self,
106        display_id: &fidl_fuchsia_hardware_display_types::DisplayId,
107        mode: &fidl_fuchsia_hardware_display_types::Mode,
108    ) -> Result<(), fidl::Error>;
109    fn r#set_display_color_conversion(
110        &self,
111        display_id: &fidl_fuchsia_hardware_display_types::DisplayId,
112        preoffsets: &[f32; 3],
113        coefficients: &[f32; 9],
114        postoffsets: &[f32; 3],
115    ) -> Result<(), fidl::Error>;
116    fn r#set_display_layers(
117        &self,
118        display_id: &fidl_fuchsia_hardware_display_types::DisplayId,
119        layer_ids: &[LayerId],
120    ) -> Result<(), fidl::Error>;
121    fn r#set_layer_primary_config(
122        &self,
123        layer_id: &LayerId,
124        image_metadata: &fidl_fuchsia_hardware_display_types::ImageMetadata,
125    ) -> Result<(), fidl::Error>;
126    fn r#set_layer_primary_position(
127        &self,
128        layer_id: &LayerId,
129        image_source_transformation: fidl_fuchsia_hardware_display_types::CoordinateTransformation,
130        image_source: &fidl_fuchsia_math::RectU,
131        display_destination: &fidl_fuchsia_math::RectU,
132    ) -> Result<(), fidl::Error>;
133    fn r#set_layer_primary_alpha(
134        &self,
135        layer_id: &LayerId,
136        mode: fidl_fuchsia_hardware_display_types::AlphaMode,
137        val: f32,
138    ) -> Result<(), fidl::Error>;
139    fn r#set_layer_color_config(
140        &self,
141        layer_id: &LayerId,
142        color: &fidl_fuchsia_hardware_display_types::Color,
143        display_destination: &fidl_fuchsia_math::RectU,
144    ) -> Result<(), fidl::Error>;
145    fn r#set_layer_image2(
146        &self,
147        layer_id: &LayerId,
148        image_id: &ImageId,
149        wait_event_id: &EventId,
150    ) -> Result<(), fidl::Error>;
151    type CheckConfigResponseFut: std::future::Future<
152            Output = Result<fidl_fuchsia_hardware_display_types::ConfigResult, fidl::Error>,
153        > + Send;
154    fn r#check_config(&self) -> Self::CheckConfigResponseFut;
155    fn r#discard_config(&self) -> Result<(), fidl::Error>;
156    type GetLatestCommittedConfigStampResponseFut: std::future::Future<Output = Result<ConfigStamp, fidl::Error>>
157        + Send;
158    fn r#get_latest_committed_config_stamp(&self)
159    -> Self::GetLatestCommittedConfigStampResponseFut;
160    fn r#commit_config(&self, payload: CoordinatorCommitConfigRequest) -> Result<(), fidl::Error>;
161    fn r#acknowledge_vsync(&self, cookie: u64) -> Result<(), fidl::Error>;
162    type ImportBufferCollectionResponseFut: std::future::Future<Output = Result<CoordinatorImportBufferCollectionResult, fidl::Error>>
163        + Send;
164    fn r#import_buffer_collection(
165        &self,
166        buffer_collection_id: &BufferCollectionId,
167        buffer_collection_token: fidl::endpoints::ClientEnd<
168            fidl_fuchsia_sysmem2::BufferCollectionTokenMarker,
169        >,
170    ) -> Self::ImportBufferCollectionResponseFut;
171    fn r#release_buffer_collection(
172        &self,
173        buffer_collection_id: &BufferCollectionId,
174    ) -> Result<(), fidl::Error>;
175    type SetBufferCollectionConstraintsResponseFut: std::future::Future<
176            Output = Result<CoordinatorSetBufferCollectionConstraintsResult, fidl::Error>,
177        > + Send;
178    fn r#set_buffer_collection_constraints(
179        &self,
180        buffer_collection_id: &BufferCollectionId,
181        buffer_usage: &fidl_fuchsia_hardware_display_types::ImageBufferUsage,
182    ) -> Self::SetBufferCollectionConstraintsResponseFut;
183    type IsCaptureSupportedResponseFut: std::future::Future<Output = Result<CoordinatorIsCaptureSupportedResult, fidl::Error>>
184        + Send;
185    fn r#is_capture_supported(&self) -> Self::IsCaptureSupportedResponseFut;
186    type StartCaptureResponseFut: std::future::Future<Output = Result<CoordinatorStartCaptureResult, fidl::Error>>
187        + Send;
188    fn r#start_capture(
189        &self,
190        signal_event_id: &EventId,
191        image_id: &ImageId,
192    ) -> Self::StartCaptureResponseFut;
193    type SetMinimumRgbResponseFut: std::future::Future<Output = Result<CoordinatorSetMinimumRgbResult, fidl::Error>>
194        + Send;
195    fn r#set_minimum_rgb(&self, minimum_rgb: u8) -> Self::SetMinimumRgbResponseFut;
196    type SetDisplayPowerModeResponseFut: std::future::Future<Output = Result<CoordinatorSetDisplayPowerModeResult, fidl::Error>>
197        + Send;
198    fn r#set_display_power_mode(
199        &self,
200        display_id: &fidl_fuchsia_hardware_display_types::DisplayId,
201        power_mode: fidl_fuchsia_hardware_display_types::PowerMode,
202    ) -> Self::SetDisplayPowerModeResponseFut;
203}
204#[derive(Debug)]
205#[cfg(target_os = "fuchsia")]
206pub struct CoordinatorSynchronousProxy {
207    client: fidl::client::sync::Client,
208}
209
210#[cfg(target_os = "fuchsia")]
211impl fidl::endpoints::SynchronousProxy for CoordinatorSynchronousProxy {
212    type Proxy = CoordinatorProxy;
213    type Protocol = CoordinatorMarker;
214
215    fn from_channel(inner: fidl::Channel) -> Self {
216        Self::new(inner)
217    }
218
219    fn into_channel(self) -> fidl::Channel {
220        self.client.into_channel()
221    }
222
223    fn as_channel(&self) -> &fidl::Channel {
224        self.client.as_channel()
225    }
226}
227
228#[cfg(target_os = "fuchsia")]
229impl CoordinatorSynchronousProxy {
230    pub fn new(channel: fidl::Channel) -> Self {
231        Self { client: fidl::client::sync::Client::new(channel) }
232    }
233
234    pub fn into_channel(self) -> fidl::Channel {
235        self.client.into_channel()
236    }
237
238    /// Waits until an event arrives and returns it. It is safe for other
239    /// threads to make concurrent requests while waiting for an event.
240    pub fn wait_for_event(
241        &self,
242        deadline: zx::MonotonicInstant,
243    ) -> Result<CoordinatorEvent, fidl::Error> {
244        CoordinatorEvent::decode(self.client.wait_for_event::<CoordinatorMarker>(deadline)?)
245    }
246
247    /// Imports a Buffer-Collection backed image.
248    ///
249    /// Returns `ZX_ERR_NOT_SUPPORTED` if the display hardware doesn't support
250    /// `image_metadata`.
251    /// Returns `ZX_ERR_ALREADY_EXISTS` if `image_id` was used in a successful
252    /// `ImportImage()` without a corresponding `ReleaseImage()`.
253    /// Returns `ZX_ERR_NO_MEMORY` if memory cannot be allocated for managing the image
254    /// Additionally, this method delegates internally to `fuchsia.hardware.display.engine/Engine`,
255    /// and will forward errors received from `ImportImage()` and `ImportImageForCapture()`.
256    ///
257    /// The implementation must ignore any Sysmem information around weak VMO
258    /// handles. Display stack consumers are responsible for ensuring that weak
259    /// VMOs are closed in a timely manner, which may involve calling
260    /// [`Coordinator.ReleaseImage`] and [`Coordinator.CommitConfig`].
261    pub fn r#import_image(
262        &self,
263        mut image_metadata: &fidl_fuchsia_hardware_display_types::ImageMetadata,
264        mut buffer_collection_id: &BufferCollectionId,
265        mut buffer_index: u32,
266        mut image_id: &ImageId,
267        ___deadline: zx::MonotonicInstant,
268    ) -> Result<CoordinatorImportImageResult, fidl::Error> {
269        let _response = self.client.send_query::<
270            CoordinatorImportImageRequest,
271            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
272            CoordinatorMarker,
273        >(
274            (image_metadata, buffer_collection_id, buffer_index, image_id,),
275            0x3a8636eb9656b4f4,
276            fidl::encoding::DynamicFlags::empty(),
277            ___deadline,
278        )?;
279        Ok(_response.map(|x| x))
280    }
281
282    /// Releases an imported image.
283    ///
284    /// `image_id` must be already imported by
285    /// [`fuchsia.hardware.display/Coordinator.ImportImage`].
286    ///
287    /// The image must not be the capture target of an ongoing capture specified
288    /// in [`fuchsia.hardware.display/Coordinator.StartCapture`].
289    ///
290    /// When an image is released, it is immediately removed from any draft
291    /// configurations, and any fences associated with the image are dropped.
292    /// The resources associated with the image will be released as soon as the
293    /// image is no longer in use.
294    pub fn r#release_image(&self, mut image_id: &ImageId) -> Result<(), fidl::Error> {
295        self.client.send::<CoordinatorReleaseImageRequest>(
296            (image_id,),
297            0x477192230517504,
298            fidl::encoding::DynamicFlags::empty(),
299        )
300    }
301
302    /// Imports an event into the driver and associates it with the given id.
303    ///
304    /// It is illegal for id to be equal to INVALID_DISP_ID, and it is undefined to
305    /// import one event with two different ids or to import two different events
306    /// with the same id (note that ids map well to koids).
307    ///
308    /// If a client is reusing events, they must clear the signal
309    /// before referencing the id again.
310    pub fn r#import_event(
311        &self,
312        mut event: fidl::Event,
313        mut id: &EventId,
314    ) -> Result<(), fidl::Error> {
315        self.client.send::<CoordinatorImportEventRequest>(
316            (event, id),
317            0x2864e5dc59390543,
318            fidl::encoding::DynamicFlags::empty(),
319        )
320    }
321
322    /// Releases the event imported with the given id.
323    ///
324    /// If any images are currently using the given event, the event
325    /// will still be waited up or signaled as appropriate before its
326    /// resources are released. It is an error to reuse an ID while the
327    /// submitted config has references to it.
328    pub fn r#release_event(&self, mut id: &EventId) -> Result<(), fidl::Error> {
329        self.client.send::<CoordinatorReleaseEventRequest>(
330            (id,),
331            0x32508c2101606b87,
332            fidl::encoding::DynamicFlags::empty(),
333        )
334    }
335
336    /// Creates a new layer.
337    ///
338    /// Layers are not associated with a particular display, but they can only be
339    /// shown on at most one display at any given time.  A layer is considered in
340    /// use from the time it is passed to SetDisplayLayers until a subsequent
341    /// configuration is committed which does not include the layer or until its
342    /// display is removed.
343    ///
344    /// A new layer is neither a primary layer nor a solid color fill layer
345    /// until [`Coordinator.SetLayerPrimaryConfig`] or
346    /// [`Coordinator.SetLayerColorConfig`] is called on it.
347    ///
348    /// * `layer_id` must be a valid ID (not equal to `INVALID_DISP_ID`).
349    /// * `layer_id` must not be in use (not equal to the ID of any currently
350    ///   existing layer in the same `Coordinator` session).
351    pub fn r#create_layer(
352        &self,
353        mut layer_id: &LayerId,
354        ___deadline: zx::MonotonicInstant,
355    ) -> Result<CoordinatorCreateLayerResult, fidl::Error> {
356        let _response = self.client.send_query::<
357            CoordinatorCreateLayerRequest,
358            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
359            CoordinatorMarker,
360        >(
361            (layer_id,),
362            0x2137cfd788a3496b,
363            fidl::encoding::DynamicFlags::empty(),
364            ___deadline,
365        )?;
366        Ok(_response.map(|x| x))
367    }
368
369    /// Destroys the given layer.
370    ///
371    /// It is illegal to destroy a layer which does not exist or which is in use.
372    pub fn r#destroy_layer(&self, mut layer_id: &LayerId) -> Result<(), fidl::Error> {
373        self.client.send::<CoordinatorDestroyLayerRequest>(
374            (layer_id,),
375            0x386e12d092bea2f8,
376            fidl::encoding::DynamicFlags::empty(),
377        )
378    }
379
380    /// Sets the mode for a display.
381    pub fn r#set_display_mode(
382        &self,
383        mut display_id: &fidl_fuchsia_hardware_display_types::DisplayId,
384        mut mode: &fidl_fuchsia_hardware_display_types::Mode,
385    ) -> Result<(), fidl::Error> {
386        self.client.send::<CoordinatorSetDisplayModeRequest>(
387            (display_id, mode),
388            0xbde3c59ee9c1777,
389            fidl::encoding::DynamicFlags::empty(),
390        )
391    }
392
393    /// Set the color conversion applied to the display. The conversion is applied to
394    /// to each pixel according to the formula:
395    ///
396    /// (coefficients * (pixel + preoffsets)) + postoffsets
397    ///
398    /// where pixel is a column vector consisting of the pixel's 3 components.
399    ///
400    /// `coefficients` is passed in row-major order. If the first entry of an array is NaN, the
401    /// array is treated as the identity element for the relevant operation.
402    /// Hardware that support color correction generally accept a limited range of coefficient
403    /// values. Coefficients in the range of [-2, 2] inclusive will be accepted by most
404    /// hardware. The hardware driver will clamp values that are outside its acceptable range.
405    ///
406    /// `preoffsets`, `postoffsets`: Clients are encourged to produce color correction values that
407    /// do not depend on pre and post offsets since some hardware do not have support for that.
408    /// For cases where pre and post offset values need to be used, the range should be limited to
409    /// (-1, 1) exclusive as confirmed by CheckConfig API. Values outside this range will be
410    /// rejected.
411    ///
412    /// Clients are encouraged to use the CheckConfig API to confirm support for correction and to
413    /// validate their color correction input values.
414    ///
415    /// This a stateful call. Once color conversion values have been succesfully applied via a call
416    /// to CommitConfig() they will remain in place until changed and another CommitConfig() call is
417    /// successful. If SetDisplayColorConversion() is called and then the config is discarded, then
418    /// the last successfully committed state is restored.
419    pub fn r#set_display_color_conversion(
420        &self,
421        mut display_id: &fidl_fuchsia_hardware_display_types::DisplayId,
422        mut preoffsets: &[f32; 3],
423        mut coefficients: &[f32; 9],
424        mut postoffsets: &[f32; 3],
425    ) -> Result<(), fidl::Error> {
426        self.client.send::<CoordinatorSetDisplayColorConversionRequest>(
427            (display_id, preoffsets, coefficients, postoffsets),
428            0x2f18186a987d51aa,
429            fidl::encoding::DynamicFlags::empty(),
430        )
431    }
432
433    /// Assigns a list of layers to be composited on a display.
434    pub fn r#set_display_layers(
435        &self,
436        mut display_id: &fidl_fuchsia_hardware_display_types::DisplayId,
437        mut layer_ids: &[LayerId],
438    ) -> Result<(), fidl::Error> {
439        self.client.send::<CoordinatorSetDisplayLayersRequest>(
440            (display_id, layer_ids),
441            0x190e0f6f93be1d89,
442            fidl::encoding::DynamicFlags::empty(),
443        )
444    }
445
446    /// Configures the layer as a primary layer with no image and the default
447    /// config.
448    ///
449    /// This method makes the layer a primary layer. Each call resets all
450    /// primary layer properties to their defaults, even if the layer was
451    /// already a primary layer, and even if `image_metadata` matches the
452    /// layer's current metadata. The defaults are:
453    /// * position (see [`Coordinator.SetLayerPrimaryPosition`]): no
454    ///   `image_source` cropping, the identity transform, positioned in the
455    ///   top-left corner of the composited output, and no scaling. In other
456    ///   words, `image_source` and `display_destination` both cover the image
457    ///   specified by `image_metadata`.
458    /// * alpha (see [`Coordinator.SetLayerPrimaryAlpha`]): the `DISABLE` alpha
459    ///   mode. The layer is opaque.
460    ///
461    /// Clients that need non-default values must call
462    /// [`Coordinator.SetLayerPrimaryPosition`] and/or
463    /// [`Coordinator.SetLayerPrimaryAlpha`] after each call to this method.
464    ///
465    /// See the documentation on [`Coordinator.SetLayerImage2`] for details on
466    /// how this method affects the layer's contents.
467    ///
468    /// It is illegal to pass an invalid layer id.
469    pub fn r#set_layer_primary_config(
470        &self,
471        mut layer_id: &LayerId,
472        mut image_metadata: &fidl_fuchsia_hardware_display_types::ImageMetadata,
473    ) -> Result<(), fidl::Error> {
474        self.client.send::<CoordinatorSetLayerPrimaryConfigRequest>(
475            (layer_id, image_metadata),
476            0x68d89ebd518b45b9,
477            fidl::encoding::DynamicFlags::empty(),
478        )
479    }
480
481    /// Sets the layer transform, scaling, and positioning.
482    ///
483    /// The values set here are reset by subsequent calls to
484    /// [`Coordinator.SetLayerPrimaryConfig`] and
485    /// [`Coordinator.SetLayerColorConfig`].
486    ///
487    /// CheckConfig() will return INVALID_CONFIG if any of the configuration
488    /// validity conditions specified here is violated.
489    ///
490    /// Calling this on a non-primary layer or passing an invalid transform is
491    /// illegal.
492    pub fn r#set_layer_primary_position(
493        &self,
494        mut layer_id: &LayerId,
495        mut image_source_transformation: fidl_fuchsia_hardware_display_types::CoordinateTransformation,
496        mut image_source: &fidl_fuchsia_math::RectU,
497        mut display_destination: &fidl_fuchsia_math::RectU,
498    ) -> Result<(), fidl::Error> {
499        self.client.send::<CoordinatorSetLayerPrimaryPositionRequest>(
500            (layer_id, image_source_transformation, image_source, display_destination),
501            0x27b192b5a43851e2,
502            fidl::encoding::DynamicFlags::empty(),
503        )
504    }
505
506    /// Sets the alpha mode of the plane.
507    ///
508    /// If `mode` == DISABLED, the layer is opaque and `val` is ignored.
509    ///
510    /// If `mode` == PREMULTIPLIED or HW_MULTIPLY and `val` is NaN, the alpha
511    /// used when blending is determined by the per-pixel alpha channel.
512    ///
513    /// If `mode` == PREMULTIPLIED or HW_MULTIPLY and `val` is not NaN, the
514    /// alpha used when blending is the product of `val` and any per-pixel
515    /// alpha. Additionally, if `mode` == PREMULTIPLIED, then the hardware
516    /// premultiplies the color channel with `val` before blending.
517    ///
518    /// The values set here are reset by subsequent calls to
519    /// [`Coordinator.SetLayerPrimaryConfig`] and
520    /// [`Coordinator.SetLayerColorConfig`].
521    ///
522    /// It is illegal to call this on a non-primary layer, to pass an
523    /// invalid mode, or to pass a value of `val` which is not NaN or
524    /// in the range [0, 1].
525    pub fn r#set_layer_primary_alpha(
526        &self,
527        mut layer_id: &LayerId,
528        mut mode: fidl_fuchsia_hardware_display_types::AlphaMode,
529        mut val: f32,
530    ) -> Result<(), fidl::Error> {
531        self.client.send::<CoordinatorSetLayerPrimaryAlphaRequest>(
532            (layer_id, mode, val),
533            0x104cf2b18b27296d,
534            fidl::encoding::DynamicFlags::empty(),
535        )
536    }
537
538    /// Configures the layer as a solid color fill layer.
539    ///
540    /// This method makes the layer a solid color fill layer. The arguments
541    /// fully define the layer's contents. No primary layer properties (set by
542    /// [`Coordinator.SetLayerPrimaryConfig`],
543    /// [`Coordinator.SetLayerPrimaryPosition`], or
544    /// [`Coordinator.SetLayerPrimaryAlpha`]) carry over into the color fill
545    /// layer. If the layer is later made a primary layer again, via
546    /// [`Coordinator.SetLayerPrimaryConfig`], all primary layer properties
547    /// start out at their defaults.
548    ///
549    /// It is illegal to call this on an invalid layer.
550    pub fn r#set_layer_color_config(
551        &self,
552        mut layer_id: &LayerId,
553        mut color: &fidl_fuchsia_hardware_display_types::Color,
554        mut display_destination: &fidl_fuchsia_math::RectU,
555    ) -> Result<(), fidl::Error> {
556        self.client.send::<CoordinatorSetLayerColorConfigRequest>(
557            (layer_id, color, display_destination),
558            0x2fa91e9a2a01875f,
559            fidl::encoding::DynamicFlags::empty(),
560        )
561    }
562
563    /// Sets the image for the layer's draft configuration.
564    ///
565    /// If wait_event_id corresponds to an imported event, the driver will
566    /// wait for ZX_EVENT_SIGNALED on the object before presenting the image.
567    ///
568    /// A layer's submitted image is the most recently committed image which either has
569    /// no wait event or whose wait event has been signaled. Whenever a new image
570    /// is committed, any older images which never got committed are dropped, and
571    /// their signal events will be fired as soon as their wait events are
572    /// signaled. The driver also does not have any concept like 'target vsync',
573    /// meaning that if multiple images are committed within one vsync period, then
574    /// only the last image will actually be displayed.
575    ///
576    /// By default, the driver retains a submitted image until a new image is
577    /// submitted. However, setting a layer's ImageConfig with SetLayerPrimaryConfig
578    /// resets the layer's submitted and waiting images, even if the new ImageConfig
579    /// matches the old ImageConfig.
580    ///
581    /// An image cannot be used for multiple layers simultaneously, nor can an
582    /// image be given back to the display coordinator while it is still in use.
583    /// An image is considered in use when it is part of a draft configuration
584    /// or from when its configuration is committed until it is replaced by a
585    /// subsequent configuration that is *displayed* (not merely committed).
586    ///
587    /// It is illegal to call this with an invalid layer or image id, to
588    /// call it on a color layer, or to call it with an image and layer whose
589    /// ImageConfigs do not match. It is illegal to commit a configuration
590    /// with an image layer that has no image (note that is is not illegal to
591    /// validate such a configuration). It is illegal to reuse a wait event which
592    /// another layer that has not been presented is waiting on.
593    ///
594    /// Each layer can track a maximum of `MAX_WAITING_IMAGES_PER_LAYER` waiting images.
595    /// An image becomes "waiting" when it is the most recent image set to a layer that appears in
596    /// a config that is committed via `CommitConfig()` or similar.  To avoid exceeding the maximum,
597    /// the client can infer that the image is no longer waiting by:
598    ///   - noting the config stamp when the config containing the layer/image is committed
599    ///   - watching for that same (or later) config stamp to be returned by
600    ///     `CoordinatorListener.OnVsync()`.
601    pub fn r#set_layer_image2(
602        &self,
603        mut layer_id: &LayerId,
604        mut image_id: &ImageId,
605        mut wait_event_id: &EventId,
606    ) -> Result<(), fidl::Error> {
607        self.client.send::<CoordinatorSetLayerImage2Request>(
608            (layer_id, image_id, wait_event_id),
609            0x53c6376dfc13a971,
610            fidl::encoding::DynamicFlags::empty(),
611        )
612    }
613
614    /// Validates the draft configuration.
615    ///
616    /// Validation entails checking that the draft configuration can be used
617    /// by the system's display hardware.
618    ///
619    /// Most SetX operations require verifying the draft configuration. The
620    /// following operations do not require revalidation.
621    /// * SetLayerImage2()
622    pub fn r#check_config(
623        &self,
624        ___deadline: zx::MonotonicInstant,
625    ) -> Result<fidl_fuchsia_hardware_display_types::ConfigResult, fidl::Error> {
626        let _response = self.client.send_query::<
627            fidl::encoding::EmptyPayload,
628            CoordinatorCheckConfigResponse,
629            CoordinatorMarker,
630        >(
631            (),
632            0x2bcfb4eb16878158,
633            fidl::encoding::DynamicFlags::empty(),
634            ___deadline,
635        )?;
636        Ok(_response.res)
637    }
638
639    /// Discard all draft configuration changes.
640    pub fn r#discard_config(&self) -> Result<(), fidl::Error> {
641        self.client.send::<fidl::encoding::EmptyPayload>(
642            (),
643            0x1673399e9231dedf,
644            fidl::encoding::DynamicFlags::empty(),
645        )
646    }
647
648    /// Gets the stamp provided with the latest configuration the client
649    /// committed (by calling CommitConfig()) and the display core driver
650    /// accepted; the display configuration may not have been rendered yet
651    /// because of pending image availability or draft layer changes.
652    /// If no configuration was committed before, returns `INVALID_CONFIG_STAMP_VALUE`.
653    pub fn r#get_latest_committed_config_stamp(
654        &self,
655        ___deadline: zx::MonotonicInstant,
656    ) -> Result<ConfigStamp, fidl::Error> {
657        let _response = self.client.send_query::<
658            fidl::encoding::EmptyPayload,
659            CoordinatorGetLatestCommittedConfigStampResponse,
660            CoordinatorMarker,
661        >(
662            (),
663            0x2a441f2c81af5d66,
664            fidl::encoding::DynamicFlags::empty(),
665            ___deadline,
666        )?;
667        Ok(_response.stamp)
668    }
669
670    /// Commits any draft changes to the current configuration. This will
671    /// not apply draft changes to layers which are not on any display.
672    ///
673    /// If the draft configuration cannot be committed, this call will silently
674    /// fail, so the client should ensure its configuration is valid by
675    /// calling [`Coordinator.CheckConfig`].
676    pub fn r#commit_config(
677        &self,
678        mut payload: CoordinatorCommitConfigRequest,
679    ) -> Result<(), fidl::Error> {
680        self.client.send::<CoordinatorCommitConfigRequest>(
681            &mut payload,
682            0x4489cbd2fcfbaeaf,
683            fidl::encoding::DynamicFlags::empty(),
684        )
685    }
686
687    /// Acknowledges the receipt of one `OnVsync` message.
688    pub fn r#acknowledge_vsync(&self, mut cookie: u64) -> Result<(), fidl::Error> {
689        self.client.send::<CoordinatorAcknowledgeVsyncRequest>(
690            (cookie,),
691            0x25e921d26107d6ef,
692            fidl::encoding::DynamicFlags::empty(),
693        )
694    }
695
696    /// Import a sysmem buffer collection token. `buffer_collection_id` must not
697    /// already be in use.
698    pub fn r#import_buffer_collection(
699        &self,
700        mut buffer_collection_id: &BufferCollectionId,
701        mut buffer_collection_token: fidl::endpoints::ClientEnd<
702            fidl_fuchsia_sysmem2::BufferCollectionTokenMarker,
703        >,
704        ___deadline: zx::MonotonicInstant,
705    ) -> Result<CoordinatorImportBufferCollectionResult, fidl::Error> {
706        let _response = self.client.send_query::<
707            CoordinatorImportBufferCollectionRequest,
708            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
709            CoordinatorMarker,
710        >(
711            (buffer_collection_id, buffer_collection_token,),
712            0x30d06f510e7f4601,
713            fidl::encoding::DynamicFlags::empty(),
714            ___deadline,
715        )?;
716        Ok(_response.map(|x| x))
717    }
718
719    /// Release an imported buffer collection.
720    pub fn r#release_buffer_collection(
721        &self,
722        mut buffer_collection_id: &BufferCollectionId,
723    ) -> Result<(), fidl::Error> {
724        self.client.send::<CoordinatorReleaseBufferCollectionRequest>(
725            (buffer_collection_id,),
726            0x1c7dd5f8b0690be0,
727            fidl::encoding::DynamicFlags::empty(),
728        )
729    }
730
731    /// Takes an imported buffer collection and sets the constraints
732    /// on it so that it can be imported with a specific config.
733    pub fn r#set_buffer_collection_constraints(
734        &self,
735        mut buffer_collection_id: &BufferCollectionId,
736        mut buffer_usage: &fidl_fuchsia_hardware_display_types::ImageBufferUsage,
737        ___deadline: zx::MonotonicInstant,
738    ) -> Result<CoordinatorSetBufferCollectionConstraintsResult, fidl::Error> {
739        let _response = self.client.send_query::<
740            CoordinatorSetBufferCollectionConstraintsRequest,
741            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
742            CoordinatorMarker,
743        >(
744            (buffer_collection_id, buffer_usage,),
745            0x509a4ee9af6035df,
746            fidl::encoding::DynamicFlags::empty(),
747            ___deadline,
748        )?;
749        Ok(_response.map(|x| x))
750    }
751
752    /// Returns true if Capture is supported on the platform.
753    pub fn r#is_capture_supported(
754        &self,
755        ___deadline: zx::MonotonicInstant,
756    ) -> Result<CoordinatorIsCaptureSupportedResult, fidl::Error> {
757        let _response = self.client.send_query::<
758            fidl::encoding::EmptyPayload,
759            fidl::encoding::ResultType<CoordinatorIsCaptureSupportedResponse, i32>,
760            CoordinatorMarker,
761        >(
762            (),
763            0x4ca407277277971b,
764            fidl::encoding::DynamicFlags::empty(),
765            ___deadline,
766        )?;
767        Ok(_response.map(|x| x.supported))
768    }
769
770    /// Starts capture. Client must provide a valid signal_event_id and
771    /// image_id. signal_event_id must have been imported into the driver
772    /// using ImportEvent FIDL API. Image_id is the id from ImportImageForCapture.
773    /// The client will get notified once capture is complete via signal_event_id.
774    /// Returns ZX_ERR_NOT_SUPPORTED if coordinator does not support capture
775    pub fn r#start_capture(
776        &self,
777        mut signal_event_id: &EventId,
778        mut image_id: &ImageId,
779        ___deadline: zx::MonotonicInstant,
780    ) -> Result<CoordinatorStartCaptureResult, fidl::Error> {
781        let _response = self.client.send_query::<
782            CoordinatorStartCaptureRequest,
783            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
784            CoordinatorMarker,
785        >(
786            (signal_event_id, image_id,),
787            0x35cb38f19d96a8db,
788            fidl::encoding::DynamicFlags::empty(),
789            ___deadline,
790        )?;
791        Ok(_response.map(|x| x))
792    }
793
794    /// Set the minimum value of rgb channels. Valid range [0 255] inclusive. Returns
795    /// ZX_ERR_NOT_SUPPORTED when the display hardware does not support this feature.
796    /// This API is meant to address backlight bleeding that may occur on some hardware
797    /// that have a specific type of panel and hardware assembly. The evolution of this
798    /// API is highly hardware and product dependant and therefore as products evolve, this
799    /// API may change or support for this API may become non-existent. Therefore, this
800    /// API should be used with caution.
801    ///
802    /// Unlike other calls in this API, SetMiniumRgb is applied immediately, and does not
803    /// wait for CommitConfig(). It is, however, still stateful.
804    pub fn r#set_minimum_rgb(
805        &self,
806        mut minimum_rgb: u8,
807        ___deadline: zx::MonotonicInstant,
808    ) -> Result<CoordinatorSetMinimumRgbResult, fidl::Error> {
809        let _response = self.client.send_query::<
810            CoordinatorSetMinimumRgbRequest,
811            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
812            CoordinatorMarker,
813        >(
814            (minimum_rgb,),
815            0x1b49251437038b0b,
816            fidl::encoding::DynamicFlags::empty(),
817            ___deadline,
818        )?;
819        Ok(_response.map(|x| x))
820    }
821
822    /// Sets the display panel power mode.
823    ///
824    /// This call takes effect immediately. Clients don't need to call
825    /// [`Coordinator.CommitConfig`].
826    ///
827    /// Fails with ZX_ERR_NOT_FOUND if `display_id` does not belong to a display
828    /// known by the Coordinator. This can happen if a client issues a call to
829    /// [`Coordinator.SetDisplayPowerMode`] before it receives a notification
830    /// that the display was removed.
831    ///
832    /// This method is not idempotent. Each [`Coordinator.SetDisplayPowerMode`]
833    /// call explicitly sets the power mode on the display hardware, though the
834    /// display hardware driver may choose to behave idempotently.
835    ///
836    /// Fails with ZX_ERR_NOT_SUPPORTED if the display drivers or the hardware
837    /// don't support the given `power_mode`.
838    pub fn r#set_display_power_mode(
839        &self,
840        mut display_id: &fidl_fuchsia_hardware_display_types::DisplayId,
841        mut power_mode: fidl_fuchsia_hardware_display_types::PowerMode,
842        ___deadline: zx::MonotonicInstant,
843    ) -> Result<CoordinatorSetDisplayPowerModeResult, fidl::Error> {
844        let _response = self.client.send_query::<
845            CoordinatorSetDisplayPowerModeRequest,
846            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
847            CoordinatorMarker,
848        >(
849            (display_id, power_mode,),
850            0xf4672f055072c92,
851            fidl::encoding::DynamicFlags::empty(),
852            ___deadline,
853        )?;
854        Ok(_response.map(|x| x))
855    }
856}
857
858#[cfg(target_os = "fuchsia")]
859impl From<CoordinatorSynchronousProxy> for zx::NullableHandle {
860    fn from(value: CoordinatorSynchronousProxy) -> Self {
861        value.into_channel().into()
862    }
863}
864
865#[cfg(target_os = "fuchsia")]
866impl From<fidl::Channel> for CoordinatorSynchronousProxy {
867    fn from(value: fidl::Channel) -> Self {
868        Self::new(value)
869    }
870}
871
872#[cfg(target_os = "fuchsia")]
873impl fidl::endpoints::FromClient for CoordinatorSynchronousProxy {
874    type Protocol = CoordinatorMarker;
875
876    fn from_client(value: fidl::endpoints::ClientEnd<CoordinatorMarker>) -> Self {
877        Self::new(value.into_channel())
878    }
879}
880
881#[derive(Debug, Clone)]
882pub struct CoordinatorProxy {
883    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
884}
885
886impl fidl::endpoints::Proxy for CoordinatorProxy {
887    type Protocol = CoordinatorMarker;
888
889    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
890        Self::new(inner)
891    }
892
893    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
894        self.client.into_channel().map_err(|client| Self { client })
895    }
896
897    fn as_channel(&self) -> &::fidl::AsyncChannel {
898        self.client.as_channel()
899    }
900}
901
902impl CoordinatorProxy {
903    /// Create a new Proxy for fuchsia.hardware.display/Coordinator.
904    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
905        let protocol_name = <CoordinatorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
906        Self { client: fidl::client::Client::new(channel, protocol_name) }
907    }
908
909    /// Get a Stream of events from the remote end of the protocol.
910    ///
911    /// # Panics
912    ///
913    /// Panics if the event stream was already taken.
914    pub fn take_event_stream(&self) -> CoordinatorEventStream {
915        CoordinatorEventStream { event_receiver: self.client.take_event_receiver() }
916    }
917
918    /// Imports a Buffer-Collection backed image.
919    ///
920    /// Returns `ZX_ERR_NOT_SUPPORTED` if the display hardware doesn't support
921    /// `image_metadata`.
922    /// Returns `ZX_ERR_ALREADY_EXISTS` if `image_id` was used in a successful
923    /// `ImportImage()` without a corresponding `ReleaseImage()`.
924    /// Returns `ZX_ERR_NO_MEMORY` if memory cannot be allocated for managing the image
925    /// Additionally, this method delegates internally to `fuchsia.hardware.display.engine/Engine`,
926    /// and will forward errors received from `ImportImage()` and `ImportImageForCapture()`.
927    ///
928    /// The implementation must ignore any Sysmem information around weak VMO
929    /// handles. Display stack consumers are responsible for ensuring that weak
930    /// VMOs are closed in a timely manner, which may involve calling
931    /// [`Coordinator.ReleaseImage`] and [`Coordinator.CommitConfig`].
932    pub fn r#import_image(
933        &self,
934        mut image_metadata: &fidl_fuchsia_hardware_display_types::ImageMetadata,
935        mut buffer_collection_id: &BufferCollectionId,
936        mut buffer_index: u32,
937        mut image_id: &ImageId,
938    ) -> fidl::client::QueryResponseFut<
939        CoordinatorImportImageResult,
940        fidl::encoding::DefaultFuchsiaResourceDialect,
941    > {
942        CoordinatorProxyInterface::r#import_image(
943            self,
944            image_metadata,
945            buffer_collection_id,
946            buffer_index,
947            image_id,
948        )
949    }
950
951    /// Releases an imported image.
952    ///
953    /// `image_id` must be already imported by
954    /// [`fuchsia.hardware.display/Coordinator.ImportImage`].
955    ///
956    /// The image must not be the capture target of an ongoing capture specified
957    /// in [`fuchsia.hardware.display/Coordinator.StartCapture`].
958    ///
959    /// When an image is released, it is immediately removed from any draft
960    /// configurations, and any fences associated with the image are dropped.
961    /// The resources associated with the image will be released as soon as the
962    /// image is no longer in use.
963    pub fn r#release_image(&self, mut image_id: &ImageId) -> Result<(), fidl::Error> {
964        CoordinatorProxyInterface::r#release_image(self, image_id)
965    }
966
967    /// Imports an event into the driver and associates it with the given id.
968    ///
969    /// It is illegal for id to be equal to INVALID_DISP_ID, and it is undefined to
970    /// import one event with two different ids or to import two different events
971    /// with the same id (note that ids map well to koids).
972    ///
973    /// If a client is reusing events, they must clear the signal
974    /// before referencing the id again.
975    pub fn r#import_event(
976        &self,
977        mut event: fidl::Event,
978        mut id: &EventId,
979    ) -> Result<(), fidl::Error> {
980        CoordinatorProxyInterface::r#import_event(self, event, id)
981    }
982
983    /// Releases the event imported with the given id.
984    ///
985    /// If any images are currently using the given event, the event
986    /// will still be waited up or signaled as appropriate before its
987    /// resources are released. It is an error to reuse an ID while the
988    /// submitted config has references to it.
989    pub fn r#release_event(&self, mut id: &EventId) -> Result<(), fidl::Error> {
990        CoordinatorProxyInterface::r#release_event(self, id)
991    }
992
993    /// Creates a new layer.
994    ///
995    /// Layers are not associated with a particular display, but they can only be
996    /// shown on at most one display at any given time.  A layer is considered in
997    /// use from the time it is passed to SetDisplayLayers until a subsequent
998    /// configuration is committed which does not include the layer or until its
999    /// display is removed.
1000    ///
1001    /// A new layer is neither a primary layer nor a solid color fill layer
1002    /// until [`Coordinator.SetLayerPrimaryConfig`] or
1003    /// [`Coordinator.SetLayerColorConfig`] is called on it.
1004    ///
1005    /// * `layer_id` must be a valid ID (not equal to `INVALID_DISP_ID`).
1006    /// * `layer_id` must not be in use (not equal to the ID of any currently
1007    ///   existing layer in the same `Coordinator` session).
1008    pub fn r#create_layer(
1009        &self,
1010        mut layer_id: &LayerId,
1011    ) -> fidl::client::QueryResponseFut<
1012        CoordinatorCreateLayerResult,
1013        fidl::encoding::DefaultFuchsiaResourceDialect,
1014    > {
1015        CoordinatorProxyInterface::r#create_layer(self, layer_id)
1016    }
1017
1018    /// Destroys the given layer.
1019    ///
1020    /// It is illegal to destroy a layer which does not exist or which is in use.
1021    pub fn r#destroy_layer(&self, mut layer_id: &LayerId) -> Result<(), fidl::Error> {
1022        CoordinatorProxyInterface::r#destroy_layer(self, layer_id)
1023    }
1024
1025    /// Sets the mode for a display.
1026    pub fn r#set_display_mode(
1027        &self,
1028        mut display_id: &fidl_fuchsia_hardware_display_types::DisplayId,
1029        mut mode: &fidl_fuchsia_hardware_display_types::Mode,
1030    ) -> Result<(), fidl::Error> {
1031        CoordinatorProxyInterface::r#set_display_mode(self, display_id, mode)
1032    }
1033
1034    /// Set the color conversion applied to the display. The conversion is applied to
1035    /// to each pixel according to the formula:
1036    ///
1037    /// (coefficients * (pixel + preoffsets)) + postoffsets
1038    ///
1039    /// where pixel is a column vector consisting of the pixel's 3 components.
1040    ///
1041    /// `coefficients` is passed in row-major order. If the first entry of an array is NaN, the
1042    /// array is treated as the identity element for the relevant operation.
1043    /// Hardware that support color correction generally accept a limited range of coefficient
1044    /// values. Coefficients in the range of [-2, 2] inclusive will be accepted by most
1045    /// hardware. The hardware driver will clamp values that are outside its acceptable range.
1046    ///
1047    /// `preoffsets`, `postoffsets`: Clients are encourged to produce color correction values that
1048    /// do not depend on pre and post offsets since some hardware do not have support for that.
1049    /// For cases where pre and post offset values need to be used, the range should be limited to
1050    /// (-1, 1) exclusive as confirmed by CheckConfig API. Values outside this range will be
1051    /// rejected.
1052    ///
1053    /// Clients are encouraged to use the CheckConfig API to confirm support for correction and to
1054    /// validate their color correction input values.
1055    ///
1056    /// This a stateful call. Once color conversion values have been succesfully applied via a call
1057    /// to CommitConfig() they will remain in place until changed and another CommitConfig() call is
1058    /// successful. If SetDisplayColorConversion() is called and then the config is discarded, then
1059    /// the last successfully committed state is restored.
1060    pub fn r#set_display_color_conversion(
1061        &self,
1062        mut display_id: &fidl_fuchsia_hardware_display_types::DisplayId,
1063        mut preoffsets: &[f32; 3],
1064        mut coefficients: &[f32; 9],
1065        mut postoffsets: &[f32; 3],
1066    ) -> Result<(), fidl::Error> {
1067        CoordinatorProxyInterface::r#set_display_color_conversion(
1068            self,
1069            display_id,
1070            preoffsets,
1071            coefficients,
1072            postoffsets,
1073        )
1074    }
1075
1076    /// Assigns a list of layers to be composited on a display.
1077    pub fn r#set_display_layers(
1078        &self,
1079        mut display_id: &fidl_fuchsia_hardware_display_types::DisplayId,
1080        mut layer_ids: &[LayerId],
1081    ) -> Result<(), fidl::Error> {
1082        CoordinatorProxyInterface::r#set_display_layers(self, display_id, layer_ids)
1083    }
1084
1085    /// Configures the layer as a primary layer with no image and the default
1086    /// config.
1087    ///
1088    /// This method makes the layer a primary layer. Each call resets all
1089    /// primary layer properties to their defaults, even if the layer was
1090    /// already a primary layer, and even if `image_metadata` matches the
1091    /// layer's current metadata. The defaults are:
1092    /// * position (see [`Coordinator.SetLayerPrimaryPosition`]): no
1093    ///   `image_source` cropping, the identity transform, positioned in the
1094    ///   top-left corner of the composited output, and no scaling. In other
1095    ///   words, `image_source` and `display_destination` both cover the image
1096    ///   specified by `image_metadata`.
1097    /// * alpha (see [`Coordinator.SetLayerPrimaryAlpha`]): the `DISABLE` alpha
1098    ///   mode. The layer is opaque.
1099    ///
1100    /// Clients that need non-default values must call
1101    /// [`Coordinator.SetLayerPrimaryPosition`] and/or
1102    /// [`Coordinator.SetLayerPrimaryAlpha`] after each call to this method.
1103    ///
1104    /// See the documentation on [`Coordinator.SetLayerImage2`] for details on
1105    /// how this method affects the layer's contents.
1106    ///
1107    /// It is illegal to pass an invalid layer id.
1108    pub fn r#set_layer_primary_config(
1109        &self,
1110        mut layer_id: &LayerId,
1111        mut image_metadata: &fidl_fuchsia_hardware_display_types::ImageMetadata,
1112    ) -> Result<(), fidl::Error> {
1113        CoordinatorProxyInterface::r#set_layer_primary_config(self, layer_id, image_metadata)
1114    }
1115
1116    /// Sets the layer transform, scaling, and positioning.
1117    ///
1118    /// The values set here are reset by subsequent calls to
1119    /// [`Coordinator.SetLayerPrimaryConfig`] and
1120    /// [`Coordinator.SetLayerColorConfig`].
1121    ///
1122    /// CheckConfig() will return INVALID_CONFIG if any of the configuration
1123    /// validity conditions specified here is violated.
1124    ///
1125    /// Calling this on a non-primary layer or passing an invalid transform is
1126    /// illegal.
1127    pub fn r#set_layer_primary_position(
1128        &self,
1129        mut layer_id: &LayerId,
1130        mut image_source_transformation: fidl_fuchsia_hardware_display_types::CoordinateTransformation,
1131        mut image_source: &fidl_fuchsia_math::RectU,
1132        mut display_destination: &fidl_fuchsia_math::RectU,
1133    ) -> Result<(), fidl::Error> {
1134        CoordinatorProxyInterface::r#set_layer_primary_position(
1135            self,
1136            layer_id,
1137            image_source_transformation,
1138            image_source,
1139            display_destination,
1140        )
1141    }
1142
1143    /// Sets the alpha mode of the plane.
1144    ///
1145    /// If `mode` == DISABLED, the layer is opaque and `val` is ignored.
1146    ///
1147    /// If `mode` == PREMULTIPLIED or HW_MULTIPLY and `val` is NaN, the alpha
1148    /// used when blending is determined by the per-pixel alpha channel.
1149    ///
1150    /// If `mode` == PREMULTIPLIED or HW_MULTIPLY and `val` is not NaN, the
1151    /// alpha used when blending is the product of `val` and any per-pixel
1152    /// alpha. Additionally, if `mode` == PREMULTIPLIED, then the hardware
1153    /// premultiplies the color channel with `val` before blending.
1154    ///
1155    /// The values set here are reset by subsequent calls to
1156    /// [`Coordinator.SetLayerPrimaryConfig`] and
1157    /// [`Coordinator.SetLayerColorConfig`].
1158    ///
1159    /// It is illegal to call this on a non-primary layer, to pass an
1160    /// invalid mode, or to pass a value of `val` which is not NaN or
1161    /// in the range [0, 1].
1162    pub fn r#set_layer_primary_alpha(
1163        &self,
1164        mut layer_id: &LayerId,
1165        mut mode: fidl_fuchsia_hardware_display_types::AlphaMode,
1166        mut val: f32,
1167    ) -> Result<(), fidl::Error> {
1168        CoordinatorProxyInterface::r#set_layer_primary_alpha(self, layer_id, mode, val)
1169    }
1170
1171    /// Configures the layer as a solid color fill layer.
1172    ///
1173    /// This method makes the layer a solid color fill layer. The arguments
1174    /// fully define the layer's contents. No primary layer properties (set by
1175    /// [`Coordinator.SetLayerPrimaryConfig`],
1176    /// [`Coordinator.SetLayerPrimaryPosition`], or
1177    /// [`Coordinator.SetLayerPrimaryAlpha`]) carry over into the color fill
1178    /// layer. If the layer is later made a primary layer again, via
1179    /// [`Coordinator.SetLayerPrimaryConfig`], all primary layer properties
1180    /// start out at their defaults.
1181    ///
1182    /// It is illegal to call this on an invalid layer.
1183    pub fn r#set_layer_color_config(
1184        &self,
1185        mut layer_id: &LayerId,
1186        mut color: &fidl_fuchsia_hardware_display_types::Color,
1187        mut display_destination: &fidl_fuchsia_math::RectU,
1188    ) -> Result<(), fidl::Error> {
1189        CoordinatorProxyInterface::r#set_layer_color_config(
1190            self,
1191            layer_id,
1192            color,
1193            display_destination,
1194        )
1195    }
1196
1197    /// Sets the image for the layer's draft configuration.
1198    ///
1199    /// If wait_event_id corresponds to an imported event, the driver will
1200    /// wait for ZX_EVENT_SIGNALED on the object before presenting the image.
1201    ///
1202    /// A layer's submitted image is the most recently committed image which either has
1203    /// no wait event or whose wait event has been signaled. Whenever a new image
1204    /// is committed, any older images which never got committed are dropped, and
1205    /// their signal events will be fired as soon as their wait events are
1206    /// signaled. The driver also does not have any concept like 'target vsync',
1207    /// meaning that if multiple images are committed within one vsync period, then
1208    /// only the last image will actually be displayed.
1209    ///
1210    /// By default, the driver retains a submitted image until a new image is
1211    /// submitted. However, setting a layer's ImageConfig with SetLayerPrimaryConfig
1212    /// resets the layer's submitted and waiting images, even if the new ImageConfig
1213    /// matches the old ImageConfig.
1214    ///
1215    /// An image cannot be used for multiple layers simultaneously, nor can an
1216    /// image be given back to the display coordinator while it is still in use.
1217    /// An image is considered in use when it is part of a draft configuration
1218    /// or from when its configuration is committed until it is replaced by a
1219    /// subsequent configuration that is *displayed* (not merely committed).
1220    ///
1221    /// It is illegal to call this with an invalid layer or image id, to
1222    /// call it on a color layer, or to call it with an image and layer whose
1223    /// ImageConfigs do not match. It is illegal to commit a configuration
1224    /// with an image layer that has no image (note that is is not illegal to
1225    /// validate such a configuration). It is illegal to reuse a wait event which
1226    /// another layer that has not been presented is waiting on.
1227    ///
1228    /// Each layer can track a maximum of `MAX_WAITING_IMAGES_PER_LAYER` waiting images.
1229    /// An image becomes "waiting" when it is the most recent image set to a layer that appears in
1230    /// a config that is committed via `CommitConfig()` or similar.  To avoid exceeding the maximum,
1231    /// the client can infer that the image is no longer waiting by:
1232    ///   - noting the config stamp when the config containing the layer/image is committed
1233    ///   - watching for that same (or later) config stamp to be returned by
1234    ///     `CoordinatorListener.OnVsync()`.
1235    pub fn r#set_layer_image2(
1236        &self,
1237        mut layer_id: &LayerId,
1238        mut image_id: &ImageId,
1239        mut wait_event_id: &EventId,
1240    ) -> Result<(), fidl::Error> {
1241        CoordinatorProxyInterface::r#set_layer_image2(self, layer_id, image_id, wait_event_id)
1242    }
1243
1244    /// Validates the draft configuration.
1245    ///
1246    /// Validation entails checking that the draft configuration can be used
1247    /// by the system's display hardware.
1248    ///
1249    /// Most SetX operations require verifying the draft configuration. The
1250    /// following operations do not require revalidation.
1251    /// * SetLayerImage2()
1252    pub fn r#check_config(
1253        &self,
1254    ) -> fidl::client::QueryResponseFut<
1255        fidl_fuchsia_hardware_display_types::ConfigResult,
1256        fidl::encoding::DefaultFuchsiaResourceDialect,
1257    > {
1258        CoordinatorProxyInterface::r#check_config(self)
1259    }
1260
1261    /// Discard all draft configuration changes.
1262    pub fn r#discard_config(&self) -> Result<(), fidl::Error> {
1263        CoordinatorProxyInterface::r#discard_config(self)
1264    }
1265
1266    /// Gets the stamp provided with the latest configuration the client
1267    /// committed (by calling CommitConfig()) and the display core driver
1268    /// accepted; the display configuration may not have been rendered yet
1269    /// because of pending image availability or draft layer changes.
1270    /// If no configuration was committed before, returns `INVALID_CONFIG_STAMP_VALUE`.
1271    pub fn r#get_latest_committed_config_stamp(
1272        &self,
1273    ) -> fidl::client::QueryResponseFut<ConfigStamp, fidl::encoding::DefaultFuchsiaResourceDialect>
1274    {
1275        CoordinatorProxyInterface::r#get_latest_committed_config_stamp(self)
1276    }
1277
1278    /// Commits any draft changes to the current configuration. This will
1279    /// not apply draft changes to layers which are not on any display.
1280    ///
1281    /// If the draft configuration cannot be committed, this call will silently
1282    /// fail, so the client should ensure its configuration is valid by
1283    /// calling [`Coordinator.CheckConfig`].
1284    pub fn r#commit_config(
1285        &self,
1286        mut payload: CoordinatorCommitConfigRequest,
1287    ) -> Result<(), fidl::Error> {
1288        CoordinatorProxyInterface::r#commit_config(self, payload)
1289    }
1290
1291    /// Acknowledges the receipt of one `OnVsync` message.
1292    pub fn r#acknowledge_vsync(&self, mut cookie: u64) -> Result<(), fidl::Error> {
1293        CoordinatorProxyInterface::r#acknowledge_vsync(self, cookie)
1294    }
1295
1296    /// Import a sysmem buffer collection token. `buffer_collection_id` must not
1297    /// already be in use.
1298    pub fn r#import_buffer_collection(
1299        &self,
1300        mut buffer_collection_id: &BufferCollectionId,
1301        mut buffer_collection_token: fidl::endpoints::ClientEnd<
1302            fidl_fuchsia_sysmem2::BufferCollectionTokenMarker,
1303        >,
1304    ) -> fidl::client::QueryResponseFut<
1305        CoordinatorImportBufferCollectionResult,
1306        fidl::encoding::DefaultFuchsiaResourceDialect,
1307    > {
1308        CoordinatorProxyInterface::r#import_buffer_collection(
1309            self,
1310            buffer_collection_id,
1311            buffer_collection_token,
1312        )
1313    }
1314
1315    /// Release an imported buffer collection.
1316    pub fn r#release_buffer_collection(
1317        &self,
1318        mut buffer_collection_id: &BufferCollectionId,
1319    ) -> Result<(), fidl::Error> {
1320        CoordinatorProxyInterface::r#release_buffer_collection(self, buffer_collection_id)
1321    }
1322
1323    /// Takes an imported buffer collection and sets the constraints
1324    /// on it so that it can be imported with a specific config.
1325    pub fn r#set_buffer_collection_constraints(
1326        &self,
1327        mut buffer_collection_id: &BufferCollectionId,
1328        mut buffer_usage: &fidl_fuchsia_hardware_display_types::ImageBufferUsage,
1329    ) -> fidl::client::QueryResponseFut<
1330        CoordinatorSetBufferCollectionConstraintsResult,
1331        fidl::encoding::DefaultFuchsiaResourceDialect,
1332    > {
1333        CoordinatorProxyInterface::r#set_buffer_collection_constraints(
1334            self,
1335            buffer_collection_id,
1336            buffer_usage,
1337        )
1338    }
1339
1340    /// Returns true if Capture is supported on the platform.
1341    pub fn r#is_capture_supported(
1342        &self,
1343    ) -> fidl::client::QueryResponseFut<
1344        CoordinatorIsCaptureSupportedResult,
1345        fidl::encoding::DefaultFuchsiaResourceDialect,
1346    > {
1347        CoordinatorProxyInterface::r#is_capture_supported(self)
1348    }
1349
1350    /// Starts capture. Client must provide a valid signal_event_id and
1351    /// image_id. signal_event_id must have been imported into the driver
1352    /// using ImportEvent FIDL API. Image_id is the id from ImportImageForCapture.
1353    /// The client will get notified once capture is complete via signal_event_id.
1354    /// Returns ZX_ERR_NOT_SUPPORTED if coordinator does not support capture
1355    pub fn r#start_capture(
1356        &self,
1357        mut signal_event_id: &EventId,
1358        mut image_id: &ImageId,
1359    ) -> fidl::client::QueryResponseFut<
1360        CoordinatorStartCaptureResult,
1361        fidl::encoding::DefaultFuchsiaResourceDialect,
1362    > {
1363        CoordinatorProxyInterface::r#start_capture(self, signal_event_id, image_id)
1364    }
1365
1366    /// Set the minimum value of rgb channels. Valid range [0 255] inclusive. Returns
1367    /// ZX_ERR_NOT_SUPPORTED when the display hardware does not support this feature.
1368    /// This API is meant to address backlight bleeding that may occur on some hardware
1369    /// that have a specific type of panel and hardware assembly. The evolution of this
1370    /// API is highly hardware and product dependant and therefore as products evolve, this
1371    /// API may change or support for this API may become non-existent. Therefore, this
1372    /// API should be used with caution.
1373    ///
1374    /// Unlike other calls in this API, SetMiniumRgb is applied immediately, and does not
1375    /// wait for CommitConfig(). It is, however, still stateful.
1376    pub fn r#set_minimum_rgb(
1377        &self,
1378        mut minimum_rgb: u8,
1379    ) -> fidl::client::QueryResponseFut<
1380        CoordinatorSetMinimumRgbResult,
1381        fidl::encoding::DefaultFuchsiaResourceDialect,
1382    > {
1383        CoordinatorProxyInterface::r#set_minimum_rgb(self, minimum_rgb)
1384    }
1385
1386    /// Sets the display panel power mode.
1387    ///
1388    /// This call takes effect immediately. Clients don't need to call
1389    /// [`Coordinator.CommitConfig`].
1390    ///
1391    /// Fails with ZX_ERR_NOT_FOUND if `display_id` does not belong to a display
1392    /// known by the Coordinator. This can happen if a client issues a call to
1393    /// [`Coordinator.SetDisplayPowerMode`] before it receives a notification
1394    /// that the display was removed.
1395    ///
1396    /// This method is not idempotent. Each [`Coordinator.SetDisplayPowerMode`]
1397    /// call explicitly sets the power mode on the display hardware, though the
1398    /// display hardware driver may choose to behave idempotently.
1399    ///
1400    /// Fails with ZX_ERR_NOT_SUPPORTED if the display drivers or the hardware
1401    /// don't support the given `power_mode`.
1402    pub fn r#set_display_power_mode(
1403        &self,
1404        mut display_id: &fidl_fuchsia_hardware_display_types::DisplayId,
1405        mut power_mode: fidl_fuchsia_hardware_display_types::PowerMode,
1406    ) -> fidl::client::QueryResponseFut<
1407        CoordinatorSetDisplayPowerModeResult,
1408        fidl::encoding::DefaultFuchsiaResourceDialect,
1409    > {
1410        CoordinatorProxyInterface::r#set_display_power_mode(self, display_id, power_mode)
1411    }
1412}
1413
1414impl CoordinatorProxyInterface for CoordinatorProxy {
1415    type ImportImageResponseFut = fidl::client::QueryResponseFut<
1416        CoordinatorImportImageResult,
1417        fidl::encoding::DefaultFuchsiaResourceDialect,
1418    >;
1419    fn r#import_image(
1420        &self,
1421        mut image_metadata: &fidl_fuchsia_hardware_display_types::ImageMetadata,
1422        mut buffer_collection_id: &BufferCollectionId,
1423        mut buffer_index: u32,
1424        mut image_id: &ImageId,
1425    ) -> Self::ImportImageResponseFut {
1426        fn _decode(
1427            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1428        ) -> Result<CoordinatorImportImageResult, fidl::Error> {
1429            let _response = fidl::client::decode_transaction_body::<
1430                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
1431                fidl::encoding::DefaultFuchsiaResourceDialect,
1432                0x3a8636eb9656b4f4,
1433            >(_buf?)?;
1434            Ok(_response.map(|x| x))
1435        }
1436        self.client
1437            .send_query_and_decode::<CoordinatorImportImageRequest, CoordinatorImportImageResult>(
1438                (image_metadata, buffer_collection_id, buffer_index, image_id),
1439                0x3a8636eb9656b4f4,
1440                fidl::encoding::DynamicFlags::empty(),
1441                _decode,
1442            )
1443    }
1444
1445    fn r#release_image(&self, mut image_id: &ImageId) -> Result<(), fidl::Error> {
1446        self.client.send::<CoordinatorReleaseImageRequest>(
1447            (image_id,),
1448            0x477192230517504,
1449            fidl::encoding::DynamicFlags::empty(),
1450        )
1451    }
1452
1453    fn r#import_event(&self, mut event: fidl::Event, mut id: &EventId) -> Result<(), fidl::Error> {
1454        self.client.send::<CoordinatorImportEventRequest>(
1455            (event, id),
1456            0x2864e5dc59390543,
1457            fidl::encoding::DynamicFlags::empty(),
1458        )
1459    }
1460
1461    fn r#release_event(&self, mut id: &EventId) -> Result<(), fidl::Error> {
1462        self.client.send::<CoordinatorReleaseEventRequest>(
1463            (id,),
1464            0x32508c2101606b87,
1465            fidl::encoding::DynamicFlags::empty(),
1466        )
1467    }
1468
1469    type CreateLayerResponseFut = fidl::client::QueryResponseFut<
1470        CoordinatorCreateLayerResult,
1471        fidl::encoding::DefaultFuchsiaResourceDialect,
1472    >;
1473    fn r#create_layer(&self, mut layer_id: &LayerId) -> Self::CreateLayerResponseFut {
1474        fn _decode(
1475            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1476        ) -> Result<CoordinatorCreateLayerResult, fidl::Error> {
1477            let _response = fidl::client::decode_transaction_body::<
1478                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
1479                fidl::encoding::DefaultFuchsiaResourceDialect,
1480                0x2137cfd788a3496b,
1481            >(_buf?)?;
1482            Ok(_response.map(|x| x))
1483        }
1484        self.client
1485            .send_query_and_decode::<CoordinatorCreateLayerRequest, CoordinatorCreateLayerResult>(
1486                (layer_id,),
1487                0x2137cfd788a3496b,
1488                fidl::encoding::DynamicFlags::empty(),
1489                _decode,
1490            )
1491    }
1492
1493    fn r#destroy_layer(&self, mut layer_id: &LayerId) -> Result<(), fidl::Error> {
1494        self.client.send::<CoordinatorDestroyLayerRequest>(
1495            (layer_id,),
1496            0x386e12d092bea2f8,
1497            fidl::encoding::DynamicFlags::empty(),
1498        )
1499    }
1500
1501    fn r#set_display_mode(
1502        &self,
1503        mut display_id: &fidl_fuchsia_hardware_display_types::DisplayId,
1504        mut mode: &fidl_fuchsia_hardware_display_types::Mode,
1505    ) -> Result<(), fidl::Error> {
1506        self.client.send::<CoordinatorSetDisplayModeRequest>(
1507            (display_id, mode),
1508            0xbde3c59ee9c1777,
1509            fidl::encoding::DynamicFlags::empty(),
1510        )
1511    }
1512
1513    fn r#set_display_color_conversion(
1514        &self,
1515        mut display_id: &fidl_fuchsia_hardware_display_types::DisplayId,
1516        mut preoffsets: &[f32; 3],
1517        mut coefficients: &[f32; 9],
1518        mut postoffsets: &[f32; 3],
1519    ) -> Result<(), fidl::Error> {
1520        self.client.send::<CoordinatorSetDisplayColorConversionRequest>(
1521            (display_id, preoffsets, coefficients, postoffsets),
1522            0x2f18186a987d51aa,
1523            fidl::encoding::DynamicFlags::empty(),
1524        )
1525    }
1526
1527    fn r#set_display_layers(
1528        &self,
1529        mut display_id: &fidl_fuchsia_hardware_display_types::DisplayId,
1530        mut layer_ids: &[LayerId],
1531    ) -> Result<(), fidl::Error> {
1532        self.client.send::<CoordinatorSetDisplayLayersRequest>(
1533            (display_id, layer_ids),
1534            0x190e0f6f93be1d89,
1535            fidl::encoding::DynamicFlags::empty(),
1536        )
1537    }
1538
1539    fn r#set_layer_primary_config(
1540        &self,
1541        mut layer_id: &LayerId,
1542        mut image_metadata: &fidl_fuchsia_hardware_display_types::ImageMetadata,
1543    ) -> Result<(), fidl::Error> {
1544        self.client.send::<CoordinatorSetLayerPrimaryConfigRequest>(
1545            (layer_id, image_metadata),
1546            0x68d89ebd518b45b9,
1547            fidl::encoding::DynamicFlags::empty(),
1548        )
1549    }
1550
1551    fn r#set_layer_primary_position(
1552        &self,
1553        mut layer_id: &LayerId,
1554        mut image_source_transformation: fidl_fuchsia_hardware_display_types::CoordinateTransformation,
1555        mut image_source: &fidl_fuchsia_math::RectU,
1556        mut display_destination: &fidl_fuchsia_math::RectU,
1557    ) -> Result<(), fidl::Error> {
1558        self.client.send::<CoordinatorSetLayerPrimaryPositionRequest>(
1559            (layer_id, image_source_transformation, image_source, display_destination),
1560            0x27b192b5a43851e2,
1561            fidl::encoding::DynamicFlags::empty(),
1562        )
1563    }
1564
1565    fn r#set_layer_primary_alpha(
1566        &self,
1567        mut layer_id: &LayerId,
1568        mut mode: fidl_fuchsia_hardware_display_types::AlphaMode,
1569        mut val: f32,
1570    ) -> Result<(), fidl::Error> {
1571        self.client.send::<CoordinatorSetLayerPrimaryAlphaRequest>(
1572            (layer_id, mode, val),
1573            0x104cf2b18b27296d,
1574            fidl::encoding::DynamicFlags::empty(),
1575        )
1576    }
1577
1578    fn r#set_layer_color_config(
1579        &self,
1580        mut layer_id: &LayerId,
1581        mut color: &fidl_fuchsia_hardware_display_types::Color,
1582        mut display_destination: &fidl_fuchsia_math::RectU,
1583    ) -> Result<(), fidl::Error> {
1584        self.client.send::<CoordinatorSetLayerColorConfigRequest>(
1585            (layer_id, color, display_destination),
1586            0x2fa91e9a2a01875f,
1587            fidl::encoding::DynamicFlags::empty(),
1588        )
1589    }
1590
1591    fn r#set_layer_image2(
1592        &self,
1593        mut layer_id: &LayerId,
1594        mut image_id: &ImageId,
1595        mut wait_event_id: &EventId,
1596    ) -> Result<(), fidl::Error> {
1597        self.client.send::<CoordinatorSetLayerImage2Request>(
1598            (layer_id, image_id, wait_event_id),
1599            0x53c6376dfc13a971,
1600            fidl::encoding::DynamicFlags::empty(),
1601        )
1602    }
1603
1604    type CheckConfigResponseFut = fidl::client::QueryResponseFut<
1605        fidl_fuchsia_hardware_display_types::ConfigResult,
1606        fidl::encoding::DefaultFuchsiaResourceDialect,
1607    >;
1608    fn r#check_config(&self) -> Self::CheckConfigResponseFut {
1609        fn _decode(
1610            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1611        ) -> Result<fidl_fuchsia_hardware_display_types::ConfigResult, fidl::Error> {
1612            let _response = fidl::client::decode_transaction_body::<
1613                CoordinatorCheckConfigResponse,
1614                fidl::encoding::DefaultFuchsiaResourceDialect,
1615                0x2bcfb4eb16878158,
1616            >(_buf?)?;
1617            Ok(_response.res)
1618        }
1619        self.client.send_query_and_decode::<
1620            fidl::encoding::EmptyPayload,
1621            fidl_fuchsia_hardware_display_types::ConfigResult,
1622        >(
1623            (),
1624            0x2bcfb4eb16878158,
1625            fidl::encoding::DynamicFlags::empty(),
1626            _decode,
1627        )
1628    }
1629
1630    fn r#discard_config(&self) -> Result<(), fidl::Error> {
1631        self.client.send::<fidl::encoding::EmptyPayload>(
1632            (),
1633            0x1673399e9231dedf,
1634            fidl::encoding::DynamicFlags::empty(),
1635        )
1636    }
1637
1638    type GetLatestCommittedConfigStampResponseFut =
1639        fidl::client::QueryResponseFut<ConfigStamp, fidl::encoding::DefaultFuchsiaResourceDialect>;
1640    fn r#get_latest_committed_config_stamp(
1641        &self,
1642    ) -> Self::GetLatestCommittedConfigStampResponseFut {
1643        fn _decode(
1644            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1645        ) -> Result<ConfigStamp, fidl::Error> {
1646            let _response = fidl::client::decode_transaction_body::<
1647                CoordinatorGetLatestCommittedConfigStampResponse,
1648                fidl::encoding::DefaultFuchsiaResourceDialect,
1649                0x2a441f2c81af5d66,
1650            >(_buf?)?;
1651            Ok(_response.stamp)
1652        }
1653        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, ConfigStamp>(
1654            (),
1655            0x2a441f2c81af5d66,
1656            fidl::encoding::DynamicFlags::empty(),
1657            _decode,
1658        )
1659    }
1660
1661    fn r#commit_config(
1662        &self,
1663        mut payload: CoordinatorCommitConfigRequest,
1664    ) -> Result<(), fidl::Error> {
1665        self.client.send::<CoordinatorCommitConfigRequest>(
1666            &mut payload,
1667            0x4489cbd2fcfbaeaf,
1668            fidl::encoding::DynamicFlags::empty(),
1669        )
1670    }
1671
1672    fn r#acknowledge_vsync(&self, mut cookie: u64) -> Result<(), fidl::Error> {
1673        self.client.send::<CoordinatorAcknowledgeVsyncRequest>(
1674            (cookie,),
1675            0x25e921d26107d6ef,
1676            fidl::encoding::DynamicFlags::empty(),
1677        )
1678    }
1679
1680    type ImportBufferCollectionResponseFut = fidl::client::QueryResponseFut<
1681        CoordinatorImportBufferCollectionResult,
1682        fidl::encoding::DefaultFuchsiaResourceDialect,
1683    >;
1684    fn r#import_buffer_collection(
1685        &self,
1686        mut buffer_collection_id: &BufferCollectionId,
1687        mut buffer_collection_token: fidl::endpoints::ClientEnd<
1688            fidl_fuchsia_sysmem2::BufferCollectionTokenMarker,
1689        >,
1690    ) -> Self::ImportBufferCollectionResponseFut {
1691        fn _decode(
1692            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1693        ) -> Result<CoordinatorImportBufferCollectionResult, fidl::Error> {
1694            let _response = fidl::client::decode_transaction_body::<
1695                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
1696                fidl::encoding::DefaultFuchsiaResourceDialect,
1697                0x30d06f510e7f4601,
1698            >(_buf?)?;
1699            Ok(_response.map(|x| x))
1700        }
1701        self.client.send_query_and_decode::<
1702            CoordinatorImportBufferCollectionRequest,
1703            CoordinatorImportBufferCollectionResult,
1704        >(
1705            (buffer_collection_id, buffer_collection_token,),
1706            0x30d06f510e7f4601,
1707            fidl::encoding::DynamicFlags::empty(),
1708            _decode,
1709        )
1710    }
1711
1712    fn r#release_buffer_collection(
1713        &self,
1714        mut buffer_collection_id: &BufferCollectionId,
1715    ) -> Result<(), fidl::Error> {
1716        self.client.send::<CoordinatorReleaseBufferCollectionRequest>(
1717            (buffer_collection_id,),
1718            0x1c7dd5f8b0690be0,
1719            fidl::encoding::DynamicFlags::empty(),
1720        )
1721    }
1722
1723    type SetBufferCollectionConstraintsResponseFut = fidl::client::QueryResponseFut<
1724        CoordinatorSetBufferCollectionConstraintsResult,
1725        fidl::encoding::DefaultFuchsiaResourceDialect,
1726    >;
1727    fn r#set_buffer_collection_constraints(
1728        &self,
1729        mut buffer_collection_id: &BufferCollectionId,
1730        mut buffer_usage: &fidl_fuchsia_hardware_display_types::ImageBufferUsage,
1731    ) -> Self::SetBufferCollectionConstraintsResponseFut {
1732        fn _decode(
1733            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1734        ) -> Result<CoordinatorSetBufferCollectionConstraintsResult, fidl::Error> {
1735            let _response = fidl::client::decode_transaction_body::<
1736                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
1737                fidl::encoding::DefaultFuchsiaResourceDialect,
1738                0x509a4ee9af6035df,
1739            >(_buf?)?;
1740            Ok(_response.map(|x| x))
1741        }
1742        self.client.send_query_and_decode::<
1743            CoordinatorSetBufferCollectionConstraintsRequest,
1744            CoordinatorSetBufferCollectionConstraintsResult,
1745        >(
1746            (buffer_collection_id, buffer_usage,),
1747            0x509a4ee9af6035df,
1748            fidl::encoding::DynamicFlags::empty(),
1749            _decode,
1750        )
1751    }
1752
1753    type IsCaptureSupportedResponseFut = fidl::client::QueryResponseFut<
1754        CoordinatorIsCaptureSupportedResult,
1755        fidl::encoding::DefaultFuchsiaResourceDialect,
1756    >;
1757    fn r#is_capture_supported(&self) -> Self::IsCaptureSupportedResponseFut {
1758        fn _decode(
1759            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1760        ) -> Result<CoordinatorIsCaptureSupportedResult, fidl::Error> {
1761            let _response = fidl::client::decode_transaction_body::<
1762                fidl::encoding::ResultType<CoordinatorIsCaptureSupportedResponse, i32>,
1763                fidl::encoding::DefaultFuchsiaResourceDialect,
1764                0x4ca407277277971b,
1765            >(_buf?)?;
1766            Ok(_response.map(|x| x.supported))
1767        }
1768        self.client.send_query_and_decode::<
1769            fidl::encoding::EmptyPayload,
1770            CoordinatorIsCaptureSupportedResult,
1771        >(
1772            (),
1773            0x4ca407277277971b,
1774            fidl::encoding::DynamicFlags::empty(),
1775            _decode,
1776        )
1777    }
1778
1779    type StartCaptureResponseFut = fidl::client::QueryResponseFut<
1780        CoordinatorStartCaptureResult,
1781        fidl::encoding::DefaultFuchsiaResourceDialect,
1782    >;
1783    fn r#start_capture(
1784        &self,
1785        mut signal_event_id: &EventId,
1786        mut image_id: &ImageId,
1787    ) -> Self::StartCaptureResponseFut {
1788        fn _decode(
1789            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1790        ) -> Result<CoordinatorStartCaptureResult, fidl::Error> {
1791            let _response = fidl::client::decode_transaction_body::<
1792                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
1793                fidl::encoding::DefaultFuchsiaResourceDialect,
1794                0x35cb38f19d96a8db,
1795            >(_buf?)?;
1796            Ok(_response.map(|x| x))
1797        }
1798        self.client
1799            .send_query_and_decode::<CoordinatorStartCaptureRequest, CoordinatorStartCaptureResult>(
1800                (signal_event_id, image_id),
1801                0x35cb38f19d96a8db,
1802                fidl::encoding::DynamicFlags::empty(),
1803                _decode,
1804            )
1805    }
1806
1807    type SetMinimumRgbResponseFut = fidl::client::QueryResponseFut<
1808        CoordinatorSetMinimumRgbResult,
1809        fidl::encoding::DefaultFuchsiaResourceDialect,
1810    >;
1811    fn r#set_minimum_rgb(&self, mut minimum_rgb: u8) -> Self::SetMinimumRgbResponseFut {
1812        fn _decode(
1813            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1814        ) -> Result<CoordinatorSetMinimumRgbResult, fidl::Error> {
1815            let _response = fidl::client::decode_transaction_body::<
1816                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
1817                fidl::encoding::DefaultFuchsiaResourceDialect,
1818                0x1b49251437038b0b,
1819            >(_buf?)?;
1820            Ok(_response.map(|x| x))
1821        }
1822        self.client.send_query_and_decode::<
1823            CoordinatorSetMinimumRgbRequest,
1824            CoordinatorSetMinimumRgbResult,
1825        >(
1826            (minimum_rgb,),
1827            0x1b49251437038b0b,
1828            fidl::encoding::DynamicFlags::empty(),
1829            _decode,
1830        )
1831    }
1832
1833    type SetDisplayPowerModeResponseFut = fidl::client::QueryResponseFut<
1834        CoordinatorSetDisplayPowerModeResult,
1835        fidl::encoding::DefaultFuchsiaResourceDialect,
1836    >;
1837    fn r#set_display_power_mode(
1838        &self,
1839        mut display_id: &fidl_fuchsia_hardware_display_types::DisplayId,
1840        mut power_mode: fidl_fuchsia_hardware_display_types::PowerMode,
1841    ) -> Self::SetDisplayPowerModeResponseFut {
1842        fn _decode(
1843            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1844        ) -> Result<CoordinatorSetDisplayPowerModeResult, fidl::Error> {
1845            let _response = fidl::client::decode_transaction_body::<
1846                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
1847                fidl::encoding::DefaultFuchsiaResourceDialect,
1848                0xf4672f055072c92,
1849            >(_buf?)?;
1850            Ok(_response.map(|x| x))
1851        }
1852        self.client.send_query_and_decode::<
1853            CoordinatorSetDisplayPowerModeRequest,
1854            CoordinatorSetDisplayPowerModeResult,
1855        >(
1856            (display_id, power_mode,),
1857            0xf4672f055072c92,
1858            fidl::encoding::DynamicFlags::empty(),
1859            _decode,
1860        )
1861    }
1862}
1863
1864pub struct CoordinatorEventStream {
1865    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1866}
1867
1868impl std::marker::Unpin for CoordinatorEventStream {}
1869
1870impl futures::stream::FusedStream for CoordinatorEventStream {
1871    fn is_terminated(&self) -> bool {
1872        self.event_receiver.is_terminated()
1873    }
1874}
1875
1876impl futures::Stream for CoordinatorEventStream {
1877    type Item = Result<CoordinatorEvent, fidl::Error>;
1878
1879    fn poll_next(
1880        mut self: std::pin::Pin<&mut Self>,
1881        cx: &mut std::task::Context<'_>,
1882    ) -> std::task::Poll<Option<Self::Item>> {
1883        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1884            &mut self.event_receiver,
1885            cx
1886        )?) {
1887            Some(buf) => std::task::Poll::Ready(Some(CoordinatorEvent::decode(buf))),
1888            None => std::task::Poll::Ready(None),
1889        }
1890    }
1891}
1892
1893#[derive(Debug)]
1894pub enum CoordinatorEvent {}
1895
1896impl CoordinatorEvent {
1897    /// Decodes a message buffer as a [`CoordinatorEvent`].
1898    fn decode(
1899        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1900    ) -> Result<CoordinatorEvent, fidl::Error> {
1901        let (bytes, _handles) = buf.split_mut();
1902        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1903        debug_assert_eq!(tx_header.tx_id, 0);
1904        match tx_header.ordinal {
1905            _ => Err(fidl::Error::UnknownOrdinal {
1906                ordinal: tx_header.ordinal,
1907                protocol_name: <CoordinatorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1908            }),
1909        }
1910    }
1911}
1912
1913/// A Stream of incoming requests for fuchsia.hardware.display/Coordinator.
1914pub struct CoordinatorRequestStream {
1915    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1916    is_terminated: bool,
1917}
1918
1919impl std::marker::Unpin for CoordinatorRequestStream {}
1920
1921impl futures::stream::FusedStream for CoordinatorRequestStream {
1922    fn is_terminated(&self) -> bool {
1923        self.is_terminated
1924    }
1925}
1926
1927impl fidl::endpoints::RequestStream for CoordinatorRequestStream {
1928    type Protocol = CoordinatorMarker;
1929    type ControlHandle = CoordinatorControlHandle;
1930
1931    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1932        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1933    }
1934
1935    fn control_handle(&self) -> Self::ControlHandle {
1936        CoordinatorControlHandle { inner: self.inner.clone() }
1937    }
1938
1939    fn into_inner(
1940        self,
1941    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1942    {
1943        (self.inner, self.is_terminated)
1944    }
1945
1946    fn from_inner(
1947        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1948        is_terminated: bool,
1949    ) -> Self {
1950        Self { inner, is_terminated }
1951    }
1952}
1953
1954impl futures::Stream for CoordinatorRequestStream {
1955    type Item = Result<CoordinatorRequest, fidl::Error>;
1956
1957    fn poll_next(
1958        mut self: std::pin::Pin<&mut Self>,
1959        cx: &mut std::task::Context<'_>,
1960    ) -> std::task::Poll<Option<Self::Item>> {
1961        let this = &mut *self;
1962        if this.inner.check_shutdown(cx) {
1963            this.is_terminated = true;
1964            return std::task::Poll::Ready(None);
1965        }
1966        if this.is_terminated {
1967            panic!("polled CoordinatorRequestStream after completion");
1968        }
1969        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1970            |bytes, handles| {
1971                match this.inner.channel().read_etc(cx, bytes, handles) {
1972                    std::task::Poll::Ready(Ok(())) => {}
1973                    std::task::Poll::Pending => return std::task::Poll::Pending,
1974                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1975                        this.is_terminated = true;
1976                        return std::task::Poll::Ready(None);
1977                    }
1978                    std::task::Poll::Ready(Err(e)) => {
1979                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1980                            e.into(),
1981                        ))));
1982                    }
1983                }
1984
1985                // A message has been received from the channel
1986                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1987
1988                std::task::Poll::Ready(Some(match header.ordinal {
1989                    0x3a8636eb9656b4f4 => {
1990                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1991                        let mut req = fidl::new_empty!(
1992                            CoordinatorImportImageRequest,
1993                            fidl::encoding::DefaultFuchsiaResourceDialect
1994                        );
1995                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CoordinatorImportImageRequest>(&header, _body_bytes, handles, &mut req)?;
1996                        let control_handle = CoordinatorControlHandle { inner: this.inner.clone() };
1997                        Ok(CoordinatorRequest::ImportImage {
1998                            image_metadata: req.image_metadata,
1999                            buffer_collection_id: req.buffer_collection_id,
2000                            buffer_index: req.buffer_index,
2001                            image_id: req.image_id,
2002
2003                            responder: CoordinatorImportImageResponder {
2004                                control_handle: std::mem::ManuallyDrop::new(control_handle),
2005                                tx_id: header.tx_id,
2006                            },
2007                        })
2008                    }
2009                    0x477192230517504 => {
2010                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
2011                        let mut req = fidl::new_empty!(
2012                            CoordinatorReleaseImageRequest,
2013                            fidl::encoding::DefaultFuchsiaResourceDialect
2014                        );
2015                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CoordinatorReleaseImageRequest>(&header, _body_bytes, handles, &mut req)?;
2016                        let control_handle = CoordinatorControlHandle { inner: this.inner.clone() };
2017                        Ok(CoordinatorRequest::ReleaseImage {
2018                            image_id: req.image_id,
2019
2020                            control_handle,
2021                        })
2022                    }
2023                    0x2864e5dc59390543 => {
2024                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
2025                        let mut req = fidl::new_empty!(
2026                            CoordinatorImportEventRequest,
2027                            fidl::encoding::DefaultFuchsiaResourceDialect
2028                        );
2029                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CoordinatorImportEventRequest>(&header, _body_bytes, handles, &mut req)?;
2030                        let control_handle = CoordinatorControlHandle { inner: this.inner.clone() };
2031                        Ok(CoordinatorRequest::ImportEvent {
2032                            event: req.event,
2033                            id: req.id,
2034
2035                            control_handle,
2036                        })
2037                    }
2038                    0x32508c2101606b87 => {
2039                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
2040                        let mut req = fidl::new_empty!(
2041                            CoordinatorReleaseEventRequest,
2042                            fidl::encoding::DefaultFuchsiaResourceDialect
2043                        );
2044                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CoordinatorReleaseEventRequest>(&header, _body_bytes, handles, &mut req)?;
2045                        let control_handle = CoordinatorControlHandle { inner: this.inner.clone() };
2046                        Ok(CoordinatorRequest::ReleaseEvent { id: req.id, control_handle })
2047                    }
2048                    0x2137cfd788a3496b => {
2049                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2050                        let mut req = fidl::new_empty!(
2051                            CoordinatorCreateLayerRequest,
2052                            fidl::encoding::DefaultFuchsiaResourceDialect
2053                        );
2054                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CoordinatorCreateLayerRequest>(&header, _body_bytes, handles, &mut req)?;
2055                        let control_handle = CoordinatorControlHandle { inner: this.inner.clone() };
2056                        Ok(CoordinatorRequest::CreateLayer {
2057                            layer_id: req.layer_id,
2058
2059                            responder: CoordinatorCreateLayerResponder {
2060                                control_handle: std::mem::ManuallyDrop::new(control_handle),
2061                                tx_id: header.tx_id,
2062                            },
2063                        })
2064                    }
2065                    0x386e12d092bea2f8 => {
2066                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
2067                        let mut req = fidl::new_empty!(
2068                            CoordinatorDestroyLayerRequest,
2069                            fidl::encoding::DefaultFuchsiaResourceDialect
2070                        );
2071                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CoordinatorDestroyLayerRequest>(&header, _body_bytes, handles, &mut req)?;
2072                        let control_handle = CoordinatorControlHandle { inner: this.inner.clone() };
2073                        Ok(CoordinatorRequest::DestroyLayer {
2074                            layer_id: req.layer_id,
2075
2076                            control_handle,
2077                        })
2078                    }
2079                    0xbde3c59ee9c1777 => {
2080                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
2081                        let mut req = fidl::new_empty!(
2082                            CoordinatorSetDisplayModeRequest,
2083                            fidl::encoding::DefaultFuchsiaResourceDialect
2084                        );
2085                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CoordinatorSetDisplayModeRequest>(&header, _body_bytes, handles, &mut req)?;
2086                        let control_handle = CoordinatorControlHandle { inner: this.inner.clone() };
2087                        Ok(CoordinatorRequest::SetDisplayMode {
2088                            display_id: req.display_id,
2089                            mode: req.mode,
2090
2091                            control_handle,
2092                        })
2093                    }
2094                    0x2f18186a987d51aa => {
2095                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
2096                        let mut req = fidl::new_empty!(
2097                            CoordinatorSetDisplayColorConversionRequest,
2098                            fidl::encoding::DefaultFuchsiaResourceDialect
2099                        );
2100                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CoordinatorSetDisplayColorConversionRequest>(&header, _body_bytes, handles, &mut req)?;
2101                        let control_handle = CoordinatorControlHandle { inner: this.inner.clone() };
2102                        Ok(CoordinatorRequest::SetDisplayColorConversion {
2103                            display_id: req.display_id,
2104                            preoffsets: req.preoffsets,
2105                            coefficients: req.coefficients,
2106                            postoffsets: req.postoffsets,
2107
2108                            control_handle,
2109                        })
2110                    }
2111                    0x190e0f6f93be1d89 => {
2112                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
2113                        let mut req = fidl::new_empty!(
2114                            CoordinatorSetDisplayLayersRequest,
2115                            fidl::encoding::DefaultFuchsiaResourceDialect
2116                        );
2117                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CoordinatorSetDisplayLayersRequest>(&header, _body_bytes, handles, &mut req)?;
2118                        let control_handle = CoordinatorControlHandle { inner: this.inner.clone() };
2119                        Ok(CoordinatorRequest::SetDisplayLayers {
2120                            display_id: req.display_id,
2121                            layer_ids: req.layer_ids,
2122
2123                            control_handle,
2124                        })
2125                    }
2126                    0x68d89ebd518b45b9 => {
2127                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
2128                        let mut req = fidl::new_empty!(
2129                            CoordinatorSetLayerPrimaryConfigRequest,
2130                            fidl::encoding::DefaultFuchsiaResourceDialect
2131                        );
2132                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CoordinatorSetLayerPrimaryConfigRequest>(&header, _body_bytes, handles, &mut req)?;
2133                        let control_handle = CoordinatorControlHandle { inner: this.inner.clone() };
2134                        Ok(CoordinatorRequest::SetLayerPrimaryConfig {
2135                            layer_id: req.layer_id,
2136                            image_metadata: req.image_metadata,
2137
2138                            control_handle,
2139                        })
2140                    }
2141                    0x27b192b5a43851e2 => {
2142                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
2143                        let mut req = fidl::new_empty!(
2144                            CoordinatorSetLayerPrimaryPositionRequest,
2145                            fidl::encoding::DefaultFuchsiaResourceDialect
2146                        );
2147                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CoordinatorSetLayerPrimaryPositionRequest>(&header, _body_bytes, handles, &mut req)?;
2148                        let control_handle = CoordinatorControlHandle { inner: this.inner.clone() };
2149                        Ok(CoordinatorRequest::SetLayerPrimaryPosition {
2150                            layer_id: req.layer_id,
2151                            image_source_transformation: req.image_source_transformation,
2152                            image_source: req.image_source,
2153                            display_destination: req.display_destination,
2154
2155                            control_handle,
2156                        })
2157                    }
2158                    0x104cf2b18b27296d => {
2159                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
2160                        let mut req = fidl::new_empty!(
2161                            CoordinatorSetLayerPrimaryAlphaRequest,
2162                            fidl::encoding::DefaultFuchsiaResourceDialect
2163                        );
2164                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CoordinatorSetLayerPrimaryAlphaRequest>(&header, _body_bytes, handles, &mut req)?;
2165                        let control_handle = CoordinatorControlHandle { inner: this.inner.clone() };
2166                        Ok(CoordinatorRequest::SetLayerPrimaryAlpha {
2167                            layer_id: req.layer_id,
2168                            mode: req.mode,
2169                            val: req.val,
2170
2171                            control_handle,
2172                        })
2173                    }
2174                    0x2fa91e9a2a01875f => {
2175                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
2176                        let mut req = fidl::new_empty!(
2177                            CoordinatorSetLayerColorConfigRequest,
2178                            fidl::encoding::DefaultFuchsiaResourceDialect
2179                        );
2180                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CoordinatorSetLayerColorConfigRequest>(&header, _body_bytes, handles, &mut req)?;
2181                        let control_handle = CoordinatorControlHandle { inner: this.inner.clone() };
2182                        Ok(CoordinatorRequest::SetLayerColorConfig {
2183                            layer_id: req.layer_id,
2184                            color: req.color,
2185                            display_destination: req.display_destination,
2186
2187                            control_handle,
2188                        })
2189                    }
2190                    0x53c6376dfc13a971 => {
2191                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
2192                        let mut req = fidl::new_empty!(
2193                            CoordinatorSetLayerImage2Request,
2194                            fidl::encoding::DefaultFuchsiaResourceDialect
2195                        );
2196                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CoordinatorSetLayerImage2Request>(&header, _body_bytes, handles, &mut req)?;
2197                        let control_handle = CoordinatorControlHandle { inner: this.inner.clone() };
2198                        Ok(CoordinatorRequest::SetLayerImage2 {
2199                            layer_id: req.layer_id,
2200                            image_id: req.image_id,
2201                            wait_event_id: req.wait_event_id,
2202
2203                            control_handle,
2204                        })
2205                    }
2206                    0x2bcfb4eb16878158 => {
2207                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2208                        let mut req = fidl::new_empty!(
2209                            fidl::encoding::EmptyPayload,
2210                            fidl::encoding::DefaultFuchsiaResourceDialect
2211                        );
2212                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
2213                        let control_handle = CoordinatorControlHandle { inner: this.inner.clone() };
2214                        Ok(CoordinatorRequest::CheckConfig {
2215                            responder: CoordinatorCheckConfigResponder {
2216                                control_handle: std::mem::ManuallyDrop::new(control_handle),
2217                                tx_id: header.tx_id,
2218                            },
2219                        })
2220                    }
2221                    0x1673399e9231dedf => {
2222                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
2223                        let mut req = fidl::new_empty!(
2224                            fidl::encoding::EmptyPayload,
2225                            fidl::encoding::DefaultFuchsiaResourceDialect
2226                        );
2227                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
2228                        let control_handle = CoordinatorControlHandle { inner: this.inner.clone() };
2229                        Ok(CoordinatorRequest::DiscardConfig { control_handle })
2230                    }
2231                    0x2a441f2c81af5d66 => {
2232                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2233                        let mut req = fidl::new_empty!(
2234                            fidl::encoding::EmptyPayload,
2235                            fidl::encoding::DefaultFuchsiaResourceDialect
2236                        );
2237                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
2238                        let control_handle = CoordinatorControlHandle { inner: this.inner.clone() };
2239                        Ok(CoordinatorRequest::GetLatestCommittedConfigStamp {
2240                            responder: CoordinatorGetLatestCommittedConfigStampResponder {
2241                                control_handle: std::mem::ManuallyDrop::new(control_handle),
2242                                tx_id: header.tx_id,
2243                            },
2244                        })
2245                    }
2246                    0x4489cbd2fcfbaeaf => {
2247                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
2248                        let mut req = fidl::new_empty!(
2249                            CoordinatorCommitConfigRequest,
2250                            fidl::encoding::DefaultFuchsiaResourceDialect
2251                        );
2252                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CoordinatorCommitConfigRequest>(&header, _body_bytes, handles, &mut req)?;
2253                        let control_handle = CoordinatorControlHandle { inner: this.inner.clone() };
2254                        Ok(CoordinatorRequest::CommitConfig { payload: req, control_handle })
2255                    }
2256                    0x25e921d26107d6ef => {
2257                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
2258                        let mut req = fidl::new_empty!(
2259                            CoordinatorAcknowledgeVsyncRequest,
2260                            fidl::encoding::DefaultFuchsiaResourceDialect
2261                        );
2262                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CoordinatorAcknowledgeVsyncRequest>(&header, _body_bytes, handles, &mut req)?;
2263                        let control_handle = CoordinatorControlHandle { inner: this.inner.clone() };
2264                        Ok(CoordinatorRequest::AcknowledgeVsync {
2265                            cookie: req.cookie,
2266
2267                            control_handle,
2268                        })
2269                    }
2270                    0x30d06f510e7f4601 => {
2271                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2272                        let mut req = fidl::new_empty!(
2273                            CoordinatorImportBufferCollectionRequest,
2274                            fidl::encoding::DefaultFuchsiaResourceDialect
2275                        );
2276                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CoordinatorImportBufferCollectionRequest>(&header, _body_bytes, handles, &mut req)?;
2277                        let control_handle = CoordinatorControlHandle { inner: this.inner.clone() };
2278                        Ok(CoordinatorRequest::ImportBufferCollection {
2279                            buffer_collection_id: req.buffer_collection_id,
2280                            buffer_collection_token: req.buffer_collection_token,
2281
2282                            responder: CoordinatorImportBufferCollectionResponder {
2283                                control_handle: std::mem::ManuallyDrop::new(control_handle),
2284                                tx_id: header.tx_id,
2285                            },
2286                        })
2287                    }
2288                    0x1c7dd5f8b0690be0 => {
2289                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
2290                        let mut req = fidl::new_empty!(
2291                            CoordinatorReleaseBufferCollectionRequest,
2292                            fidl::encoding::DefaultFuchsiaResourceDialect
2293                        );
2294                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CoordinatorReleaseBufferCollectionRequest>(&header, _body_bytes, handles, &mut req)?;
2295                        let control_handle = CoordinatorControlHandle { inner: this.inner.clone() };
2296                        Ok(CoordinatorRequest::ReleaseBufferCollection {
2297                            buffer_collection_id: req.buffer_collection_id,
2298
2299                            control_handle,
2300                        })
2301                    }
2302                    0x509a4ee9af6035df => {
2303                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2304                        let mut req = fidl::new_empty!(
2305                            CoordinatorSetBufferCollectionConstraintsRequest,
2306                            fidl::encoding::DefaultFuchsiaResourceDialect
2307                        );
2308                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CoordinatorSetBufferCollectionConstraintsRequest>(&header, _body_bytes, handles, &mut req)?;
2309                        let control_handle = CoordinatorControlHandle { inner: this.inner.clone() };
2310                        Ok(CoordinatorRequest::SetBufferCollectionConstraints {
2311                            buffer_collection_id: req.buffer_collection_id,
2312                            buffer_usage: req.buffer_usage,
2313
2314                            responder: CoordinatorSetBufferCollectionConstraintsResponder {
2315                                control_handle: std::mem::ManuallyDrop::new(control_handle),
2316                                tx_id: header.tx_id,
2317                            },
2318                        })
2319                    }
2320                    0x4ca407277277971b => {
2321                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2322                        let mut req = fidl::new_empty!(
2323                            fidl::encoding::EmptyPayload,
2324                            fidl::encoding::DefaultFuchsiaResourceDialect
2325                        );
2326                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
2327                        let control_handle = CoordinatorControlHandle { inner: this.inner.clone() };
2328                        Ok(CoordinatorRequest::IsCaptureSupported {
2329                            responder: CoordinatorIsCaptureSupportedResponder {
2330                                control_handle: std::mem::ManuallyDrop::new(control_handle),
2331                                tx_id: header.tx_id,
2332                            },
2333                        })
2334                    }
2335                    0x35cb38f19d96a8db => {
2336                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2337                        let mut req = fidl::new_empty!(
2338                            CoordinatorStartCaptureRequest,
2339                            fidl::encoding::DefaultFuchsiaResourceDialect
2340                        );
2341                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CoordinatorStartCaptureRequest>(&header, _body_bytes, handles, &mut req)?;
2342                        let control_handle = CoordinatorControlHandle { inner: this.inner.clone() };
2343                        Ok(CoordinatorRequest::StartCapture {
2344                            signal_event_id: req.signal_event_id,
2345                            image_id: req.image_id,
2346
2347                            responder: CoordinatorStartCaptureResponder {
2348                                control_handle: std::mem::ManuallyDrop::new(control_handle),
2349                                tx_id: header.tx_id,
2350                            },
2351                        })
2352                    }
2353                    0x1b49251437038b0b => {
2354                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2355                        let mut req = fidl::new_empty!(
2356                            CoordinatorSetMinimumRgbRequest,
2357                            fidl::encoding::DefaultFuchsiaResourceDialect
2358                        );
2359                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CoordinatorSetMinimumRgbRequest>(&header, _body_bytes, handles, &mut req)?;
2360                        let control_handle = CoordinatorControlHandle { inner: this.inner.clone() };
2361                        Ok(CoordinatorRequest::SetMinimumRgb {
2362                            minimum_rgb: req.minimum_rgb,
2363
2364                            responder: CoordinatorSetMinimumRgbResponder {
2365                                control_handle: std::mem::ManuallyDrop::new(control_handle),
2366                                tx_id: header.tx_id,
2367                            },
2368                        })
2369                    }
2370                    0xf4672f055072c92 => {
2371                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2372                        let mut req = fidl::new_empty!(
2373                            CoordinatorSetDisplayPowerModeRequest,
2374                            fidl::encoding::DefaultFuchsiaResourceDialect
2375                        );
2376                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CoordinatorSetDisplayPowerModeRequest>(&header, _body_bytes, handles, &mut req)?;
2377                        let control_handle = CoordinatorControlHandle { inner: this.inner.clone() };
2378                        Ok(CoordinatorRequest::SetDisplayPowerMode {
2379                            display_id: req.display_id,
2380                            power_mode: req.power_mode,
2381
2382                            responder: CoordinatorSetDisplayPowerModeResponder {
2383                                control_handle: std::mem::ManuallyDrop::new(control_handle),
2384                                tx_id: header.tx_id,
2385                            },
2386                        })
2387                    }
2388                    _ => Err(fidl::Error::UnknownOrdinal {
2389                        ordinal: header.ordinal,
2390                        protocol_name:
2391                            <CoordinatorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2392                    }),
2393                }))
2394            },
2395        )
2396    }
2397}
2398
2399/// Interface for accessing the display hardware.
2400///
2401/// A display configuration can be separated into two parts: the layer layout and
2402/// the layer contents. The layout includes all parts of a configuration other
2403/// than the image handles. The submitted configuration is composed of the most
2404/// recently committed layout and a ready image from each layer - see
2405/// SetLayerImage2 for details on how the ready image is defined. Note the
2406/// requirement that each layer has a ready image. Whenever a new submitted
2407/// configuration is available, it is immediately given to the hardware. This
2408/// allows the layout and each layer's contents to advance independently when
2409/// possible.
2410///
2411/// Performing illegal actions on the interface will result in the interface
2412/// being closed.  The channel closure epitaph will return one of 4 values:
2413/// - ZX_ERR_INVALID_ARGS: for trivially-verifiable client errors, such as providing an ID for a
2414///       nonexistent image/layer/event, or a non-monotonically-increasing config stamp to
2415///       ApplyConfig, etc.
2416/// - ZX_ERR_BAD_STATE: indicates that the client has violated other API invariants, such as reusing
2417///       an event that hasn't been signaled yet.
2418/// - ZX_ERR_NO_MEMORY: memory could not be allocated to satisfy the requested operation.
2419/// - ZX_ERR_INTERNAL: catch-all used for any error that is not listed above.
2420#[derive(Debug)]
2421pub enum CoordinatorRequest {
2422    /// Imports a Buffer-Collection backed image.
2423    ///
2424    /// Returns `ZX_ERR_NOT_SUPPORTED` if the display hardware doesn't support
2425    /// `image_metadata`.
2426    /// Returns `ZX_ERR_ALREADY_EXISTS` if `image_id` was used in a successful
2427    /// `ImportImage()` without a corresponding `ReleaseImage()`.
2428    /// Returns `ZX_ERR_NO_MEMORY` if memory cannot be allocated for managing the image
2429    /// Additionally, this method delegates internally to `fuchsia.hardware.display.engine/Engine`,
2430    /// and will forward errors received from `ImportImage()` and `ImportImageForCapture()`.
2431    ///
2432    /// The implementation must ignore any Sysmem information around weak VMO
2433    /// handles. Display stack consumers are responsible for ensuring that weak
2434    /// VMOs are closed in a timely manner, which may involve calling
2435    /// [`Coordinator.ReleaseImage`] and [`Coordinator.CommitConfig`].
2436    ImportImage {
2437        image_metadata: fidl_fuchsia_hardware_display_types::ImageMetadata,
2438        buffer_collection_id: BufferCollectionId,
2439        buffer_index: u32,
2440        image_id: ImageId,
2441        responder: CoordinatorImportImageResponder,
2442    },
2443    /// Releases an imported image.
2444    ///
2445    /// `image_id` must be already imported by
2446    /// [`fuchsia.hardware.display/Coordinator.ImportImage`].
2447    ///
2448    /// The image must not be the capture target of an ongoing capture specified
2449    /// in [`fuchsia.hardware.display/Coordinator.StartCapture`].
2450    ///
2451    /// When an image is released, it is immediately removed from any draft
2452    /// configurations, and any fences associated with the image are dropped.
2453    /// The resources associated with the image will be released as soon as the
2454    /// image is no longer in use.
2455    ReleaseImage { image_id: ImageId, control_handle: CoordinatorControlHandle },
2456    /// Imports an event into the driver and associates it with the given id.
2457    ///
2458    /// It is illegal for id to be equal to INVALID_DISP_ID, and it is undefined to
2459    /// import one event with two different ids or to import two different events
2460    /// with the same id (note that ids map well to koids).
2461    ///
2462    /// If a client is reusing events, they must clear the signal
2463    /// before referencing the id again.
2464    ImportEvent { event: fidl::Event, id: EventId, control_handle: CoordinatorControlHandle },
2465    /// Releases the event imported with the given id.
2466    ///
2467    /// If any images are currently using the given event, the event
2468    /// will still be waited up or signaled as appropriate before its
2469    /// resources are released. It is an error to reuse an ID while the
2470    /// submitted config has references to it.
2471    ReleaseEvent { id: EventId, control_handle: CoordinatorControlHandle },
2472    /// Creates a new layer.
2473    ///
2474    /// Layers are not associated with a particular display, but they can only be
2475    /// shown on at most one display at any given time.  A layer is considered in
2476    /// use from the time it is passed to SetDisplayLayers until a subsequent
2477    /// configuration is committed which does not include the layer or until its
2478    /// display is removed.
2479    ///
2480    /// A new layer is neither a primary layer nor a solid color fill layer
2481    /// until [`Coordinator.SetLayerPrimaryConfig`] or
2482    /// [`Coordinator.SetLayerColorConfig`] is called on it.
2483    ///
2484    /// * `layer_id` must be a valid ID (not equal to `INVALID_DISP_ID`).
2485    /// * `layer_id` must not be in use (not equal to the ID of any currently
2486    ///   existing layer in the same `Coordinator` session).
2487    CreateLayer { layer_id: LayerId, responder: CoordinatorCreateLayerResponder },
2488    /// Destroys the given layer.
2489    ///
2490    /// It is illegal to destroy a layer which does not exist or which is in use.
2491    DestroyLayer { layer_id: LayerId, control_handle: CoordinatorControlHandle },
2492    /// Sets the mode for a display.
2493    SetDisplayMode {
2494        display_id: fidl_fuchsia_hardware_display_types::DisplayId,
2495        mode: fidl_fuchsia_hardware_display_types::Mode,
2496        control_handle: CoordinatorControlHandle,
2497    },
2498    /// Set the color conversion applied to the display. The conversion is applied to
2499    /// to each pixel according to the formula:
2500    ///
2501    /// (coefficients * (pixel + preoffsets)) + postoffsets
2502    ///
2503    /// where pixel is a column vector consisting of the pixel's 3 components.
2504    ///
2505    /// `coefficients` is passed in row-major order. If the first entry of an array is NaN, the
2506    /// array is treated as the identity element for the relevant operation.
2507    /// Hardware that support color correction generally accept a limited range of coefficient
2508    /// values. Coefficients in the range of [-2, 2] inclusive will be accepted by most
2509    /// hardware. The hardware driver will clamp values that are outside its acceptable range.
2510    ///
2511    /// `preoffsets`, `postoffsets`: Clients are encourged to produce color correction values that
2512    /// do not depend on pre and post offsets since some hardware do not have support for that.
2513    /// For cases where pre and post offset values need to be used, the range should be limited to
2514    /// (-1, 1) exclusive as confirmed by CheckConfig API. Values outside this range will be
2515    /// rejected.
2516    ///
2517    /// Clients are encouraged to use the CheckConfig API to confirm support for correction and to
2518    /// validate their color correction input values.
2519    ///
2520    /// This a stateful call. Once color conversion values have been succesfully applied via a call
2521    /// to CommitConfig() they will remain in place until changed and another CommitConfig() call is
2522    /// successful. If SetDisplayColorConversion() is called and then the config is discarded, then
2523    /// the last successfully committed state is restored.
2524    SetDisplayColorConversion {
2525        display_id: fidl_fuchsia_hardware_display_types::DisplayId,
2526        preoffsets: [f32; 3],
2527        coefficients: [f32; 9],
2528        postoffsets: [f32; 3],
2529        control_handle: CoordinatorControlHandle,
2530    },
2531    /// Assigns a list of layers to be composited on a display.
2532    SetDisplayLayers {
2533        display_id: fidl_fuchsia_hardware_display_types::DisplayId,
2534        layer_ids: Vec<LayerId>,
2535        control_handle: CoordinatorControlHandle,
2536    },
2537    /// Configures the layer as a primary layer with no image and the default
2538    /// config.
2539    ///
2540    /// This method makes the layer a primary layer. Each call resets all
2541    /// primary layer properties to their defaults, even if the layer was
2542    /// already a primary layer, and even if `image_metadata` matches the
2543    /// layer's current metadata. The defaults are:
2544    /// * position (see [`Coordinator.SetLayerPrimaryPosition`]): no
2545    ///   `image_source` cropping, the identity transform, positioned in the
2546    ///   top-left corner of the composited output, and no scaling. In other
2547    ///   words, `image_source` and `display_destination` both cover the image
2548    ///   specified by `image_metadata`.
2549    /// * alpha (see [`Coordinator.SetLayerPrimaryAlpha`]): the `DISABLE` alpha
2550    ///   mode. The layer is opaque.
2551    ///
2552    /// Clients that need non-default values must call
2553    /// [`Coordinator.SetLayerPrimaryPosition`] and/or
2554    /// [`Coordinator.SetLayerPrimaryAlpha`] after each call to this method.
2555    ///
2556    /// See the documentation on [`Coordinator.SetLayerImage2`] for details on
2557    /// how this method affects the layer's contents.
2558    ///
2559    /// It is illegal to pass an invalid layer id.
2560    SetLayerPrimaryConfig {
2561        layer_id: LayerId,
2562        image_metadata: fidl_fuchsia_hardware_display_types::ImageMetadata,
2563        control_handle: CoordinatorControlHandle,
2564    },
2565    /// Sets the layer transform, scaling, and positioning.
2566    ///
2567    /// The values set here are reset by subsequent calls to
2568    /// [`Coordinator.SetLayerPrimaryConfig`] and
2569    /// [`Coordinator.SetLayerColorConfig`].
2570    ///
2571    /// CheckConfig() will return INVALID_CONFIG if any of the configuration
2572    /// validity conditions specified here is violated.
2573    ///
2574    /// Calling this on a non-primary layer or passing an invalid transform is
2575    /// illegal.
2576    SetLayerPrimaryPosition {
2577        layer_id: LayerId,
2578        image_source_transformation: fidl_fuchsia_hardware_display_types::CoordinateTransformation,
2579        image_source: fidl_fuchsia_math::RectU,
2580        display_destination: fidl_fuchsia_math::RectU,
2581        control_handle: CoordinatorControlHandle,
2582    },
2583    /// Sets the alpha mode of the plane.
2584    ///
2585    /// If `mode` == DISABLED, the layer is opaque and `val` is ignored.
2586    ///
2587    /// If `mode` == PREMULTIPLIED or HW_MULTIPLY and `val` is NaN, the alpha
2588    /// used when blending is determined by the per-pixel alpha channel.
2589    ///
2590    /// If `mode` == PREMULTIPLIED or HW_MULTIPLY and `val` is not NaN, the
2591    /// alpha used when blending is the product of `val` and any per-pixel
2592    /// alpha. Additionally, if `mode` == PREMULTIPLIED, then the hardware
2593    /// premultiplies the color channel with `val` before blending.
2594    ///
2595    /// The values set here are reset by subsequent calls to
2596    /// [`Coordinator.SetLayerPrimaryConfig`] and
2597    /// [`Coordinator.SetLayerColorConfig`].
2598    ///
2599    /// It is illegal to call this on a non-primary layer, to pass an
2600    /// invalid mode, or to pass a value of `val` which is not NaN or
2601    /// in the range [0, 1].
2602    SetLayerPrimaryAlpha {
2603        layer_id: LayerId,
2604        mode: fidl_fuchsia_hardware_display_types::AlphaMode,
2605        val: f32,
2606        control_handle: CoordinatorControlHandle,
2607    },
2608    /// Configures the layer as a solid color fill layer.
2609    ///
2610    /// This method makes the layer a solid color fill layer. The arguments
2611    /// fully define the layer's contents. No primary layer properties (set by
2612    /// [`Coordinator.SetLayerPrimaryConfig`],
2613    /// [`Coordinator.SetLayerPrimaryPosition`], or
2614    /// [`Coordinator.SetLayerPrimaryAlpha`]) carry over into the color fill
2615    /// layer. If the layer is later made a primary layer again, via
2616    /// [`Coordinator.SetLayerPrimaryConfig`], all primary layer properties
2617    /// start out at their defaults.
2618    ///
2619    /// It is illegal to call this on an invalid layer.
2620    SetLayerColorConfig {
2621        layer_id: LayerId,
2622        color: fidl_fuchsia_hardware_display_types::Color,
2623        display_destination: fidl_fuchsia_math::RectU,
2624        control_handle: CoordinatorControlHandle,
2625    },
2626    /// Sets the image for the layer's draft configuration.
2627    ///
2628    /// If wait_event_id corresponds to an imported event, the driver will
2629    /// wait for ZX_EVENT_SIGNALED on the object before presenting the image.
2630    ///
2631    /// A layer's submitted image is the most recently committed image which either has
2632    /// no wait event or whose wait event has been signaled. Whenever a new image
2633    /// is committed, any older images which never got committed are dropped, and
2634    /// their signal events will be fired as soon as their wait events are
2635    /// signaled. The driver also does not have any concept like 'target vsync',
2636    /// meaning that if multiple images are committed within one vsync period, then
2637    /// only the last image will actually be displayed.
2638    ///
2639    /// By default, the driver retains a submitted image until a new image is
2640    /// submitted. However, setting a layer's ImageConfig with SetLayerPrimaryConfig
2641    /// resets the layer's submitted and waiting images, even if the new ImageConfig
2642    /// matches the old ImageConfig.
2643    ///
2644    /// An image cannot be used for multiple layers simultaneously, nor can an
2645    /// image be given back to the display coordinator while it is still in use.
2646    /// An image is considered in use when it is part of a draft configuration
2647    /// or from when its configuration is committed until it is replaced by a
2648    /// subsequent configuration that is *displayed* (not merely committed).
2649    ///
2650    /// It is illegal to call this with an invalid layer or image id, to
2651    /// call it on a color layer, or to call it with an image and layer whose
2652    /// ImageConfigs do not match. It is illegal to commit a configuration
2653    /// with an image layer that has no image (note that is is not illegal to
2654    /// validate such a configuration). It is illegal to reuse a wait event which
2655    /// another layer that has not been presented is waiting on.
2656    ///
2657    /// Each layer can track a maximum of `MAX_WAITING_IMAGES_PER_LAYER` waiting images.
2658    /// An image becomes "waiting" when it is the most recent image set to a layer that appears in
2659    /// a config that is committed via `CommitConfig()` or similar.  To avoid exceeding the maximum,
2660    /// the client can infer that the image is no longer waiting by:
2661    ///   - noting the config stamp when the config containing the layer/image is committed
2662    ///   - watching for that same (or later) config stamp to be returned by
2663    ///     `CoordinatorListener.OnVsync()`.
2664    SetLayerImage2 {
2665        layer_id: LayerId,
2666        image_id: ImageId,
2667        wait_event_id: EventId,
2668        control_handle: CoordinatorControlHandle,
2669    },
2670    /// Validates the draft configuration.
2671    ///
2672    /// Validation entails checking that the draft configuration can be used
2673    /// by the system's display hardware.
2674    ///
2675    /// Most SetX operations require verifying the draft configuration. The
2676    /// following operations do not require revalidation.
2677    /// * SetLayerImage2()
2678    CheckConfig { responder: CoordinatorCheckConfigResponder },
2679    /// Discard all draft configuration changes.
2680    DiscardConfig { control_handle: CoordinatorControlHandle },
2681    /// Gets the stamp provided with the latest configuration the client
2682    /// committed (by calling CommitConfig()) and the display core driver
2683    /// accepted; the display configuration may not have been rendered yet
2684    /// because of pending image availability or draft layer changes.
2685    /// If no configuration was committed before, returns `INVALID_CONFIG_STAMP_VALUE`.
2686    GetLatestCommittedConfigStamp { responder: CoordinatorGetLatestCommittedConfigStampResponder },
2687    /// Commits any draft changes to the current configuration. This will
2688    /// not apply draft changes to layers which are not on any display.
2689    ///
2690    /// If the draft configuration cannot be committed, this call will silently
2691    /// fail, so the client should ensure its configuration is valid by
2692    /// calling [`Coordinator.CheckConfig`].
2693    CommitConfig {
2694        payload: CoordinatorCommitConfigRequest,
2695        control_handle: CoordinatorControlHandle,
2696    },
2697    /// Acknowledges the receipt of one `OnVsync` message.
2698    AcknowledgeVsync { cookie: u64, control_handle: CoordinatorControlHandle },
2699    /// Import a sysmem buffer collection token. `buffer_collection_id` must not
2700    /// already be in use.
2701    ImportBufferCollection {
2702        buffer_collection_id: BufferCollectionId,
2703        buffer_collection_token:
2704            fidl::endpoints::ClientEnd<fidl_fuchsia_sysmem2::BufferCollectionTokenMarker>,
2705        responder: CoordinatorImportBufferCollectionResponder,
2706    },
2707    /// Release an imported buffer collection.
2708    ReleaseBufferCollection {
2709        buffer_collection_id: BufferCollectionId,
2710        control_handle: CoordinatorControlHandle,
2711    },
2712    /// Takes an imported buffer collection and sets the constraints
2713    /// on it so that it can be imported with a specific config.
2714    SetBufferCollectionConstraints {
2715        buffer_collection_id: BufferCollectionId,
2716        buffer_usage: fidl_fuchsia_hardware_display_types::ImageBufferUsage,
2717        responder: CoordinatorSetBufferCollectionConstraintsResponder,
2718    },
2719    /// Returns true if Capture is supported on the platform.
2720    IsCaptureSupported { responder: CoordinatorIsCaptureSupportedResponder },
2721    /// Starts capture. Client must provide a valid signal_event_id and
2722    /// image_id. signal_event_id must have been imported into the driver
2723    /// using ImportEvent FIDL API. Image_id is the id from ImportImageForCapture.
2724    /// The client will get notified once capture is complete via signal_event_id.
2725    /// Returns ZX_ERR_NOT_SUPPORTED if coordinator does not support capture
2726    StartCapture {
2727        signal_event_id: EventId,
2728        image_id: ImageId,
2729        responder: CoordinatorStartCaptureResponder,
2730    },
2731    /// Set the minimum value of rgb channels. Valid range [0 255] inclusive. Returns
2732    /// ZX_ERR_NOT_SUPPORTED when the display hardware does not support this feature.
2733    /// This API is meant to address backlight bleeding that may occur on some hardware
2734    /// that have a specific type of panel and hardware assembly. The evolution of this
2735    /// API is highly hardware and product dependant and therefore as products evolve, this
2736    /// API may change or support for this API may become non-existent. Therefore, this
2737    /// API should be used with caution.
2738    ///
2739    /// Unlike other calls in this API, SetMiniumRgb is applied immediately, and does not
2740    /// wait for CommitConfig(). It is, however, still stateful.
2741    SetMinimumRgb { minimum_rgb: u8, responder: CoordinatorSetMinimumRgbResponder },
2742    /// Sets the display panel power mode.
2743    ///
2744    /// This call takes effect immediately. Clients don't need to call
2745    /// [`Coordinator.CommitConfig`].
2746    ///
2747    /// Fails with ZX_ERR_NOT_FOUND if `display_id` does not belong to a display
2748    /// known by the Coordinator. This can happen if a client issues a call to
2749    /// [`Coordinator.SetDisplayPowerMode`] before it receives a notification
2750    /// that the display was removed.
2751    ///
2752    /// This method is not idempotent. Each [`Coordinator.SetDisplayPowerMode`]
2753    /// call explicitly sets the power mode on the display hardware, though the
2754    /// display hardware driver may choose to behave idempotently.
2755    ///
2756    /// Fails with ZX_ERR_NOT_SUPPORTED if the display drivers or the hardware
2757    /// don't support the given `power_mode`.
2758    SetDisplayPowerMode {
2759        display_id: fidl_fuchsia_hardware_display_types::DisplayId,
2760        power_mode: fidl_fuchsia_hardware_display_types::PowerMode,
2761        responder: CoordinatorSetDisplayPowerModeResponder,
2762    },
2763}
2764
2765impl CoordinatorRequest {
2766    #[allow(irrefutable_let_patterns)]
2767    pub fn into_import_image(
2768        self,
2769    ) -> Option<(
2770        fidl_fuchsia_hardware_display_types::ImageMetadata,
2771        BufferCollectionId,
2772        u32,
2773        ImageId,
2774        CoordinatorImportImageResponder,
2775    )> {
2776        if let CoordinatorRequest::ImportImage {
2777            image_metadata,
2778            buffer_collection_id,
2779            buffer_index,
2780            image_id,
2781            responder,
2782        } = self
2783        {
2784            Some((image_metadata, buffer_collection_id, buffer_index, image_id, responder))
2785        } else {
2786            None
2787        }
2788    }
2789
2790    #[allow(irrefutable_let_patterns)]
2791    pub fn into_release_image(self) -> Option<(ImageId, CoordinatorControlHandle)> {
2792        if let CoordinatorRequest::ReleaseImage { image_id, control_handle } = self {
2793            Some((image_id, control_handle))
2794        } else {
2795            None
2796        }
2797    }
2798
2799    #[allow(irrefutable_let_patterns)]
2800    pub fn into_import_event(self) -> Option<(fidl::Event, EventId, CoordinatorControlHandle)> {
2801        if let CoordinatorRequest::ImportEvent { event, id, control_handle } = self {
2802            Some((event, id, control_handle))
2803        } else {
2804            None
2805        }
2806    }
2807
2808    #[allow(irrefutable_let_patterns)]
2809    pub fn into_release_event(self) -> Option<(EventId, CoordinatorControlHandle)> {
2810        if let CoordinatorRequest::ReleaseEvent { id, control_handle } = self {
2811            Some((id, control_handle))
2812        } else {
2813            None
2814        }
2815    }
2816
2817    #[allow(irrefutable_let_patterns)]
2818    pub fn into_create_layer(self) -> Option<(LayerId, CoordinatorCreateLayerResponder)> {
2819        if let CoordinatorRequest::CreateLayer { layer_id, responder } = self {
2820            Some((layer_id, responder))
2821        } else {
2822            None
2823        }
2824    }
2825
2826    #[allow(irrefutable_let_patterns)]
2827    pub fn into_destroy_layer(self) -> Option<(LayerId, CoordinatorControlHandle)> {
2828        if let CoordinatorRequest::DestroyLayer { layer_id, control_handle } = self {
2829            Some((layer_id, control_handle))
2830        } else {
2831            None
2832        }
2833    }
2834
2835    #[allow(irrefutable_let_patterns)]
2836    pub fn into_set_display_mode(
2837        self,
2838    ) -> Option<(
2839        fidl_fuchsia_hardware_display_types::DisplayId,
2840        fidl_fuchsia_hardware_display_types::Mode,
2841        CoordinatorControlHandle,
2842    )> {
2843        if let CoordinatorRequest::SetDisplayMode { display_id, mode, control_handle } = self {
2844            Some((display_id, mode, control_handle))
2845        } else {
2846            None
2847        }
2848    }
2849
2850    #[allow(irrefutable_let_patterns)]
2851    pub fn into_set_display_color_conversion(
2852        self,
2853    ) -> Option<(
2854        fidl_fuchsia_hardware_display_types::DisplayId,
2855        [f32; 3],
2856        [f32; 9],
2857        [f32; 3],
2858        CoordinatorControlHandle,
2859    )> {
2860        if let CoordinatorRequest::SetDisplayColorConversion {
2861            display_id,
2862            preoffsets,
2863            coefficients,
2864            postoffsets,
2865            control_handle,
2866        } = self
2867        {
2868            Some((display_id, preoffsets, coefficients, postoffsets, control_handle))
2869        } else {
2870            None
2871        }
2872    }
2873
2874    #[allow(irrefutable_let_patterns)]
2875    pub fn into_set_display_layers(
2876        self,
2877    ) -> Option<(
2878        fidl_fuchsia_hardware_display_types::DisplayId,
2879        Vec<LayerId>,
2880        CoordinatorControlHandle,
2881    )> {
2882        if let CoordinatorRequest::SetDisplayLayers { display_id, layer_ids, control_handle } = self
2883        {
2884            Some((display_id, layer_ids, control_handle))
2885        } else {
2886            None
2887        }
2888    }
2889
2890    #[allow(irrefutable_let_patterns)]
2891    pub fn into_set_layer_primary_config(
2892        self,
2893    ) -> Option<(
2894        LayerId,
2895        fidl_fuchsia_hardware_display_types::ImageMetadata,
2896        CoordinatorControlHandle,
2897    )> {
2898        if let CoordinatorRequest::SetLayerPrimaryConfig {
2899            layer_id,
2900            image_metadata,
2901            control_handle,
2902        } = self
2903        {
2904            Some((layer_id, image_metadata, control_handle))
2905        } else {
2906            None
2907        }
2908    }
2909
2910    #[allow(irrefutable_let_patterns)]
2911    pub fn into_set_layer_primary_position(
2912        self,
2913    ) -> Option<(
2914        LayerId,
2915        fidl_fuchsia_hardware_display_types::CoordinateTransformation,
2916        fidl_fuchsia_math::RectU,
2917        fidl_fuchsia_math::RectU,
2918        CoordinatorControlHandle,
2919    )> {
2920        if let CoordinatorRequest::SetLayerPrimaryPosition {
2921            layer_id,
2922            image_source_transformation,
2923            image_source,
2924            display_destination,
2925            control_handle,
2926        } = self
2927        {
2928            Some((
2929                layer_id,
2930                image_source_transformation,
2931                image_source,
2932                display_destination,
2933                control_handle,
2934            ))
2935        } else {
2936            None
2937        }
2938    }
2939
2940    #[allow(irrefutable_let_patterns)]
2941    pub fn into_set_layer_primary_alpha(
2942        self,
2943    ) -> Option<(
2944        LayerId,
2945        fidl_fuchsia_hardware_display_types::AlphaMode,
2946        f32,
2947        CoordinatorControlHandle,
2948    )> {
2949        if let CoordinatorRequest::SetLayerPrimaryAlpha { layer_id, mode, val, control_handle } =
2950            self
2951        {
2952            Some((layer_id, mode, val, control_handle))
2953        } else {
2954            None
2955        }
2956    }
2957
2958    #[allow(irrefutable_let_patterns)]
2959    pub fn into_set_layer_color_config(
2960        self,
2961    ) -> Option<(
2962        LayerId,
2963        fidl_fuchsia_hardware_display_types::Color,
2964        fidl_fuchsia_math::RectU,
2965        CoordinatorControlHandle,
2966    )> {
2967        if let CoordinatorRequest::SetLayerColorConfig {
2968            layer_id,
2969            color,
2970            display_destination,
2971            control_handle,
2972        } = self
2973        {
2974            Some((layer_id, color, display_destination, control_handle))
2975        } else {
2976            None
2977        }
2978    }
2979
2980    #[allow(irrefutable_let_patterns)]
2981    pub fn into_set_layer_image2(
2982        self,
2983    ) -> Option<(LayerId, ImageId, EventId, CoordinatorControlHandle)> {
2984        if let CoordinatorRequest::SetLayerImage2 {
2985            layer_id,
2986            image_id,
2987            wait_event_id,
2988            control_handle,
2989        } = self
2990        {
2991            Some((layer_id, image_id, wait_event_id, control_handle))
2992        } else {
2993            None
2994        }
2995    }
2996
2997    #[allow(irrefutable_let_patterns)]
2998    pub fn into_check_config(self) -> Option<(CoordinatorCheckConfigResponder)> {
2999        if let CoordinatorRequest::CheckConfig { responder } = self {
3000            Some((responder))
3001        } else {
3002            None
3003        }
3004    }
3005
3006    #[allow(irrefutable_let_patterns)]
3007    pub fn into_discard_config(self) -> Option<(CoordinatorControlHandle)> {
3008        if let CoordinatorRequest::DiscardConfig { control_handle } = self {
3009            Some((control_handle))
3010        } else {
3011            None
3012        }
3013    }
3014
3015    #[allow(irrefutable_let_patterns)]
3016    pub fn into_get_latest_committed_config_stamp(
3017        self,
3018    ) -> Option<(CoordinatorGetLatestCommittedConfigStampResponder)> {
3019        if let CoordinatorRequest::GetLatestCommittedConfigStamp { responder } = self {
3020            Some((responder))
3021        } else {
3022            None
3023        }
3024    }
3025
3026    #[allow(irrefutable_let_patterns)]
3027    pub fn into_commit_config(
3028        self,
3029    ) -> Option<(CoordinatorCommitConfigRequest, CoordinatorControlHandle)> {
3030        if let CoordinatorRequest::CommitConfig { payload, control_handle } = self {
3031            Some((payload, control_handle))
3032        } else {
3033            None
3034        }
3035    }
3036
3037    #[allow(irrefutable_let_patterns)]
3038    pub fn into_acknowledge_vsync(self) -> Option<(u64, CoordinatorControlHandle)> {
3039        if let CoordinatorRequest::AcknowledgeVsync { cookie, control_handle } = self {
3040            Some((cookie, control_handle))
3041        } else {
3042            None
3043        }
3044    }
3045
3046    #[allow(irrefutable_let_patterns)]
3047    pub fn into_import_buffer_collection(
3048        self,
3049    ) -> Option<(
3050        BufferCollectionId,
3051        fidl::endpoints::ClientEnd<fidl_fuchsia_sysmem2::BufferCollectionTokenMarker>,
3052        CoordinatorImportBufferCollectionResponder,
3053    )> {
3054        if let CoordinatorRequest::ImportBufferCollection {
3055            buffer_collection_id,
3056            buffer_collection_token,
3057            responder,
3058        } = self
3059        {
3060            Some((buffer_collection_id, buffer_collection_token, responder))
3061        } else {
3062            None
3063        }
3064    }
3065
3066    #[allow(irrefutable_let_patterns)]
3067    pub fn into_release_buffer_collection(
3068        self,
3069    ) -> Option<(BufferCollectionId, CoordinatorControlHandle)> {
3070        if let CoordinatorRequest::ReleaseBufferCollection {
3071            buffer_collection_id,
3072            control_handle,
3073        } = self
3074        {
3075            Some((buffer_collection_id, control_handle))
3076        } else {
3077            None
3078        }
3079    }
3080
3081    #[allow(irrefutable_let_patterns)]
3082    pub fn into_set_buffer_collection_constraints(
3083        self,
3084    ) -> Option<(
3085        BufferCollectionId,
3086        fidl_fuchsia_hardware_display_types::ImageBufferUsage,
3087        CoordinatorSetBufferCollectionConstraintsResponder,
3088    )> {
3089        if let CoordinatorRequest::SetBufferCollectionConstraints {
3090            buffer_collection_id,
3091            buffer_usage,
3092            responder,
3093        } = self
3094        {
3095            Some((buffer_collection_id, buffer_usage, responder))
3096        } else {
3097            None
3098        }
3099    }
3100
3101    #[allow(irrefutable_let_patterns)]
3102    pub fn into_is_capture_supported(self) -> Option<(CoordinatorIsCaptureSupportedResponder)> {
3103        if let CoordinatorRequest::IsCaptureSupported { responder } = self {
3104            Some((responder))
3105        } else {
3106            None
3107        }
3108    }
3109
3110    #[allow(irrefutable_let_patterns)]
3111    pub fn into_start_capture(
3112        self,
3113    ) -> Option<(EventId, ImageId, CoordinatorStartCaptureResponder)> {
3114        if let CoordinatorRequest::StartCapture { signal_event_id, image_id, responder } = self {
3115            Some((signal_event_id, image_id, responder))
3116        } else {
3117            None
3118        }
3119    }
3120
3121    #[allow(irrefutable_let_patterns)]
3122    pub fn into_set_minimum_rgb(self) -> Option<(u8, CoordinatorSetMinimumRgbResponder)> {
3123        if let CoordinatorRequest::SetMinimumRgb { minimum_rgb, responder } = self {
3124            Some((minimum_rgb, responder))
3125        } else {
3126            None
3127        }
3128    }
3129
3130    #[allow(irrefutable_let_patterns)]
3131    pub fn into_set_display_power_mode(
3132        self,
3133    ) -> Option<(
3134        fidl_fuchsia_hardware_display_types::DisplayId,
3135        fidl_fuchsia_hardware_display_types::PowerMode,
3136        CoordinatorSetDisplayPowerModeResponder,
3137    )> {
3138        if let CoordinatorRequest::SetDisplayPowerMode { display_id, power_mode, responder } = self
3139        {
3140            Some((display_id, power_mode, responder))
3141        } else {
3142            None
3143        }
3144    }
3145
3146    /// Name of the method defined in FIDL
3147    pub fn method_name(&self) -> &'static str {
3148        match *self {
3149            CoordinatorRequest::ImportImage { .. } => "import_image",
3150            CoordinatorRequest::ReleaseImage { .. } => "release_image",
3151            CoordinatorRequest::ImportEvent { .. } => "import_event",
3152            CoordinatorRequest::ReleaseEvent { .. } => "release_event",
3153            CoordinatorRequest::CreateLayer { .. } => "create_layer",
3154            CoordinatorRequest::DestroyLayer { .. } => "destroy_layer",
3155            CoordinatorRequest::SetDisplayMode { .. } => "set_display_mode",
3156            CoordinatorRequest::SetDisplayColorConversion { .. } => "set_display_color_conversion",
3157            CoordinatorRequest::SetDisplayLayers { .. } => "set_display_layers",
3158            CoordinatorRequest::SetLayerPrimaryConfig { .. } => "set_layer_primary_config",
3159            CoordinatorRequest::SetLayerPrimaryPosition { .. } => "set_layer_primary_position",
3160            CoordinatorRequest::SetLayerPrimaryAlpha { .. } => "set_layer_primary_alpha",
3161            CoordinatorRequest::SetLayerColorConfig { .. } => "set_layer_color_config",
3162            CoordinatorRequest::SetLayerImage2 { .. } => "set_layer_image2",
3163            CoordinatorRequest::CheckConfig { .. } => "check_config",
3164            CoordinatorRequest::DiscardConfig { .. } => "discard_config",
3165            CoordinatorRequest::GetLatestCommittedConfigStamp { .. } => {
3166                "get_latest_committed_config_stamp"
3167            }
3168            CoordinatorRequest::CommitConfig { .. } => "commit_config",
3169            CoordinatorRequest::AcknowledgeVsync { .. } => "acknowledge_vsync",
3170            CoordinatorRequest::ImportBufferCollection { .. } => "import_buffer_collection",
3171            CoordinatorRequest::ReleaseBufferCollection { .. } => "release_buffer_collection",
3172            CoordinatorRequest::SetBufferCollectionConstraints { .. } => {
3173                "set_buffer_collection_constraints"
3174            }
3175            CoordinatorRequest::IsCaptureSupported { .. } => "is_capture_supported",
3176            CoordinatorRequest::StartCapture { .. } => "start_capture",
3177            CoordinatorRequest::SetMinimumRgb { .. } => "set_minimum_rgb",
3178            CoordinatorRequest::SetDisplayPowerMode { .. } => "set_display_power_mode",
3179        }
3180    }
3181}
3182
3183#[derive(Debug, Clone)]
3184pub struct CoordinatorControlHandle {
3185    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3186}
3187
3188impl CoordinatorControlHandle {
3189    pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
3190        self.inner.shutdown_with_epitaph(status.into())
3191    }
3192}
3193
3194impl fidl::endpoints::ControlHandle for CoordinatorControlHandle {
3195    fn shutdown(&self) {
3196        self.inner.shutdown()
3197    }
3198
3199    fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
3200        self.inner.shutdown_with_epitaph(status)
3201    }
3202
3203    fn is_closed(&self) -> bool {
3204        self.inner.channel().is_closed()
3205    }
3206    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
3207        self.inner.channel().on_closed()
3208    }
3209
3210    #[cfg(target_os = "fuchsia")]
3211    fn signal_peer(
3212        &self,
3213        clear_mask: zx::Signals,
3214        set_mask: zx::Signals,
3215    ) -> Result<(), zx_status::Status> {
3216        use fidl::Peered;
3217        self.inner.channel().signal_peer(clear_mask, set_mask)
3218    }
3219}
3220
3221impl CoordinatorControlHandle {}
3222
3223#[must_use = "FIDL methods require a response to be sent"]
3224#[derive(Debug)]
3225pub struct CoordinatorImportImageResponder {
3226    control_handle: std::mem::ManuallyDrop<CoordinatorControlHandle>,
3227    tx_id: u32,
3228}
3229
3230/// Set the the channel to be shutdown (see [`CoordinatorControlHandle::shutdown`])
3231/// if the responder is dropped without sending a response, so that the client
3232/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3233impl std::ops::Drop for CoordinatorImportImageResponder {
3234    fn drop(&mut self) {
3235        self.control_handle.shutdown();
3236        // Safety: drops once, never accessed again
3237        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3238    }
3239}
3240
3241impl fidl::endpoints::Responder for CoordinatorImportImageResponder {
3242    type ControlHandle = CoordinatorControlHandle;
3243
3244    fn control_handle(&self) -> &CoordinatorControlHandle {
3245        &self.control_handle
3246    }
3247
3248    fn drop_without_shutdown(mut self) {
3249        // Safety: drops once, never accessed again due to mem::forget
3250        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3251        // Prevent Drop from running (which would shut down the channel)
3252        std::mem::forget(self);
3253    }
3254}
3255
3256impl CoordinatorImportImageResponder {
3257    /// Sends a response to the FIDL transaction.
3258    ///
3259    /// Sets the channel to shutdown if an error occurs.
3260    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
3261        let _result = self.send_raw(result);
3262        if _result.is_err() {
3263            self.control_handle.shutdown();
3264        }
3265        self.drop_without_shutdown();
3266        _result
3267    }
3268
3269    /// Similar to "send" but does not shutdown the channel if an error occurs.
3270    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
3271        let _result = self.send_raw(result);
3272        self.drop_without_shutdown();
3273        _result
3274    }
3275
3276    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
3277        self.control_handle
3278            .inner
3279            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
3280                result,
3281                self.tx_id,
3282                0x3a8636eb9656b4f4,
3283                fidl::encoding::DynamicFlags::empty(),
3284            )
3285    }
3286}
3287
3288#[must_use = "FIDL methods require a response to be sent"]
3289#[derive(Debug)]
3290pub struct CoordinatorCreateLayerResponder {
3291    control_handle: std::mem::ManuallyDrop<CoordinatorControlHandle>,
3292    tx_id: u32,
3293}
3294
3295/// Set the the channel to be shutdown (see [`CoordinatorControlHandle::shutdown`])
3296/// if the responder is dropped without sending a response, so that the client
3297/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3298impl std::ops::Drop for CoordinatorCreateLayerResponder {
3299    fn drop(&mut self) {
3300        self.control_handle.shutdown();
3301        // Safety: drops once, never accessed again
3302        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3303    }
3304}
3305
3306impl fidl::endpoints::Responder for CoordinatorCreateLayerResponder {
3307    type ControlHandle = CoordinatorControlHandle;
3308
3309    fn control_handle(&self) -> &CoordinatorControlHandle {
3310        &self.control_handle
3311    }
3312
3313    fn drop_without_shutdown(mut self) {
3314        // Safety: drops once, never accessed again due to mem::forget
3315        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3316        // Prevent Drop from running (which would shut down the channel)
3317        std::mem::forget(self);
3318    }
3319}
3320
3321impl CoordinatorCreateLayerResponder {
3322    /// Sends a response to the FIDL transaction.
3323    ///
3324    /// Sets the channel to shutdown if an error occurs.
3325    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
3326        let _result = self.send_raw(result);
3327        if _result.is_err() {
3328            self.control_handle.shutdown();
3329        }
3330        self.drop_without_shutdown();
3331        _result
3332    }
3333
3334    /// Similar to "send" but does not shutdown the channel if an error occurs.
3335    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
3336        let _result = self.send_raw(result);
3337        self.drop_without_shutdown();
3338        _result
3339    }
3340
3341    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
3342        self.control_handle
3343            .inner
3344            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
3345                result,
3346                self.tx_id,
3347                0x2137cfd788a3496b,
3348                fidl::encoding::DynamicFlags::empty(),
3349            )
3350    }
3351}
3352
3353#[must_use = "FIDL methods require a response to be sent"]
3354#[derive(Debug)]
3355pub struct CoordinatorCheckConfigResponder {
3356    control_handle: std::mem::ManuallyDrop<CoordinatorControlHandle>,
3357    tx_id: u32,
3358}
3359
3360/// Set the the channel to be shutdown (see [`CoordinatorControlHandle::shutdown`])
3361/// if the responder is dropped without sending a response, so that the client
3362/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3363impl std::ops::Drop for CoordinatorCheckConfigResponder {
3364    fn drop(&mut self) {
3365        self.control_handle.shutdown();
3366        // Safety: drops once, never accessed again
3367        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3368    }
3369}
3370
3371impl fidl::endpoints::Responder for CoordinatorCheckConfigResponder {
3372    type ControlHandle = CoordinatorControlHandle;
3373
3374    fn control_handle(&self) -> &CoordinatorControlHandle {
3375        &self.control_handle
3376    }
3377
3378    fn drop_without_shutdown(mut self) {
3379        // Safety: drops once, never accessed again due to mem::forget
3380        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3381        // Prevent Drop from running (which would shut down the channel)
3382        std::mem::forget(self);
3383    }
3384}
3385
3386impl CoordinatorCheckConfigResponder {
3387    /// Sends a response to the FIDL transaction.
3388    ///
3389    /// Sets the channel to shutdown if an error occurs.
3390    pub fn send(
3391        self,
3392        mut res: fidl_fuchsia_hardware_display_types::ConfigResult,
3393    ) -> Result<(), fidl::Error> {
3394        let _result = self.send_raw(res);
3395        if _result.is_err() {
3396            self.control_handle.shutdown();
3397        }
3398        self.drop_without_shutdown();
3399        _result
3400    }
3401
3402    /// Similar to "send" but does not shutdown the channel if an error occurs.
3403    pub fn send_no_shutdown_on_err(
3404        self,
3405        mut res: fidl_fuchsia_hardware_display_types::ConfigResult,
3406    ) -> Result<(), fidl::Error> {
3407        let _result = self.send_raw(res);
3408        self.drop_without_shutdown();
3409        _result
3410    }
3411
3412    fn send_raw(
3413        &self,
3414        mut res: fidl_fuchsia_hardware_display_types::ConfigResult,
3415    ) -> Result<(), fidl::Error> {
3416        self.control_handle.inner.send::<CoordinatorCheckConfigResponse>(
3417            (res,),
3418            self.tx_id,
3419            0x2bcfb4eb16878158,
3420            fidl::encoding::DynamicFlags::empty(),
3421        )
3422    }
3423}
3424
3425#[must_use = "FIDL methods require a response to be sent"]
3426#[derive(Debug)]
3427pub struct CoordinatorGetLatestCommittedConfigStampResponder {
3428    control_handle: std::mem::ManuallyDrop<CoordinatorControlHandle>,
3429    tx_id: u32,
3430}
3431
3432/// Set the the channel to be shutdown (see [`CoordinatorControlHandle::shutdown`])
3433/// if the responder is dropped without sending a response, so that the client
3434/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3435impl std::ops::Drop for CoordinatorGetLatestCommittedConfigStampResponder {
3436    fn drop(&mut self) {
3437        self.control_handle.shutdown();
3438        // Safety: drops once, never accessed again
3439        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3440    }
3441}
3442
3443impl fidl::endpoints::Responder for CoordinatorGetLatestCommittedConfigStampResponder {
3444    type ControlHandle = CoordinatorControlHandle;
3445
3446    fn control_handle(&self) -> &CoordinatorControlHandle {
3447        &self.control_handle
3448    }
3449
3450    fn drop_without_shutdown(mut self) {
3451        // Safety: drops once, never accessed again due to mem::forget
3452        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3453        // Prevent Drop from running (which would shut down the channel)
3454        std::mem::forget(self);
3455    }
3456}
3457
3458impl CoordinatorGetLatestCommittedConfigStampResponder {
3459    /// Sends a response to the FIDL transaction.
3460    ///
3461    /// Sets the channel to shutdown if an error occurs.
3462    pub fn send(self, mut stamp: &ConfigStamp) -> Result<(), fidl::Error> {
3463        let _result = self.send_raw(stamp);
3464        if _result.is_err() {
3465            self.control_handle.shutdown();
3466        }
3467        self.drop_without_shutdown();
3468        _result
3469    }
3470
3471    /// Similar to "send" but does not shutdown the channel if an error occurs.
3472    pub fn send_no_shutdown_on_err(self, mut stamp: &ConfigStamp) -> Result<(), fidl::Error> {
3473        let _result = self.send_raw(stamp);
3474        self.drop_without_shutdown();
3475        _result
3476    }
3477
3478    fn send_raw(&self, mut stamp: &ConfigStamp) -> Result<(), fidl::Error> {
3479        self.control_handle.inner.send::<CoordinatorGetLatestCommittedConfigStampResponse>(
3480            (stamp,),
3481            self.tx_id,
3482            0x2a441f2c81af5d66,
3483            fidl::encoding::DynamicFlags::empty(),
3484        )
3485    }
3486}
3487
3488#[must_use = "FIDL methods require a response to be sent"]
3489#[derive(Debug)]
3490pub struct CoordinatorImportBufferCollectionResponder {
3491    control_handle: std::mem::ManuallyDrop<CoordinatorControlHandle>,
3492    tx_id: u32,
3493}
3494
3495/// Set the the channel to be shutdown (see [`CoordinatorControlHandle::shutdown`])
3496/// if the responder is dropped without sending a response, so that the client
3497/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3498impl std::ops::Drop for CoordinatorImportBufferCollectionResponder {
3499    fn drop(&mut self) {
3500        self.control_handle.shutdown();
3501        // Safety: drops once, never accessed again
3502        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3503    }
3504}
3505
3506impl fidl::endpoints::Responder for CoordinatorImportBufferCollectionResponder {
3507    type ControlHandle = CoordinatorControlHandle;
3508
3509    fn control_handle(&self) -> &CoordinatorControlHandle {
3510        &self.control_handle
3511    }
3512
3513    fn drop_without_shutdown(mut self) {
3514        // Safety: drops once, never accessed again due to mem::forget
3515        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3516        // Prevent Drop from running (which would shut down the channel)
3517        std::mem::forget(self);
3518    }
3519}
3520
3521impl CoordinatorImportBufferCollectionResponder {
3522    /// Sends a response to the FIDL transaction.
3523    ///
3524    /// Sets the channel to shutdown if an error occurs.
3525    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
3526        let _result = self.send_raw(result);
3527        if _result.is_err() {
3528            self.control_handle.shutdown();
3529        }
3530        self.drop_without_shutdown();
3531        _result
3532    }
3533
3534    /// Similar to "send" but does not shutdown the channel if an error occurs.
3535    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
3536        let _result = self.send_raw(result);
3537        self.drop_without_shutdown();
3538        _result
3539    }
3540
3541    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
3542        self.control_handle
3543            .inner
3544            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
3545                result,
3546                self.tx_id,
3547                0x30d06f510e7f4601,
3548                fidl::encoding::DynamicFlags::empty(),
3549            )
3550    }
3551}
3552
3553#[must_use = "FIDL methods require a response to be sent"]
3554#[derive(Debug)]
3555pub struct CoordinatorSetBufferCollectionConstraintsResponder {
3556    control_handle: std::mem::ManuallyDrop<CoordinatorControlHandle>,
3557    tx_id: u32,
3558}
3559
3560/// Set the the channel to be shutdown (see [`CoordinatorControlHandle::shutdown`])
3561/// if the responder is dropped without sending a response, so that the client
3562/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3563impl std::ops::Drop for CoordinatorSetBufferCollectionConstraintsResponder {
3564    fn drop(&mut self) {
3565        self.control_handle.shutdown();
3566        // Safety: drops once, never accessed again
3567        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3568    }
3569}
3570
3571impl fidl::endpoints::Responder for CoordinatorSetBufferCollectionConstraintsResponder {
3572    type ControlHandle = CoordinatorControlHandle;
3573
3574    fn control_handle(&self) -> &CoordinatorControlHandle {
3575        &self.control_handle
3576    }
3577
3578    fn drop_without_shutdown(mut self) {
3579        // Safety: drops once, never accessed again due to mem::forget
3580        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3581        // Prevent Drop from running (which would shut down the channel)
3582        std::mem::forget(self);
3583    }
3584}
3585
3586impl CoordinatorSetBufferCollectionConstraintsResponder {
3587    /// Sends a response to the FIDL transaction.
3588    ///
3589    /// Sets the channel to shutdown if an error occurs.
3590    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
3591        let _result = self.send_raw(result);
3592        if _result.is_err() {
3593            self.control_handle.shutdown();
3594        }
3595        self.drop_without_shutdown();
3596        _result
3597    }
3598
3599    /// Similar to "send" but does not shutdown the channel if an error occurs.
3600    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
3601        let _result = self.send_raw(result);
3602        self.drop_without_shutdown();
3603        _result
3604    }
3605
3606    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
3607        self.control_handle
3608            .inner
3609            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
3610                result,
3611                self.tx_id,
3612                0x509a4ee9af6035df,
3613                fidl::encoding::DynamicFlags::empty(),
3614            )
3615    }
3616}
3617
3618#[must_use = "FIDL methods require a response to be sent"]
3619#[derive(Debug)]
3620pub struct CoordinatorIsCaptureSupportedResponder {
3621    control_handle: std::mem::ManuallyDrop<CoordinatorControlHandle>,
3622    tx_id: u32,
3623}
3624
3625/// Set the the channel to be shutdown (see [`CoordinatorControlHandle::shutdown`])
3626/// if the responder is dropped without sending a response, so that the client
3627/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3628impl std::ops::Drop for CoordinatorIsCaptureSupportedResponder {
3629    fn drop(&mut self) {
3630        self.control_handle.shutdown();
3631        // Safety: drops once, never accessed again
3632        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3633    }
3634}
3635
3636impl fidl::endpoints::Responder for CoordinatorIsCaptureSupportedResponder {
3637    type ControlHandle = CoordinatorControlHandle;
3638
3639    fn control_handle(&self) -> &CoordinatorControlHandle {
3640        &self.control_handle
3641    }
3642
3643    fn drop_without_shutdown(mut self) {
3644        // Safety: drops once, never accessed again due to mem::forget
3645        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3646        // Prevent Drop from running (which would shut down the channel)
3647        std::mem::forget(self);
3648    }
3649}
3650
3651impl CoordinatorIsCaptureSupportedResponder {
3652    /// Sends a response to the FIDL transaction.
3653    ///
3654    /// Sets the channel to shutdown if an error occurs.
3655    pub fn send(self, mut result: Result<bool, i32>) -> Result<(), fidl::Error> {
3656        let _result = self.send_raw(result);
3657        if _result.is_err() {
3658            self.control_handle.shutdown();
3659        }
3660        self.drop_without_shutdown();
3661        _result
3662    }
3663
3664    /// Similar to "send" but does not shutdown the channel if an error occurs.
3665    pub fn send_no_shutdown_on_err(self, mut result: Result<bool, i32>) -> Result<(), fidl::Error> {
3666        let _result = self.send_raw(result);
3667        self.drop_without_shutdown();
3668        _result
3669    }
3670
3671    fn send_raw(&self, mut result: Result<bool, i32>) -> Result<(), fidl::Error> {
3672        self.control_handle.inner.send::<fidl::encoding::ResultType<
3673            CoordinatorIsCaptureSupportedResponse,
3674            i32,
3675        >>(
3676            result.map(|supported| (supported,)),
3677            self.tx_id,
3678            0x4ca407277277971b,
3679            fidl::encoding::DynamicFlags::empty(),
3680        )
3681    }
3682}
3683
3684#[must_use = "FIDL methods require a response to be sent"]
3685#[derive(Debug)]
3686pub struct CoordinatorStartCaptureResponder {
3687    control_handle: std::mem::ManuallyDrop<CoordinatorControlHandle>,
3688    tx_id: u32,
3689}
3690
3691/// Set the the channel to be shutdown (see [`CoordinatorControlHandle::shutdown`])
3692/// if the responder is dropped without sending a response, so that the client
3693/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3694impl std::ops::Drop for CoordinatorStartCaptureResponder {
3695    fn drop(&mut self) {
3696        self.control_handle.shutdown();
3697        // Safety: drops once, never accessed again
3698        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3699    }
3700}
3701
3702impl fidl::endpoints::Responder for CoordinatorStartCaptureResponder {
3703    type ControlHandle = CoordinatorControlHandle;
3704
3705    fn control_handle(&self) -> &CoordinatorControlHandle {
3706        &self.control_handle
3707    }
3708
3709    fn drop_without_shutdown(mut self) {
3710        // Safety: drops once, never accessed again due to mem::forget
3711        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3712        // Prevent Drop from running (which would shut down the channel)
3713        std::mem::forget(self);
3714    }
3715}
3716
3717impl CoordinatorStartCaptureResponder {
3718    /// Sends a response to the FIDL transaction.
3719    ///
3720    /// Sets the channel to shutdown if an error occurs.
3721    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
3722        let _result = self.send_raw(result);
3723        if _result.is_err() {
3724            self.control_handle.shutdown();
3725        }
3726        self.drop_without_shutdown();
3727        _result
3728    }
3729
3730    /// Similar to "send" but does not shutdown the channel if an error occurs.
3731    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
3732        let _result = self.send_raw(result);
3733        self.drop_without_shutdown();
3734        _result
3735    }
3736
3737    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
3738        self.control_handle
3739            .inner
3740            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
3741                result,
3742                self.tx_id,
3743                0x35cb38f19d96a8db,
3744                fidl::encoding::DynamicFlags::empty(),
3745            )
3746    }
3747}
3748
3749#[must_use = "FIDL methods require a response to be sent"]
3750#[derive(Debug)]
3751pub struct CoordinatorSetMinimumRgbResponder {
3752    control_handle: std::mem::ManuallyDrop<CoordinatorControlHandle>,
3753    tx_id: u32,
3754}
3755
3756/// Set the the channel to be shutdown (see [`CoordinatorControlHandle::shutdown`])
3757/// if the responder is dropped without sending a response, so that the client
3758/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3759impl std::ops::Drop for CoordinatorSetMinimumRgbResponder {
3760    fn drop(&mut self) {
3761        self.control_handle.shutdown();
3762        // Safety: drops once, never accessed again
3763        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3764    }
3765}
3766
3767impl fidl::endpoints::Responder for CoordinatorSetMinimumRgbResponder {
3768    type ControlHandle = CoordinatorControlHandle;
3769
3770    fn control_handle(&self) -> &CoordinatorControlHandle {
3771        &self.control_handle
3772    }
3773
3774    fn drop_without_shutdown(mut self) {
3775        // Safety: drops once, never accessed again due to mem::forget
3776        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3777        // Prevent Drop from running (which would shut down the channel)
3778        std::mem::forget(self);
3779    }
3780}
3781
3782impl CoordinatorSetMinimumRgbResponder {
3783    /// Sends a response to the FIDL transaction.
3784    ///
3785    /// Sets the channel to shutdown if an error occurs.
3786    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
3787        let _result = self.send_raw(result);
3788        if _result.is_err() {
3789            self.control_handle.shutdown();
3790        }
3791        self.drop_without_shutdown();
3792        _result
3793    }
3794
3795    /// Similar to "send" but does not shutdown the channel if an error occurs.
3796    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
3797        let _result = self.send_raw(result);
3798        self.drop_without_shutdown();
3799        _result
3800    }
3801
3802    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
3803        self.control_handle
3804            .inner
3805            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
3806                result,
3807                self.tx_id,
3808                0x1b49251437038b0b,
3809                fidl::encoding::DynamicFlags::empty(),
3810            )
3811    }
3812}
3813
3814#[must_use = "FIDL methods require a response to be sent"]
3815#[derive(Debug)]
3816pub struct CoordinatorSetDisplayPowerModeResponder {
3817    control_handle: std::mem::ManuallyDrop<CoordinatorControlHandle>,
3818    tx_id: u32,
3819}
3820
3821/// Set the the channel to be shutdown (see [`CoordinatorControlHandle::shutdown`])
3822/// if the responder is dropped without sending a response, so that the client
3823/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3824impl std::ops::Drop for CoordinatorSetDisplayPowerModeResponder {
3825    fn drop(&mut self) {
3826        self.control_handle.shutdown();
3827        // Safety: drops once, never accessed again
3828        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3829    }
3830}
3831
3832impl fidl::endpoints::Responder for CoordinatorSetDisplayPowerModeResponder {
3833    type ControlHandle = CoordinatorControlHandle;
3834
3835    fn control_handle(&self) -> &CoordinatorControlHandle {
3836        &self.control_handle
3837    }
3838
3839    fn drop_without_shutdown(mut self) {
3840        // Safety: drops once, never accessed again due to mem::forget
3841        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3842        // Prevent Drop from running (which would shut down the channel)
3843        std::mem::forget(self);
3844    }
3845}
3846
3847impl CoordinatorSetDisplayPowerModeResponder {
3848    /// Sends a response to the FIDL transaction.
3849    ///
3850    /// Sets the channel to shutdown if an error occurs.
3851    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
3852        let _result = self.send_raw(result);
3853        if _result.is_err() {
3854            self.control_handle.shutdown();
3855        }
3856        self.drop_without_shutdown();
3857        _result
3858    }
3859
3860    /// Similar to "send" but does not shutdown the channel if an error occurs.
3861    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
3862        let _result = self.send_raw(result);
3863        self.drop_without_shutdown();
3864        _result
3865    }
3866
3867    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
3868        self.control_handle
3869            .inner
3870            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
3871                result,
3872                self.tx_id,
3873                0xf4672f055072c92,
3874                fidl::encoding::DynamicFlags::empty(),
3875            )
3876    }
3877}
3878
3879#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
3880pub struct CoordinatorListenerMarker;
3881
3882impl fidl::endpoints::ProtocolMarker for CoordinatorListenerMarker {
3883    type Proxy = CoordinatorListenerProxy;
3884    type RequestStream = CoordinatorListenerRequestStream;
3885    #[cfg(target_os = "fuchsia")]
3886    type SynchronousProxy = CoordinatorListenerSynchronousProxy;
3887
3888    const DEBUG_NAME: &'static str = "(anonymous) CoordinatorListener";
3889}
3890
3891pub trait CoordinatorListenerProxyInterface: Send + Sync {
3892    fn r#on_displays_changed(
3893        &self,
3894        added: &[Info],
3895        removed: &[fidl_fuchsia_hardware_display_types::DisplayId],
3896    ) -> Result<(), fidl::Error>;
3897    fn r#on_vsync(
3898        &self,
3899        display_id: &fidl_fuchsia_hardware_display_types::DisplayId,
3900        timestamp: fidl::MonotonicInstant,
3901        displayed_config_stamp: &ConfigStamp,
3902        cookie: &VsyncAckCookie,
3903    ) -> Result<(), fidl::Error>;
3904    fn r#on_client_ownership_change(&self, has_ownership: bool) -> Result<(), fidl::Error>;
3905}
3906#[derive(Debug)]
3907#[cfg(target_os = "fuchsia")]
3908pub struct CoordinatorListenerSynchronousProxy {
3909    client: fidl::client::sync::Client,
3910}
3911
3912#[cfg(target_os = "fuchsia")]
3913impl fidl::endpoints::SynchronousProxy for CoordinatorListenerSynchronousProxy {
3914    type Proxy = CoordinatorListenerProxy;
3915    type Protocol = CoordinatorListenerMarker;
3916
3917    fn from_channel(inner: fidl::Channel) -> Self {
3918        Self::new(inner)
3919    }
3920
3921    fn into_channel(self) -> fidl::Channel {
3922        self.client.into_channel()
3923    }
3924
3925    fn as_channel(&self) -> &fidl::Channel {
3926        self.client.as_channel()
3927    }
3928}
3929
3930#[cfg(target_os = "fuchsia")]
3931impl CoordinatorListenerSynchronousProxy {
3932    pub fn new(channel: fidl::Channel) -> Self {
3933        Self { client: fidl::client::sync::Client::new(channel) }
3934    }
3935
3936    pub fn into_channel(self) -> fidl::Channel {
3937        self.client.into_channel()
3938    }
3939
3940    /// Waits until an event arrives and returns it. It is safe for other
3941    /// threads to make concurrent requests while waiting for an event.
3942    pub fn wait_for_event(
3943        &self,
3944        deadline: zx::MonotonicInstant,
3945    ) -> Result<CoordinatorListenerEvent, fidl::Error> {
3946        CoordinatorListenerEvent::decode(
3947            self.client.wait_for_event::<CoordinatorListenerMarker>(deadline)?,
3948        )
3949    }
3950
3951    /// Called when the set of connected displays changes.
3952    ///
3953    /// Also used to communicate the set of connected displays to a newly
3954    /// connected client.
3955    ///
3956    /// After this method is called, all applied and draft configurations may no
3957    /// longer be valid. The client must validate and apply a new configuration,
3958    /// by calling [`Coordinator.CheckConfig`] and [`Coordinator.CommitConfig`].
3959    ///
3960    /// `added` and `removed` must not be both empty.
3961    pub fn r#on_displays_changed(
3962        &self,
3963        mut added: &[Info],
3964        mut removed: &[fidl_fuchsia_hardware_display_types::DisplayId],
3965    ) -> Result<(), fidl::Error> {
3966        self.client.send::<CoordinatorListenerOnDisplaysChangedRequest>(
3967            (added, removed),
3968            0x248fbe90c338a94f,
3969            fidl::encoding::DynamicFlags::empty(),
3970        )
3971    }
3972
3973    /// Called on every display Vertical Synchronization (Vsync).
3974    ///
3975    /// Clients must acknowledge VSync events via the method
3976    /// [`Coordinator.AcknowledgeVsync`].  The coordinator may throttle a client
3977    /// that accumulates a certain number of unacknowledged VSync cookies.
3978    /// Throttled clients do not receive VSync events.
3979    ///
3980    /// After a the client catches up on acknowledging cookies, the coordinator
3981    /// will unthrottle it (resume sending VSync events). Throttled clients may
3982    /// miss some VSync events, as the coordinator is allowed to drop VSync
3983    /// event information for throttled clients.
3984    ///
3985    /// When dropping VSync event information for throttled clients, the
3986    /// coordinator should prioritize retaining the information for newer
3987    /// events. In other words, the oldest unreported events should be dropped
3988    /// first.
3989    pub fn r#on_vsync(
3990        &self,
3991        mut display_id: &fidl_fuchsia_hardware_display_types::DisplayId,
3992        mut timestamp: fidl::MonotonicInstant,
3993        mut displayed_config_stamp: &ConfigStamp,
3994        mut cookie: &VsyncAckCookie,
3995    ) -> Result<(), fidl::Error> {
3996        self.client.send::<CoordinatorListenerOnVsyncRequest>(
3997            (display_id, timestamp, displayed_config_stamp, cookie),
3998            0x249e9b8da7a7ac47,
3999            fidl::encoding::DynamicFlags::empty(),
4000        )
4001    }
4002
4003    /// Called when the corresponding `Coordinator` client gains or loses
4004    /// ownership of the displays.
4005    ///
4006    /// A `Coordinator` client's displayed config is visible iff it holds the
4007    /// ownership of the displays.
4008    ///
4009    /// A new `Coordinator` client should assume they do not have ownership
4010    /// of the displays until this method informs them otherwise.
4011    pub fn r#on_client_ownership_change(&self, mut has_ownership: bool) -> Result<(), fidl::Error> {
4012        self.client.send::<CoordinatorListenerOnClientOwnershipChangeRequest>(
4013            (has_ownership,),
4014            0x1acd2ae683153d5e,
4015            fidl::encoding::DynamicFlags::empty(),
4016        )
4017    }
4018}
4019
4020#[cfg(target_os = "fuchsia")]
4021impl From<CoordinatorListenerSynchronousProxy> for zx::NullableHandle {
4022    fn from(value: CoordinatorListenerSynchronousProxy) -> Self {
4023        value.into_channel().into()
4024    }
4025}
4026
4027#[cfg(target_os = "fuchsia")]
4028impl From<fidl::Channel> for CoordinatorListenerSynchronousProxy {
4029    fn from(value: fidl::Channel) -> Self {
4030        Self::new(value)
4031    }
4032}
4033
4034#[cfg(target_os = "fuchsia")]
4035impl fidl::endpoints::FromClient for CoordinatorListenerSynchronousProxy {
4036    type Protocol = CoordinatorListenerMarker;
4037
4038    fn from_client(value: fidl::endpoints::ClientEnd<CoordinatorListenerMarker>) -> Self {
4039        Self::new(value.into_channel())
4040    }
4041}
4042
4043#[derive(Debug, Clone)]
4044pub struct CoordinatorListenerProxy {
4045    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
4046}
4047
4048impl fidl::endpoints::Proxy for CoordinatorListenerProxy {
4049    type Protocol = CoordinatorListenerMarker;
4050
4051    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
4052        Self::new(inner)
4053    }
4054
4055    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
4056        self.client.into_channel().map_err(|client| Self { client })
4057    }
4058
4059    fn as_channel(&self) -> &::fidl::AsyncChannel {
4060        self.client.as_channel()
4061    }
4062}
4063
4064impl CoordinatorListenerProxy {
4065    /// Create a new Proxy for fuchsia.hardware.display/CoordinatorListener.
4066    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
4067        let protocol_name =
4068            <CoordinatorListenerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
4069        Self { client: fidl::client::Client::new(channel, protocol_name) }
4070    }
4071
4072    /// Get a Stream of events from the remote end of the protocol.
4073    ///
4074    /// # Panics
4075    ///
4076    /// Panics if the event stream was already taken.
4077    pub fn take_event_stream(&self) -> CoordinatorListenerEventStream {
4078        CoordinatorListenerEventStream { event_receiver: self.client.take_event_receiver() }
4079    }
4080
4081    /// Called when the set of connected displays changes.
4082    ///
4083    /// Also used to communicate the set of connected displays to a newly
4084    /// connected client.
4085    ///
4086    /// After this method is called, all applied and draft configurations may no
4087    /// longer be valid. The client must validate and apply a new configuration,
4088    /// by calling [`Coordinator.CheckConfig`] and [`Coordinator.CommitConfig`].
4089    ///
4090    /// `added` and `removed` must not be both empty.
4091    pub fn r#on_displays_changed(
4092        &self,
4093        mut added: &[Info],
4094        mut removed: &[fidl_fuchsia_hardware_display_types::DisplayId],
4095    ) -> Result<(), fidl::Error> {
4096        CoordinatorListenerProxyInterface::r#on_displays_changed(self, added, removed)
4097    }
4098
4099    /// Called on every display Vertical Synchronization (Vsync).
4100    ///
4101    /// Clients must acknowledge VSync events via the method
4102    /// [`Coordinator.AcknowledgeVsync`].  The coordinator may throttle a client
4103    /// that accumulates a certain number of unacknowledged VSync cookies.
4104    /// Throttled clients do not receive VSync events.
4105    ///
4106    /// After a the client catches up on acknowledging cookies, the coordinator
4107    /// will unthrottle it (resume sending VSync events). Throttled clients may
4108    /// miss some VSync events, as the coordinator is allowed to drop VSync
4109    /// event information for throttled clients.
4110    ///
4111    /// When dropping VSync event information for throttled clients, the
4112    /// coordinator should prioritize retaining the information for newer
4113    /// events. In other words, the oldest unreported events should be dropped
4114    /// first.
4115    pub fn r#on_vsync(
4116        &self,
4117        mut display_id: &fidl_fuchsia_hardware_display_types::DisplayId,
4118        mut timestamp: fidl::MonotonicInstant,
4119        mut displayed_config_stamp: &ConfigStamp,
4120        mut cookie: &VsyncAckCookie,
4121    ) -> Result<(), fidl::Error> {
4122        CoordinatorListenerProxyInterface::r#on_vsync(
4123            self,
4124            display_id,
4125            timestamp,
4126            displayed_config_stamp,
4127            cookie,
4128        )
4129    }
4130
4131    /// Called when the corresponding `Coordinator` client gains or loses
4132    /// ownership of the displays.
4133    ///
4134    /// A `Coordinator` client's displayed config is visible iff it holds the
4135    /// ownership of the displays.
4136    ///
4137    /// A new `Coordinator` client should assume they do not have ownership
4138    /// of the displays until this method informs them otherwise.
4139    pub fn r#on_client_ownership_change(&self, mut has_ownership: bool) -> Result<(), fidl::Error> {
4140        CoordinatorListenerProxyInterface::r#on_client_ownership_change(self, has_ownership)
4141    }
4142}
4143
4144impl CoordinatorListenerProxyInterface for CoordinatorListenerProxy {
4145    fn r#on_displays_changed(
4146        &self,
4147        mut added: &[Info],
4148        mut removed: &[fidl_fuchsia_hardware_display_types::DisplayId],
4149    ) -> Result<(), fidl::Error> {
4150        self.client.send::<CoordinatorListenerOnDisplaysChangedRequest>(
4151            (added, removed),
4152            0x248fbe90c338a94f,
4153            fidl::encoding::DynamicFlags::empty(),
4154        )
4155    }
4156
4157    fn r#on_vsync(
4158        &self,
4159        mut display_id: &fidl_fuchsia_hardware_display_types::DisplayId,
4160        mut timestamp: fidl::MonotonicInstant,
4161        mut displayed_config_stamp: &ConfigStamp,
4162        mut cookie: &VsyncAckCookie,
4163    ) -> Result<(), fidl::Error> {
4164        self.client.send::<CoordinatorListenerOnVsyncRequest>(
4165            (display_id, timestamp, displayed_config_stamp, cookie),
4166            0x249e9b8da7a7ac47,
4167            fidl::encoding::DynamicFlags::empty(),
4168        )
4169    }
4170
4171    fn r#on_client_ownership_change(&self, mut has_ownership: bool) -> Result<(), fidl::Error> {
4172        self.client.send::<CoordinatorListenerOnClientOwnershipChangeRequest>(
4173            (has_ownership,),
4174            0x1acd2ae683153d5e,
4175            fidl::encoding::DynamicFlags::empty(),
4176        )
4177    }
4178}
4179
4180pub struct CoordinatorListenerEventStream {
4181    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
4182}
4183
4184impl std::marker::Unpin for CoordinatorListenerEventStream {}
4185
4186impl futures::stream::FusedStream for CoordinatorListenerEventStream {
4187    fn is_terminated(&self) -> bool {
4188        self.event_receiver.is_terminated()
4189    }
4190}
4191
4192impl futures::Stream for CoordinatorListenerEventStream {
4193    type Item = Result<CoordinatorListenerEvent, fidl::Error>;
4194
4195    fn poll_next(
4196        mut self: std::pin::Pin<&mut Self>,
4197        cx: &mut std::task::Context<'_>,
4198    ) -> std::task::Poll<Option<Self::Item>> {
4199        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
4200            &mut self.event_receiver,
4201            cx
4202        )?) {
4203            Some(buf) => std::task::Poll::Ready(Some(CoordinatorListenerEvent::decode(buf))),
4204            None => std::task::Poll::Ready(None),
4205        }
4206    }
4207}
4208
4209#[derive(Debug)]
4210pub enum CoordinatorListenerEvent {
4211    #[non_exhaustive]
4212    _UnknownEvent {
4213        /// Ordinal of the event that was sent.
4214        ordinal: u64,
4215    },
4216}
4217
4218impl CoordinatorListenerEvent {
4219    /// Decodes a message buffer as a [`CoordinatorListenerEvent`].
4220    fn decode(
4221        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
4222    ) -> Result<CoordinatorListenerEvent, fidl::Error> {
4223        let (bytes, _handles) = buf.split_mut();
4224        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
4225        debug_assert_eq!(tx_header.tx_id, 0);
4226        match tx_header.ordinal {
4227            _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
4228                Ok(CoordinatorListenerEvent::_UnknownEvent { ordinal: tx_header.ordinal })
4229            }
4230            _ => Err(fidl::Error::UnknownOrdinal {
4231                ordinal: tx_header.ordinal,
4232                protocol_name:
4233                    <CoordinatorListenerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
4234            }),
4235        }
4236    }
4237}
4238
4239/// A Stream of incoming requests for fuchsia.hardware.display/CoordinatorListener.
4240pub struct CoordinatorListenerRequestStream {
4241    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4242    is_terminated: bool,
4243}
4244
4245impl std::marker::Unpin for CoordinatorListenerRequestStream {}
4246
4247impl futures::stream::FusedStream for CoordinatorListenerRequestStream {
4248    fn is_terminated(&self) -> bool {
4249        self.is_terminated
4250    }
4251}
4252
4253impl fidl::endpoints::RequestStream for CoordinatorListenerRequestStream {
4254    type Protocol = CoordinatorListenerMarker;
4255    type ControlHandle = CoordinatorListenerControlHandle;
4256
4257    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
4258        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
4259    }
4260
4261    fn control_handle(&self) -> Self::ControlHandle {
4262        CoordinatorListenerControlHandle { inner: self.inner.clone() }
4263    }
4264
4265    fn into_inner(
4266        self,
4267    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
4268    {
4269        (self.inner, self.is_terminated)
4270    }
4271
4272    fn from_inner(
4273        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4274        is_terminated: bool,
4275    ) -> Self {
4276        Self { inner, is_terminated }
4277    }
4278}
4279
4280impl futures::Stream for CoordinatorListenerRequestStream {
4281    type Item = Result<CoordinatorListenerRequest, fidl::Error>;
4282
4283    fn poll_next(
4284        mut self: std::pin::Pin<&mut Self>,
4285        cx: &mut std::task::Context<'_>,
4286    ) -> std::task::Poll<Option<Self::Item>> {
4287        let this = &mut *self;
4288        if this.inner.check_shutdown(cx) {
4289            this.is_terminated = true;
4290            return std::task::Poll::Ready(None);
4291        }
4292        if this.is_terminated {
4293            panic!("polled CoordinatorListenerRequestStream after completion");
4294        }
4295        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
4296            |bytes, handles| {
4297                match this.inner.channel().read_etc(cx, bytes, handles) {
4298                    std::task::Poll::Ready(Ok(())) => {}
4299                    std::task::Poll::Pending => return std::task::Poll::Pending,
4300                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
4301                        this.is_terminated = true;
4302                        return std::task::Poll::Ready(None);
4303                    }
4304                    std::task::Poll::Ready(Err(e)) => {
4305                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
4306                            e.into(),
4307                        ))));
4308                    }
4309                }
4310
4311                // A message has been received from the channel
4312                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
4313
4314                std::task::Poll::Ready(Some(match header.ordinal {
4315                0x248fbe90c338a94f => {
4316                    header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4317                    let mut req = fidl::new_empty!(CoordinatorListenerOnDisplaysChangedRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
4318                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CoordinatorListenerOnDisplaysChangedRequest>(&header, _body_bytes, handles, &mut req)?;
4319                    let control_handle = CoordinatorListenerControlHandle {
4320                        inner: this.inner.clone(),
4321                    };
4322                    Ok(CoordinatorListenerRequest::OnDisplaysChanged {added: req.added,
4323removed: req.removed,
4324
4325                        control_handle,
4326                    })
4327                }
4328                0x249e9b8da7a7ac47 => {
4329                    header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4330                    let mut req = fidl::new_empty!(CoordinatorListenerOnVsyncRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
4331                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CoordinatorListenerOnVsyncRequest>(&header, _body_bytes, handles, &mut req)?;
4332                    let control_handle = CoordinatorListenerControlHandle {
4333                        inner: this.inner.clone(),
4334                    };
4335                    Ok(CoordinatorListenerRequest::OnVsync {display_id: req.display_id,
4336timestamp: req.timestamp,
4337displayed_config_stamp: req.displayed_config_stamp,
4338cookie: req.cookie,
4339
4340                        control_handle,
4341                    })
4342                }
4343                0x1acd2ae683153d5e => {
4344                    header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4345                    let mut req = fidl::new_empty!(CoordinatorListenerOnClientOwnershipChangeRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
4346                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CoordinatorListenerOnClientOwnershipChangeRequest>(&header, _body_bytes, handles, &mut req)?;
4347                    let control_handle = CoordinatorListenerControlHandle {
4348                        inner: this.inner.clone(),
4349                    };
4350                    Ok(CoordinatorListenerRequest::OnClientOwnershipChange {has_ownership: req.has_ownership,
4351
4352                        control_handle,
4353                    })
4354                }
4355                _ if header.tx_id == 0 && header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
4356                    Ok(CoordinatorListenerRequest::_UnknownMethod {
4357                        ordinal: header.ordinal,
4358                        control_handle: CoordinatorListenerControlHandle { inner: this.inner.clone() },
4359                        method_type: fidl::MethodType::OneWay,
4360                    })
4361                }
4362                _ if header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
4363                    this.inner.send_framework_err(
4364                        fidl::encoding::FrameworkErr::UnknownMethod,
4365                        header.tx_id,
4366                        header.ordinal,
4367                        header.dynamic_flags(),
4368                        (bytes, handles),
4369                    )?;
4370                    Ok(CoordinatorListenerRequest::_UnknownMethod {
4371                        ordinal: header.ordinal,
4372                        control_handle: CoordinatorListenerControlHandle { inner: this.inner.clone() },
4373                        method_type: fidl::MethodType::TwoWay,
4374                    })
4375                }
4376                _ => Err(fidl::Error::UnknownOrdinal {
4377                    ordinal: header.ordinal,
4378                    protocol_name: <CoordinatorListenerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
4379                }),
4380            }))
4381            },
4382        )
4383    }
4384}
4385
4386/// Provides updates from a `Coordinator` to one of its clients.
4387///
4388/// This protocol solely consists of one-way methods.
4389#[derive(Debug)]
4390pub enum CoordinatorListenerRequest {
4391    /// Called when the set of connected displays changes.
4392    ///
4393    /// Also used to communicate the set of connected displays to a newly
4394    /// connected client.
4395    ///
4396    /// After this method is called, all applied and draft configurations may no
4397    /// longer be valid. The client must validate and apply a new configuration,
4398    /// by calling [`Coordinator.CheckConfig`] and [`Coordinator.CommitConfig`].
4399    ///
4400    /// `added` and `removed` must not be both empty.
4401    OnDisplaysChanged {
4402        added: Vec<Info>,
4403        removed: Vec<fidl_fuchsia_hardware_display_types::DisplayId>,
4404        control_handle: CoordinatorListenerControlHandle,
4405    },
4406    /// Called on every display Vertical Synchronization (Vsync).
4407    ///
4408    /// Clients must acknowledge VSync events via the method
4409    /// [`Coordinator.AcknowledgeVsync`].  The coordinator may throttle a client
4410    /// that accumulates a certain number of unacknowledged VSync cookies.
4411    /// Throttled clients do not receive VSync events.
4412    ///
4413    /// After a the client catches up on acknowledging cookies, the coordinator
4414    /// will unthrottle it (resume sending VSync events). Throttled clients may
4415    /// miss some VSync events, as the coordinator is allowed to drop VSync
4416    /// event information for throttled clients.
4417    ///
4418    /// When dropping VSync event information for throttled clients, the
4419    /// coordinator should prioritize retaining the information for newer
4420    /// events. In other words, the oldest unreported events should be dropped
4421    /// first.
4422    OnVsync {
4423        display_id: fidl_fuchsia_hardware_display_types::DisplayId,
4424        timestamp: fidl::MonotonicInstant,
4425        displayed_config_stamp: ConfigStamp,
4426        cookie: VsyncAckCookie,
4427        control_handle: CoordinatorListenerControlHandle,
4428    },
4429    /// Called when the corresponding `Coordinator` client gains or loses
4430    /// ownership of the displays.
4431    ///
4432    /// A `Coordinator` client's displayed config is visible iff it holds the
4433    /// ownership of the displays.
4434    ///
4435    /// A new `Coordinator` client should assume they do not have ownership
4436    /// of the displays until this method informs them otherwise.
4437    OnClientOwnershipChange {
4438        has_ownership: bool,
4439        control_handle: CoordinatorListenerControlHandle,
4440    },
4441    /// An interaction was received which does not match any known method.
4442    #[non_exhaustive]
4443    _UnknownMethod {
4444        /// Ordinal of the method that was called.
4445        ordinal: u64,
4446        control_handle: CoordinatorListenerControlHandle,
4447        method_type: fidl::MethodType,
4448    },
4449}
4450
4451impl CoordinatorListenerRequest {
4452    #[allow(irrefutable_let_patterns)]
4453    pub fn into_on_displays_changed(
4454        self,
4455    ) -> Option<(
4456        Vec<Info>,
4457        Vec<fidl_fuchsia_hardware_display_types::DisplayId>,
4458        CoordinatorListenerControlHandle,
4459    )> {
4460        if let CoordinatorListenerRequest::OnDisplaysChanged { added, removed, control_handle } =
4461            self
4462        {
4463            Some((added, removed, control_handle))
4464        } else {
4465            None
4466        }
4467    }
4468
4469    #[allow(irrefutable_let_patterns)]
4470    pub fn into_on_vsync(
4471        self,
4472    ) -> Option<(
4473        fidl_fuchsia_hardware_display_types::DisplayId,
4474        fidl::MonotonicInstant,
4475        ConfigStamp,
4476        VsyncAckCookie,
4477        CoordinatorListenerControlHandle,
4478    )> {
4479        if let CoordinatorListenerRequest::OnVsync {
4480            display_id,
4481            timestamp,
4482            displayed_config_stamp,
4483            cookie,
4484            control_handle,
4485        } = self
4486        {
4487            Some((display_id, timestamp, displayed_config_stamp, cookie, control_handle))
4488        } else {
4489            None
4490        }
4491    }
4492
4493    #[allow(irrefutable_let_patterns)]
4494    pub fn into_on_client_ownership_change(
4495        self,
4496    ) -> Option<(bool, CoordinatorListenerControlHandle)> {
4497        if let CoordinatorListenerRequest::OnClientOwnershipChange {
4498            has_ownership,
4499            control_handle,
4500        } = self
4501        {
4502            Some((has_ownership, control_handle))
4503        } else {
4504            None
4505        }
4506    }
4507
4508    /// Name of the method defined in FIDL
4509    pub fn method_name(&self) -> &'static str {
4510        match *self {
4511            CoordinatorListenerRequest::OnDisplaysChanged { .. } => "on_displays_changed",
4512            CoordinatorListenerRequest::OnVsync { .. } => "on_vsync",
4513            CoordinatorListenerRequest::OnClientOwnershipChange { .. } => {
4514                "on_client_ownership_change"
4515            }
4516            CoordinatorListenerRequest::_UnknownMethod {
4517                method_type: fidl::MethodType::OneWay,
4518                ..
4519            } => "unknown one-way method",
4520            CoordinatorListenerRequest::_UnknownMethod {
4521                method_type: fidl::MethodType::TwoWay,
4522                ..
4523            } => "unknown two-way method",
4524        }
4525    }
4526}
4527
4528#[derive(Debug, Clone)]
4529pub struct CoordinatorListenerControlHandle {
4530    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4531}
4532
4533impl CoordinatorListenerControlHandle {
4534    pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
4535        self.inner.shutdown_with_epitaph(status.into())
4536    }
4537}
4538
4539impl fidl::endpoints::ControlHandle for CoordinatorListenerControlHandle {
4540    fn shutdown(&self) {
4541        self.inner.shutdown()
4542    }
4543
4544    fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
4545        self.inner.shutdown_with_epitaph(status)
4546    }
4547
4548    fn is_closed(&self) -> bool {
4549        self.inner.channel().is_closed()
4550    }
4551    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
4552        self.inner.channel().on_closed()
4553    }
4554
4555    #[cfg(target_os = "fuchsia")]
4556    fn signal_peer(
4557        &self,
4558        clear_mask: zx::Signals,
4559        set_mask: zx::Signals,
4560    ) -> Result<(), zx_status::Status> {
4561        use fidl::Peered;
4562        self.inner.channel().signal_peer(clear_mask, set_mask)
4563    }
4564}
4565
4566impl CoordinatorListenerControlHandle {}
4567
4568#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
4569pub struct ProviderMarker;
4570
4571impl fidl::endpoints::ProtocolMarker for ProviderMarker {
4572    type Proxy = ProviderProxy;
4573    type RequestStream = ProviderRequestStream;
4574    #[cfg(target_os = "fuchsia")]
4575    type SynchronousProxy = ProviderSynchronousProxy;
4576
4577    const DEBUG_NAME: &'static str = "fuchsia.hardware.display.Provider";
4578}
4579impl fidl::endpoints::DiscoverableProtocolMarker for ProviderMarker {}
4580pub type ProviderOpenCoordinatorResult = Result<(), i32>;
4581
4582pub trait ProviderProxyInterface: Send + Sync {
4583    type OpenCoordinatorResponseFut: std::future::Future<Output = Result<ProviderOpenCoordinatorResult, fidl::Error>>
4584        + Send;
4585    fn r#open_coordinator(
4586        &self,
4587        payload: ProviderOpenCoordinatorRequest,
4588    ) -> Self::OpenCoordinatorResponseFut;
4589}
4590#[derive(Debug)]
4591#[cfg(target_os = "fuchsia")]
4592pub struct ProviderSynchronousProxy {
4593    client: fidl::client::sync::Client,
4594}
4595
4596#[cfg(target_os = "fuchsia")]
4597impl fidl::endpoints::SynchronousProxy for ProviderSynchronousProxy {
4598    type Proxy = ProviderProxy;
4599    type Protocol = ProviderMarker;
4600
4601    fn from_channel(inner: fidl::Channel) -> Self {
4602        Self::new(inner)
4603    }
4604
4605    fn into_channel(self) -> fidl::Channel {
4606        self.client.into_channel()
4607    }
4608
4609    fn as_channel(&self) -> &fidl::Channel {
4610        self.client.as_channel()
4611    }
4612}
4613
4614#[cfg(target_os = "fuchsia")]
4615impl ProviderSynchronousProxy {
4616    pub fn new(channel: fidl::Channel) -> Self {
4617        Self { client: fidl::client::sync::Client::new(channel) }
4618    }
4619
4620    pub fn into_channel(self) -> fidl::Channel {
4621        self.client.into_channel()
4622    }
4623
4624    /// Waits until an event arrives and returns it. It is safe for other
4625    /// threads to make concurrent requests while waiting for an event.
4626    pub fn wait_for_event(
4627        &self,
4628        deadline: zx::MonotonicInstant,
4629    ) -> Result<ProviderEvent, fidl::Error> {
4630        ProviderEvent::decode(self.client.wait_for_event::<ProviderMarker>(deadline)?)
4631    }
4632
4633    /// Opens a client connection to the Display Coordinator.
4634    ///
4635    /// On success, `coordinator` will be bound to the Display Coordinator
4636    /// at the requested priority level, and `coordinator_listener` will receive
4637    /// notifications for the newly bound client.
4638    ///
4639    /// Fails with `ZX_ERR_ALREADY_BOUND` if the Display Coordinator already has
4640    /// a connected client at the given priority level.
4641    ///
4642    /// Fails with `ZX_ERR_INVALID_ARGS` if one of the required fields is missing.
4643    pub fn r#open_coordinator(
4644        &self,
4645        mut payload: ProviderOpenCoordinatorRequest,
4646        ___deadline: zx::MonotonicInstant,
4647    ) -> Result<ProviderOpenCoordinatorResult, fidl::Error> {
4648        let _response = self.client.send_query::<
4649            ProviderOpenCoordinatorRequest,
4650            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
4651            ProviderMarker,
4652        >(
4653            &mut payload,
4654            0x1bd6070372d03df0,
4655            fidl::encoding::DynamicFlags::empty(),
4656            ___deadline,
4657        )?;
4658        Ok(_response.map(|x| x))
4659    }
4660}
4661
4662#[cfg(target_os = "fuchsia")]
4663impl From<ProviderSynchronousProxy> for zx::NullableHandle {
4664    fn from(value: ProviderSynchronousProxy) -> Self {
4665        value.into_channel().into()
4666    }
4667}
4668
4669#[cfg(target_os = "fuchsia")]
4670impl From<fidl::Channel> for ProviderSynchronousProxy {
4671    fn from(value: fidl::Channel) -> Self {
4672        Self::new(value)
4673    }
4674}
4675
4676#[cfg(target_os = "fuchsia")]
4677impl fidl::endpoints::FromClient for ProviderSynchronousProxy {
4678    type Protocol = ProviderMarker;
4679
4680    fn from_client(value: fidl::endpoints::ClientEnd<ProviderMarker>) -> Self {
4681        Self::new(value.into_channel())
4682    }
4683}
4684
4685#[derive(Debug, Clone)]
4686pub struct ProviderProxy {
4687    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
4688}
4689
4690impl fidl::endpoints::Proxy for ProviderProxy {
4691    type Protocol = ProviderMarker;
4692
4693    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
4694        Self::new(inner)
4695    }
4696
4697    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
4698        self.client.into_channel().map_err(|client| Self { client })
4699    }
4700
4701    fn as_channel(&self) -> &::fidl::AsyncChannel {
4702        self.client.as_channel()
4703    }
4704}
4705
4706impl ProviderProxy {
4707    /// Create a new Proxy for fuchsia.hardware.display/Provider.
4708    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
4709        let protocol_name = <ProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
4710        Self { client: fidl::client::Client::new(channel, protocol_name) }
4711    }
4712
4713    /// Get a Stream of events from the remote end of the protocol.
4714    ///
4715    /// # Panics
4716    ///
4717    /// Panics if the event stream was already taken.
4718    pub fn take_event_stream(&self) -> ProviderEventStream {
4719        ProviderEventStream { event_receiver: self.client.take_event_receiver() }
4720    }
4721
4722    /// Opens a client connection to the Display Coordinator.
4723    ///
4724    /// On success, `coordinator` will be bound to the Display Coordinator
4725    /// at the requested priority level, and `coordinator_listener` will receive
4726    /// notifications for the newly bound client.
4727    ///
4728    /// Fails with `ZX_ERR_ALREADY_BOUND` if the Display Coordinator already has
4729    /// a connected client at the given priority level.
4730    ///
4731    /// Fails with `ZX_ERR_INVALID_ARGS` if one of the required fields is missing.
4732    pub fn r#open_coordinator(
4733        &self,
4734        mut payload: ProviderOpenCoordinatorRequest,
4735    ) -> fidl::client::QueryResponseFut<
4736        ProviderOpenCoordinatorResult,
4737        fidl::encoding::DefaultFuchsiaResourceDialect,
4738    > {
4739        ProviderProxyInterface::r#open_coordinator(self, payload)
4740    }
4741}
4742
4743impl ProviderProxyInterface for ProviderProxy {
4744    type OpenCoordinatorResponseFut = fidl::client::QueryResponseFut<
4745        ProviderOpenCoordinatorResult,
4746        fidl::encoding::DefaultFuchsiaResourceDialect,
4747    >;
4748    fn r#open_coordinator(
4749        &self,
4750        mut payload: ProviderOpenCoordinatorRequest,
4751    ) -> Self::OpenCoordinatorResponseFut {
4752        fn _decode(
4753            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
4754        ) -> Result<ProviderOpenCoordinatorResult, fidl::Error> {
4755            let _response = fidl::client::decode_transaction_body::<
4756                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
4757                fidl::encoding::DefaultFuchsiaResourceDialect,
4758                0x1bd6070372d03df0,
4759            >(_buf?)?;
4760            Ok(_response.map(|x| x))
4761        }
4762        self.client
4763            .send_query_and_decode::<ProviderOpenCoordinatorRequest, ProviderOpenCoordinatorResult>(
4764                &mut payload,
4765                0x1bd6070372d03df0,
4766                fidl::encoding::DynamicFlags::empty(),
4767                _decode,
4768            )
4769    }
4770}
4771
4772pub struct ProviderEventStream {
4773    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
4774}
4775
4776impl std::marker::Unpin for ProviderEventStream {}
4777
4778impl futures::stream::FusedStream for ProviderEventStream {
4779    fn is_terminated(&self) -> bool {
4780        self.event_receiver.is_terminated()
4781    }
4782}
4783
4784impl futures::Stream for ProviderEventStream {
4785    type Item = Result<ProviderEvent, fidl::Error>;
4786
4787    fn poll_next(
4788        mut self: std::pin::Pin<&mut Self>,
4789        cx: &mut std::task::Context<'_>,
4790    ) -> std::task::Poll<Option<Self::Item>> {
4791        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
4792            &mut self.event_receiver,
4793            cx
4794        )?) {
4795            Some(buf) => std::task::Poll::Ready(Some(ProviderEvent::decode(buf))),
4796            None => std::task::Poll::Ready(None),
4797        }
4798    }
4799}
4800
4801#[derive(Debug)]
4802pub enum ProviderEvent {}
4803
4804impl ProviderEvent {
4805    /// Decodes a message buffer as a [`ProviderEvent`].
4806    fn decode(
4807        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
4808    ) -> Result<ProviderEvent, fidl::Error> {
4809        let (bytes, _handles) = buf.split_mut();
4810        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
4811        debug_assert_eq!(tx_header.tx_id, 0);
4812        match tx_header.ordinal {
4813            _ => Err(fidl::Error::UnknownOrdinal {
4814                ordinal: tx_header.ordinal,
4815                protocol_name: <ProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
4816            }),
4817        }
4818    }
4819}
4820
4821/// A Stream of incoming requests for fuchsia.hardware.display/Provider.
4822pub struct ProviderRequestStream {
4823    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4824    is_terminated: bool,
4825}
4826
4827impl std::marker::Unpin for ProviderRequestStream {}
4828
4829impl futures::stream::FusedStream for ProviderRequestStream {
4830    fn is_terminated(&self) -> bool {
4831        self.is_terminated
4832    }
4833}
4834
4835impl fidl::endpoints::RequestStream for ProviderRequestStream {
4836    type Protocol = ProviderMarker;
4837    type ControlHandle = ProviderControlHandle;
4838
4839    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
4840        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
4841    }
4842
4843    fn control_handle(&self) -> Self::ControlHandle {
4844        ProviderControlHandle { inner: self.inner.clone() }
4845    }
4846
4847    fn into_inner(
4848        self,
4849    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
4850    {
4851        (self.inner, self.is_terminated)
4852    }
4853
4854    fn from_inner(
4855        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4856        is_terminated: bool,
4857    ) -> Self {
4858        Self { inner, is_terminated }
4859    }
4860}
4861
4862impl futures::Stream for ProviderRequestStream {
4863    type Item = Result<ProviderRequest, fidl::Error>;
4864
4865    fn poll_next(
4866        mut self: std::pin::Pin<&mut Self>,
4867        cx: &mut std::task::Context<'_>,
4868    ) -> std::task::Poll<Option<Self::Item>> {
4869        let this = &mut *self;
4870        if this.inner.check_shutdown(cx) {
4871            this.is_terminated = true;
4872            return std::task::Poll::Ready(None);
4873        }
4874        if this.is_terminated {
4875            panic!("polled ProviderRequestStream after completion");
4876        }
4877        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
4878            |bytes, handles| {
4879                match this.inner.channel().read_etc(cx, bytes, handles) {
4880                    std::task::Poll::Ready(Ok(())) => {}
4881                    std::task::Poll::Pending => return std::task::Poll::Pending,
4882                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
4883                        this.is_terminated = true;
4884                        return std::task::Poll::Ready(None);
4885                    }
4886                    std::task::Poll::Ready(Err(e)) => {
4887                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
4888                            e.into(),
4889                        ))));
4890                    }
4891                }
4892
4893                // A message has been received from the channel
4894                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
4895
4896                std::task::Poll::Ready(Some(match header.ordinal {
4897                    0x1bd6070372d03df0 => {
4898                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4899                        let mut req = fidl::new_empty!(
4900                            ProviderOpenCoordinatorRequest,
4901                            fidl::encoding::DefaultFuchsiaResourceDialect
4902                        );
4903                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ProviderOpenCoordinatorRequest>(&header, _body_bytes, handles, &mut req)?;
4904                        let control_handle = ProviderControlHandle { inner: this.inner.clone() };
4905                        Ok(ProviderRequest::OpenCoordinator {
4906                            payload: req,
4907                            responder: ProviderOpenCoordinatorResponder {
4908                                control_handle: std::mem::ManuallyDrop::new(control_handle),
4909                                tx_id: header.tx_id,
4910                            },
4911                        })
4912                    }
4913                    _ => Err(fidl::Error::UnknownOrdinal {
4914                        ordinal: header.ordinal,
4915                        protocol_name:
4916                            <ProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
4917                    }),
4918                }))
4919            },
4920        )
4921    }
4922}
4923
4924/// Provider for display coordinators.
4925///
4926/// The driver supports two simultaneous clients - a main client and a virtcon
4927/// client.  In some cases, the provider service may provide access to only one or
4928/// the other; if the client tries to open the other then `ZX_ERR_NOT_SUPPORTED` will
4929/// be returned.
4930#[derive(Debug)]
4931pub enum ProviderRequest {
4932    /// Opens a client connection to the Display Coordinator.
4933    ///
4934    /// On success, `coordinator` will be bound to the Display Coordinator
4935    /// at the requested priority level, and `coordinator_listener` will receive
4936    /// notifications for the newly bound client.
4937    ///
4938    /// Fails with `ZX_ERR_ALREADY_BOUND` if the Display Coordinator already has
4939    /// a connected client at the given priority level.
4940    ///
4941    /// Fails with `ZX_ERR_INVALID_ARGS` if one of the required fields is missing.
4942    OpenCoordinator {
4943        payload: ProviderOpenCoordinatorRequest,
4944        responder: ProviderOpenCoordinatorResponder,
4945    },
4946}
4947
4948impl ProviderRequest {
4949    #[allow(irrefutable_let_patterns)]
4950    pub fn into_open_coordinator(
4951        self,
4952    ) -> Option<(ProviderOpenCoordinatorRequest, ProviderOpenCoordinatorResponder)> {
4953        if let ProviderRequest::OpenCoordinator { payload, responder } = self {
4954            Some((payload, responder))
4955        } else {
4956            None
4957        }
4958    }
4959
4960    /// Name of the method defined in FIDL
4961    pub fn method_name(&self) -> &'static str {
4962        match *self {
4963            ProviderRequest::OpenCoordinator { .. } => "open_coordinator",
4964        }
4965    }
4966}
4967
4968#[derive(Debug, Clone)]
4969pub struct ProviderControlHandle {
4970    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4971}
4972
4973impl ProviderControlHandle {
4974    pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
4975        self.inner.shutdown_with_epitaph(status.into())
4976    }
4977}
4978
4979impl fidl::endpoints::ControlHandle for ProviderControlHandle {
4980    fn shutdown(&self) {
4981        self.inner.shutdown()
4982    }
4983
4984    fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
4985        self.inner.shutdown_with_epitaph(status)
4986    }
4987
4988    fn is_closed(&self) -> bool {
4989        self.inner.channel().is_closed()
4990    }
4991    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
4992        self.inner.channel().on_closed()
4993    }
4994
4995    #[cfg(target_os = "fuchsia")]
4996    fn signal_peer(
4997        &self,
4998        clear_mask: zx::Signals,
4999        set_mask: zx::Signals,
5000    ) -> Result<(), zx_status::Status> {
5001        use fidl::Peered;
5002        self.inner.channel().signal_peer(clear_mask, set_mask)
5003    }
5004}
5005
5006impl ProviderControlHandle {}
5007
5008#[must_use = "FIDL methods require a response to be sent"]
5009#[derive(Debug)]
5010pub struct ProviderOpenCoordinatorResponder {
5011    control_handle: std::mem::ManuallyDrop<ProviderControlHandle>,
5012    tx_id: u32,
5013}
5014
5015/// Set the the channel to be shutdown (see [`ProviderControlHandle::shutdown`])
5016/// if the responder is dropped without sending a response, so that the client
5017/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
5018impl std::ops::Drop for ProviderOpenCoordinatorResponder {
5019    fn drop(&mut self) {
5020        self.control_handle.shutdown();
5021        // Safety: drops once, never accessed again
5022        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5023    }
5024}
5025
5026impl fidl::endpoints::Responder for ProviderOpenCoordinatorResponder {
5027    type ControlHandle = ProviderControlHandle;
5028
5029    fn control_handle(&self) -> &ProviderControlHandle {
5030        &self.control_handle
5031    }
5032
5033    fn drop_without_shutdown(mut self) {
5034        // Safety: drops once, never accessed again due to mem::forget
5035        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5036        // Prevent Drop from running (which would shut down the channel)
5037        std::mem::forget(self);
5038    }
5039}
5040
5041impl ProviderOpenCoordinatorResponder {
5042    /// Sends a response to the FIDL transaction.
5043    ///
5044    /// Sets the channel to shutdown if an error occurs.
5045    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
5046        let _result = self.send_raw(result);
5047        if _result.is_err() {
5048            self.control_handle.shutdown();
5049        }
5050        self.drop_without_shutdown();
5051        _result
5052    }
5053
5054    /// Similar to "send" but does not shutdown the channel if an error occurs.
5055    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
5056        let _result = self.send_raw(result);
5057        self.drop_without_shutdown();
5058        _result
5059    }
5060
5061    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
5062        self.control_handle
5063            .inner
5064            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
5065                result,
5066                self.tx_id,
5067                0x1bd6070372d03df0,
5068                fidl::encoding::DynamicFlags::empty(),
5069            )
5070    }
5071}
5072
5073#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
5074pub struct ServiceMarker;
5075
5076#[cfg(target_os = "fuchsia")]
5077impl fidl::endpoints::ServiceMarker for ServiceMarker {
5078    type Proxy = ServiceProxy;
5079    type Request = ServiceRequest;
5080    const SERVICE_NAME: &'static str = "fuchsia.hardware.display.Service";
5081}
5082
5083/// A request for one of the member protocols of Service.
5084///
5085#[cfg(target_os = "fuchsia")]
5086pub enum ServiceRequest {
5087    Provider(ProviderRequestStream),
5088}
5089
5090#[cfg(target_os = "fuchsia")]
5091impl fidl::endpoints::ServiceRequest for ServiceRequest {
5092    type Service = ServiceMarker;
5093
5094    fn dispatch(name: &str, _channel: fidl::AsyncChannel) -> Self {
5095        match name {
5096            "provider" => Self::Provider(
5097                <ProviderRequestStream as fidl::endpoints::RequestStream>::from_channel(_channel),
5098            ),
5099            _ => panic!("no such member protocol name for service Service"),
5100        }
5101    }
5102
5103    fn member_names() -> &'static [&'static str] {
5104        &["provider"]
5105    }
5106}
5107#[cfg(target_os = "fuchsia")]
5108pub struct ServiceProxy(#[allow(dead_code)] Box<dyn fidl::endpoints::MemberOpener>);
5109
5110#[cfg(target_os = "fuchsia")]
5111impl fidl::endpoints::ServiceProxy for ServiceProxy {
5112    type Service = ServiceMarker;
5113
5114    fn from_member_opener(opener: Box<dyn fidl::endpoints::MemberOpener>) -> Self {
5115        Self(opener)
5116    }
5117}
5118
5119#[cfg(target_os = "fuchsia")]
5120impl ServiceProxy {
5121    pub fn connect_to_provider(&self) -> Result<ProviderProxy, fidl::Error> {
5122        let (proxy, server_end) = fidl::endpoints::create_proxy::<ProviderMarker>();
5123        self.connect_channel_to_provider(server_end)?;
5124        Ok(proxy)
5125    }
5126
5127    /// Like `connect_to_provider`, but returns a sync proxy.
5128    /// See [`Self::connect_to_provider`] for more details.
5129    pub fn connect_to_provider_sync(&self) -> Result<ProviderSynchronousProxy, fidl::Error> {
5130        let (proxy, server_end) = fidl::endpoints::create_sync_proxy::<ProviderMarker>();
5131        self.connect_channel_to_provider(server_end)?;
5132        Ok(proxy)
5133    }
5134
5135    /// Like `connect_to_provider`, but accepts a server end.
5136    /// See [`Self::connect_to_provider`] for more details.
5137    pub fn connect_channel_to_provider(
5138        &self,
5139        server_end: fidl::endpoints::ServerEnd<ProviderMarker>,
5140    ) -> Result<(), fidl::Error> {
5141        self.0.open_member("provider", server_end.into_channel())
5142    }
5143
5144    pub fn instance_name(&self) -> &str {
5145        self.0.instance_name()
5146    }
5147}
5148
5149mod internal {
5150    use super::*;
5151
5152    impl fidl::encoding::ResourceTypeMarker for CoordinatorImportBufferCollectionRequest {
5153        type Borrowed<'a> = &'a mut Self;
5154        fn take_or_borrow<'a>(
5155            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
5156        ) -> Self::Borrowed<'a> {
5157            value
5158        }
5159    }
5160
5161    unsafe impl fidl::encoding::TypeMarker for CoordinatorImportBufferCollectionRequest {
5162        type Owned = Self;
5163
5164        #[inline(always)]
5165        fn inline_align(_context: fidl::encoding::Context) -> usize {
5166            8
5167        }
5168
5169        #[inline(always)]
5170        fn inline_size(_context: fidl::encoding::Context) -> usize {
5171            16
5172        }
5173    }
5174
5175    unsafe impl
5176        fidl::encoding::Encode<
5177            CoordinatorImportBufferCollectionRequest,
5178            fidl::encoding::DefaultFuchsiaResourceDialect,
5179        > for &mut CoordinatorImportBufferCollectionRequest
5180    {
5181        #[inline]
5182        unsafe fn encode(
5183            self,
5184            encoder: &mut fidl::encoding::Encoder<
5185                '_,
5186                fidl::encoding::DefaultFuchsiaResourceDialect,
5187            >,
5188            offset: usize,
5189            _depth: fidl::encoding::Depth,
5190        ) -> fidl::Result<()> {
5191            encoder.debug_check_bounds::<CoordinatorImportBufferCollectionRequest>(offset);
5192            // Delegate to tuple encoding.
5193            fidl::encoding::Encode::<
5194                CoordinatorImportBufferCollectionRequest,
5195                fidl::encoding::DefaultFuchsiaResourceDialect,
5196            >::encode(
5197                (
5198                    <BufferCollectionId as fidl::encoding::ValueTypeMarker>::borrow(
5199                        &self.buffer_collection_id,
5200                    ),
5201                    <fidl::encoding::Endpoint<
5202                        fidl::endpoints::ClientEnd<
5203                            fidl_fuchsia_sysmem2::BufferCollectionTokenMarker,
5204                        >,
5205                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
5206                        &mut self.buffer_collection_token,
5207                    ),
5208                ),
5209                encoder,
5210                offset,
5211                _depth,
5212            )
5213        }
5214    }
5215    unsafe impl<
5216        T0: fidl::encoding::Encode<BufferCollectionId, fidl::encoding::DefaultFuchsiaResourceDialect>,
5217        T1: fidl::encoding::Encode<
5218                fidl::encoding::Endpoint<
5219                    fidl::endpoints::ClientEnd<fidl_fuchsia_sysmem2::BufferCollectionTokenMarker>,
5220                >,
5221                fidl::encoding::DefaultFuchsiaResourceDialect,
5222            >,
5223    >
5224        fidl::encoding::Encode<
5225            CoordinatorImportBufferCollectionRequest,
5226            fidl::encoding::DefaultFuchsiaResourceDialect,
5227        > for (T0, T1)
5228    {
5229        #[inline]
5230        unsafe fn encode(
5231            self,
5232            encoder: &mut fidl::encoding::Encoder<
5233                '_,
5234                fidl::encoding::DefaultFuchsiaResourceDialect,
5235            >,
5236            offset: usize,
5237            depth: fidl::encoding::Depth,
5238        ) -> fidl::Result<()> {
5239            encoder.debug_check_bounds::<CoordinatorImportBufferCollectionRequest>(offset);
5240            // Zero out padding regions. There's no need to apply masks
5241            // because the unmasked parts will be overwritten by fields.
5242            unsafe {
5243                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(8);
5244                (ptr as *mut u64).write_unaligned(0);
5245            }
5246            // Write the fields.
5247            self.0.encode(encoder, offset + 0, depth)?;
5248            self.1.encode(encoder, offset + 8, depth)?;
5249            Ok(())
5250        }
5251    }
5252
5253    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
5254        for CoordinatorImportBufferCollectionRequest
5255    {
5256        #[inline(always)]
5257        fn new_empty() -> Self {
5258            Self {
5259                buffer_collection_id: fidl::new_empty!(
5260                    BufferCollectionId,
5261                    fidl::encoding::DefaultFuchsiaResourceDialect
5262                ),
5263                buffer_collection_token: fidl::new_empty!(
5264                    fidl::encoding::Endpoint<
5265                        fidl::endpoints::ClientEnd<
5266                            fidl_fuchsia_sysmem2::BufferCollectionTokenMarker,
5267                        >,
5268                    >,
5269                    fidl::encoding::DefaultFuchsiaResourceDialect
5270                ),
5271            }
5272        }
5273
5274        #[inline]
5275        unsafe fn decode(
5276            &mut self,
5277            decoder: &mut fidl::encoding::Decoder<
5278                '_,
5279                fidl::encoding::DefaultFuchsiaResourceDialect,
5280            >,
5281            offset: usize,
5282            _depth: fidl::encoding::Depth,
5283        ) -> fidl::Result<()> {
5284            decoder.debug_check_bounds::<Self>(offset);
5285            // Verify that padding bytes are zero.
5286            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(8) };
5287            let padval = unsafe { (ptr as *const u64).read_unaligned() };
5288            let mask = 0xffffffff00000000u64;
5289            let maskedval = padval & mask;
5290            if maskedval != 0 {
5291                return Err(fidl::Error::NonZeroPadding {
5292                    padding_start: offset + 8 + ((mask as u64).trailing_zeros() / 8) as usize,
5293                });
5294            }
5295            fidl::decode!(
5296                BufferCollectionId,
5297                fidl::encoding::DefaultFuchsiaResourceDialect,
5298                &mut self.buffer_collection_id,
5299                decoder,
5300                offset + 0,
5301                _depth
5302            )?;
5303            fidl::decode!(
5304                fidl::encoding::Endpoint<
5305                    fidl::endpoints::ClientEnd<fidl_fuchsia_sysmem2::BufferCollectionTokenMarker>,
5306                >,
5307                fidl::encoding::DefaultFuchsiaResourceDialect,
5308                &mut self.buffer_collection_token,
5309                decoder,
5310                offset + 8,
5311                _depth
5312            )?;
5313            Ok(())
5314        }
5315    }
5316
5317    impl fidl::encoding::ResourceTypeMarker for CoordinatorImportEventRequest {
5318        type Borrowed<'a> = &'a mut Self;
5319        fn take_or_borrow<'a>(
5320            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
5321        ) -> Self::Borrowed<'a> {
5322            value
5323        }
5324    }
5325
5326    unsafe impl fidl::encoding::TypeMarker for CoordinatorImportEventRequest {
5327        type Owned = Self;
5328
5329        #[inline(always)]
5330        fn inline_align(_context: fidl::encoding::Context) -> usize {
5331            8
5332        }
5333
5334        #[inline(always)]
5335        fn inline_size(_context: fidl::encoding::Context) -> usize {
5336            16
5337        }
5338    }
5339
5340    unsafe impl
5341        fidl::encoding::Encode<
5342            CoordinatorImportEventRequest,
5343            fidl::encoding::DefaultFuchsiaResourceDialect,
5344        > for &mut CoordinatorImportEventRequest
5345    {
5346        #[inline]
5347        unsafe fn encode(
5348            self,
5349            encoder: &mut fidl::encoding::Encoder<
5350                '_,
5351                fidl::encoding::DefaultFuchsiaResourceDialect,
5352            >,
5353            offset: usize,
5354            _depth: fidl::encoding::Depth,
5355        ) -> fidl::Result<()> {
5356            encoder.debug_check_bounds::<CoordinatorImportEventRequest>(offset);
5357            // Delegate to tuple encoding.
5358            fidl::encoding::Encode::<
5359                CoordinatorImportEventRequest,
5360                fidl::encoding::DefaultFuchsiaResourceDialect,
5361            >::encode(
5362                (
5363                    <fidl::encoding::HandleType<
5364                        fidl::Event,
5365                        { fidl::ObjectType::EVENT.into_raw() },
5366                        2147483648,
5367                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
5368                        &mut self.event
5369                    ),
5370                    <EventId as fidl::encoding::ValueTypeMarker>::borrow(&self.id),
5371                ),
5372                encoder,
5373                offset,
5374                _depth,
5375            )
5376        }
5377    }
5378    unsafe impl<
5379        T0: fidl::encoding::Encode<
5380                fidl::encoding::HandleType<
5381                    fidl::Event,
5382                    { fidl::ObjectType::EVENT.into_raw() },
5383                    2147483648,
5384                >,
5385                fidl::encoding::DefaultFuchsiaResourceDialect,
5386            >,
5387        T1: fidl::encoding::Encode<EventId, fidl::encoding::DefaultFuchsiaResourceDialect>,
5388    >
5389        fidl::encoding::Encode<
5390            CoordinatorImportEventRequest,
5391            fidl::encoding::DefaultFuchsiaResourceDialect,
5392        > for (T0, T1)
5393    {
5394        #[inline]
5395        unsafe fn encode(
5396            self,
5397            encoder: &mut fidl::encoding::Encoder<
5398                '_,
5399                fidl::encoding::DefaultFuchsiaResourceDialect,
5400            >,
5401            offset: usize,
5402            depth: fidl::encoding::Depth,
5403        ) -> fidl::Result<()> {
5404            encoder.debug_check_bounds::<CoordinatorImportEventRequest>(offset);
5405            // Zero out padding regions. There's no need to apply masks
5406            // because the unmasked parts will be overwritten by fields.
5407            unsafe {
5408                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
5409                (ptr as *mut u64).write_unaligned(0);
5410            }
5411            // Write the fields.
5412            self.0.encode(encoder, offset + 0, depth)?;
5413            self.1.encode(encoder, offset + 8, depth)?;
5414            Ok(())
5415        }
5416    }
5417
5418    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
5419        for CoordinatorImportEventRequest
5420    {
5421        #[inline(always)]
5422        fn new_empty() -> Self {
5423            Self {
5424                event: fidl::new_empty!(fidl::encoding::HandleType<fidl::Event, { fidl::ObjectType::EVENT.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
5425                id: fidl::new_empty!(EventId, fidl::encoding::DefaultFuchsiaResourceDialect),
5426            }
5427        }
5428
5429        #[inline]
5430        unsafe fn decode(
5431            &mut self,
5432            decoder: &mut fidl::encoding::Decoder<
5433                '_,
5434                fidl::encoding::DefaultFuchsiaResourceDialect,
5435            >,
5436            offset: usize,
5437            _depth: fidl::encoding::Depth,
5438        ) -> fidl::Result<()> {
5439            decoder.debug_check_bounds::<Self>(offset);
5440            // Verify that padding bytes are zero.
5441            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
5442            let padval = unsafe { (ptr as *const u64).read_unaligned() };
5443            let mask = 0xffffffff00000000u64;
5444            let maskedval = padval & mask;
5445            if maskedval != 0 {
5446                return Err(fidl::Error::NonZeroPadding {
5447                    padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
5448                });
5449            }
5450            fidl::decode!(fidl::encoding::HandleType<fidl::Event, { fidl::ObjectType::EVENT.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.event, decoder, offset + 0, _depth)?;
5451            fidl::decode!(
5452                EventId,
5453                fidl::encoding::DefaultFuchsiaResourceDialect,
5454                &mut self.id,
5455                decoder,
5456                offset + 8,
5457                _depth
5458            )?;
5459            Ok(())
5460        }
5461    }
5462
5463    impl CoordinatorCommitConfigRequest {
5464        #[inline(always)]
5465        fn max_ordinal_present(&self) -> u64 {
5466            if let Some(_) = self.stamp {
5467                return 1;
5468            }
5469            0
5470        }
5471    }
5472
5473    impl fidl::encoding::ResourceTypeMarker for CoordinatorCommitConfigRequest {
5474        type Borrowed<'a> = &'a mut Self;
5475        fn take_or_borrow<'a>(
5476            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
5477        ) -> Self::Borrowed<'a> {
5478            value
5479        }
5480    }
5481
5482    unsafe impl fidl::encoding::TypeMarker for CoordinatorCommitConfigRequest {
5483        type Owned = Self;
5484
5485        #[inline(always)]
5486        fn inline_align(_context: fidl::encoding::Context) -> usize {
5487            8
5488        }
5489
5490        #[inline(always)]
5491        fn inline_size(_context: fidl::encoding::Context) -> usize {
5492            16
5493        }
5494    }
5495
5496    unsafe impl
5497        fidl::encoding::Encode<
5498            CoordinatorCommitConfigRequest,
5499            fidl::encoding::DefaultFuchsiaResourceDialect,
5500        > for &mut CoordinatorCommitConfigRequest
5501    {
5502        unsafe fn encode(
5503            self,
5504            encoder: &mut fidl::encoding::Encoder<
5505                '_,
5506                fidl::encoding::DefaultFuchsiaResourceDialect,
5507            >,
5508            offset: usize,
5509            mut depth: fidl::encoding::Depth,
5510        ) -> fidl::Result<()> {
5511            encoder.debug_check_bounds::<CoordinatorCommitConfigRequest>(offset);
5512            // Vector header
5513            let max_ordinal: u64 = self.max_ordinal_present();
5514            encoder.write_num(max_ordinal, offset);
5515            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
5516            // Calling encoder.out_of_line_offset(0) is not allowed.
5517            if max_ordinal == 0 {
5518                return Ok(());
5519            }
5520            depth.increment()?;
5521            let envelope_size = 8;
5522            let bytes_len = max_ordinal as usize * envelope_size;
5523            #[allow(unused_variables)]
5524            let offset = encoder.out_of_line_offset(bytes_len);
5525            let mut _prev_end_offset: usize = 0;
5526            if 1 > max_ordinal {
5527                return Ok(());
5528            }
5529
5530            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
5531            // are envelope_size bytes.
5532            let cur_offset: usize = (1 - 1) * envelope_size;
5533
5534            // Zero reserved fields.
5535            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5536
5537            // Safety:
5538            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
5539            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
5540            //   envelope_size bytes, there is always sufficient room.
5541            fidl::encoding::encode_in_envelope_optional::<
5542                ConfigStamp,
5543                fidl::encoding::DefaultFuchsiaResourceDialect,
5544            >(
5545                self.stamp.as_ref().map(<ConfigStamp as fidl::encoding::ValueTypeMarker>::borrow),
5546                encoder,
5547                offset + cur_offset,
5548                depth,
5549            )?;
5550
5551            _prev_end_offset = cur_offset + envelope_size;
5552
5553            Ok(())
5554        }
5555    }
5556
5557    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
5558        for CoordinatorCommitConfigRequest
5559    {
5560        #[inline(always)]
5561        fn new_empty() -> Self {
5562            Self::default()
5563        }
5564
5565        unsafe fn decode(
5566            &mut self,
5567            decoder: &mut fidl::encoding::Decoder<
5568                '_,
5569                fidl::encoding::DefaultFuchsiaResourceDialect,
5570            >,
5571            offset: usize,
5572            mut depth: fidl::encoding::Depth,
5573        ) -> fidl::Result<()> {
5574            decoder.debug_check_bounds::<Self>(offset);
5575            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
5576                None => return Err(fidl::Error::NotNullable),
5577                Some(len) => len,
5578            };
5579            // Calling decoder.out_of_line_offset(0) is not allowed.
5580            if len == 0 {
5581                return Ok(());
5582            };
5583            depth.increment()?;
5584            let envelope_size = 8;
5585            let bytes_len = len * envelope_size;
5586            let offset = decoder.out_of_line_offset(bytes_len)?;
5587            // Decode the envelope for each type.
5588            let mut _next_ordinal_to_read = 0;
5589            let mut next_offset = offset;
5590            let end_offset = offset + bytes_len;
5591            _next_ordinal_to_read += 1;
5592            if next_offset >= end_offset {
5593                return Ok(());
5594            }
5595
5596            // Decode unknown envelopes for gaps in ordinals.
5597            while _next_ordinal_to_read < 1 {
5598                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5599                _next_ordinal_to_read += 1;
5600                next_offset += envelope_size;
5601            }
5602
5603            let next_out_of_line = decoder.next_out_of_line();
5604            let handles_before = decoder.remaining_handles();
5605            if let Some((inlined, num_bytes, num_handles)) =
5606                fidl::encoding::decode_envelope_header(decoder, next_offset)?
5607            {
5608                let member_inline_size =
5609                    <ConfigStamp as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5610                if inlined != (member_inline_size <= 4) {
5611                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
5612                }
5613                let inner_offset;
5614                let mut inner_depth = depth.clone();
5615                if inlined {
5616                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5617                    inner_offset = next_offset;
5618                } else {
5619                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5620                    inner_depth.increment()?;
5621                }
5622                let val_ref = self.stamp.get_or_insert_with(|| {
5623                    fidl::new_empty!(ConfigStamp, fidl::encoding::DefaultFuchsiaResourceDialect)
5624                });
5625                fidl::decode!(
5626                    ConfigStamp,
5627                    fidl::encoding::DefaultFuchsiaResourceDialect,
5628                    val_ref,
5629                    decoder,
5630                    inner_offset,
5631                    inner_depth
5632                )?;
5633                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5634                {
5635                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
5636                }
5637                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5638                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5639                }
5640            }
5641
5642            next_offset += envelope_size;
5643
5644            // Decode the remaining unknown envelopes.
5645            while next_offset < end_offset {
5646                _next_ordinal_to_read += 1;
5647                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5648                next_offset += envelope_size;
5649            }
5650
5651            Ok(())
5652        }
5653    }
5654
5655    impl ProviderOpenCoordinatorRequest {
5656        #[inline(always)]
5657        fn max_ordinal_present(&self) -> u64 {
5658            if let Some(_) = self.priority {
5659                return 3;
5660            }
5661            if let Some(_) = self.coordinator_listener {
5662                return 2;
5663            }
5664            if let Some(_) = self.coordinator {
5665                return 1;
5666            }
5667            0
5668        }
5669    }
5670
5671    impl fidl::encoding::ResourceTypeMarker for ProviderOpenCoordinatorRequest {
5672        type Borrowed<'a> = &'a mut Self;
5673        fn take_or_borrow<'a>(
5674            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
5675        ) -> Self::Borrowed<'a> {
5676            value
5677        }
5678    }
5679
5680    unsafe impl fidl::encoding::TypeMarker for ProviderOpenCoordinatorRequest {
5681        type Owned = Self;
5682
5683        #[inline(always)]
5684        fn inline_align(_context: fidl::encoding::Context) -> usize {
5685            8
5686        }
5687
5688        #[inline(always)]
5689        fn inline_size(_context: fidl::encoding::Context) -> usize {
5690            16
5691        }
5692    }
5693
5694    unsafe impl
5695        fidl::encoding::Encode<
5696            ProviderOpenCoordinatorRequest,
5697            fidl::encoding::DefaultFuchsiaResourceDialect,
5698        > for &mut ProviderOpenCoordinatorRequest
5699    {
5700        unsafe fn encode(
5701            self,
5702            encoder: &mut fidl::encoding::Encoder<
5703                '_,
5704                fidl::encoding::DefaultFuchsiaResourceDialect,
5705            >,
5706            offset: usize,
5707            mut depth: fidl::encoding::Depth,
5708        ) -> fidl::Result<()> {
5709            encoder.debug_check_bounds::<ProviderOpenCoordinatorRequest>(offset);
5710            // Vector header
5711            let max_ordinal: u64 = self.max_ordinal_present();
5712            encoder.write_num(max_ordinal, offset);
5713            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
5714            // Calling encoder.out_of_line_offset(0) is not allowed.
5715            if max_ordinal == 0 {
5716                return Ok(());
5717            }
5718            depth.increment()?;
5719            let envelope_size = 8;
5720            let bytes_len = max_ordinal as usize * envelope_size;
5721            #[allow(unused_variables)]
5722            let offset = encoder.out_of_line_offset(bytes_len);
5723            let mut _prev_end_offset: usize = 0;
5724            if 1 > max_ordinal {
5725                return Ok(());
5726            }
5727
5728            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
5729            // are envelope_size bytes.
5730            let cur_offset: usize = (1 - 1) * envelope_size;
5731
5732            // Zero reserved fields.
5733            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5734
5735            // Safety:
5736            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
5737            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
5738            //   envelope_size bytes, there is always sufficient room.
5739            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<CoordinatorMarker>>, fidl::encoding::DefaultFuchsiaResourceDialect>(
5740            self.coordinator.as_mut().map(<fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<CoordinatorMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
5741            encoder, offset + cur_offset, depth
5742        )?;
5743
5744            _prev_end_offset = cur_offset + envelope_size;
5745            if 2 > max_ordinal {
5746                return Ok(());
5747            }
5748
5749            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
5750            // are envelope_size bytes.
5751            let cur_offset: usize = (2 - 1) * envelope_size;
5752
5753            // Zero reserved fields.
5754            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5755
5756            // Safety:
5757            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
5758            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
5759            //   envelope_size bytes, there is always sufficient room.
5760            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<CoordinatorListenerMarker>>, fidl::encoding::DefaultFuchsiaResourceDialect>(
5761            self.coordinator_listener.as_mut().map(<fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<CoordinatorListenerMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
5762            encoder, offset + cur_offset, depth
5763        )?;
5764
5765            _prev_end_offset = cur_offset + envelope_size;
5766            if 3 > max_ordinal {
5767                return Ok(());
5768            }
5769
5770            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
5771            // are envelope_size bytes.
5772            let cur_offset: usize = (3 - 1) * envelope_size;
5773
5774            // Zero reserved fields.
5775            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5776
5777            // Safety:
5778            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
5779            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
5780            //   envelope_size bytes, there is always sufficient room.
5781            fidl::encoding::encode_in_envelope_optional::<
5782                ClientPriority,
5783                fidl::encoding::DefaultFuchsiaResourceDialect,
5784            >(
5785                self.priority
5786                    .as_ref()
5787                    .map(<ClientPriority as fidl::encoding::ValueTypeMarker>::borrow),
5788                encoder,
5789                offset + cur_offset,
5790                depth,
5791            )?;
5792
5793            _prev_end_offset = cur_offset + envelope_size;
5794
5795            Ok(())
5796        }
5797    }
5798
5799    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
5800        for ProviderOpenCoordinatorRequest
5801    {
5802        #[inline(always)]
5803        fn new_empty() -> Self {
5804            Self::default()
5805        }
5806
5807        unsafe fn decode(
5808            &mut self,
5809            decoder: &mut fidl::encoding::Decoder<
5810                '_,
5811                fidl::encoding::DefaultFuchsiaResourceDialect,
5812            >,
5813            offset: usize,
5814            mut depth: fidl::encoding::Depth,
5815        ) -> fidl::Result<()> {
5816            decoder.debug_check_bounds::<Self>(offset);
5817            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
5818                None => return Err(fidl::Error::NotNullable),
5819                Some(len) => len,
5820            };
5821            // Calling decoder.out_of_line_offset(0) is not allowed.
5822            if len == 0 {
5823                return Ok(());
5824            };
5825            depth.increment()?;
5826            let envelope_size = 8;
5827            let bytes_len = len * envelope_size;
5828            let offset = decoder.out_of_line_offset(bytes_len)?;
5829            // Decode the envelope for each type.
5830            let mut _next_ordinal_to_read = 0;
5831            let mut next_offset = offset;
5832            let end_offset = offset + bytes_len;
5833            _next_ordinal_to_read += 1;
5834            if next_offset >= end_offset {
5835                return Ok(());
5836            }
5837
5838            // Decode unknown envelopes for gaps in ordinals.
5839            while _next_ordinal_to_read < 1 {
5840                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5841                _next_ordinal_to_read += 1;
5842                next_offset += envelope_size;
5843            }
5844
5845            let next_out_of_line = decoder.next_out_of_line();
5846            let handles_before = decoder.remaining_handles();
5847            if let Some((inlined, num_bytes, num_handles)) =
5848                fidl::encoding::decode_envelope_header(decoder, next_offset)?
5849            {
5850                let member_inline_size = <fidl::encoding::Endpoint<
5851                    fidl::endpoints::ServerEnd<CoordinatorMarker>,
5852                > as fidl::encoding::TypeMarker>::inline_size(
5853                    decoder.context
5854                );
5855                if inlined != (member_inline_size <= 4) {
5856                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
5857                }
5858                let inner_offset;
5859                let mut inner_depth = depth.clone();
5860                if inlined {
5861                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5862                    inner_offset = next_offset;
5863                } else {
5864                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5865                    inner_depth.increment()?;
5866                }
5867                let val_ref = self.coordinator.get_or_insert_with(|| {
5868                    fidl::new_empty!(
5869                        fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<CoordinatorMarker>>,
5870                        fidl::encoding::DefaultFuchsiaResourceDialect
5871                    )
5872                });
5873                fidl::decode!(
5874                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<CoordinatorMarker>>,
5875                    fidl::encoding::DefaultFuchsiaResourceDialect,
5876                    val_ref,
5877                    decoder,
5878                    inner_offset,
5879                    inner_depth
5880                )?;
5881                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5882                {
5883                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
5884                }
5885                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5886                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5887                }
5888            }
5889
5890            next_offset += envelope_size;
5891            _next_ordinal_to_read += 1;
5892            if next_offset >= end_offset {
5893                return Ok(());
5894            }
5895
5896            // Decode unknown envelopes for gaps in ordinals.
5897            while _next_ordinal_to_read < 2 {
5898                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5899                _next_ordinal_to_read += 1;
5900                next_offset += envelope_size;
5901            }
5902
5903            let next_out_of_line = decoder.next_out_of_line();
5904            let handles_before = decoder.remaining_handles();
5905            if let Some((inlined, num_bytes, num_handles)) =
5906                fidl::encoding::decode_envelope_header(decoder, next_offset)?
5907            {
5908                let member_inline_size = <fidl::encoding::Endpoint<
5909                    fidl::endpoints::ClientEnd<CoordinatorListenerMarker>,
5910                > as fidl::encoding::TypeMarker>::inline_size(
5911                    decoder.context
5912                );
5913                if inlined != (member_inline_size <= 4) {
5914                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
5915                }
5916                let inner_offset;
5917                let mut inner_depth = depth.clone();
5918                if inlined {
5919                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5920                    inner_offset = next_offset;
5921                } else {
5922                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5923                    inner_depth.increment()?;
5924                }
5925                let val_ref = self.coordinator_listener.get_or_insert_with(|| {
5926                    fidl::new_empty!(
5927                        fidl::encoding::Endpoint<
5928                            fidl::endpoints::ClientEnd<CoordinatorListenerMarker>,
5929                        >,
5930                        fidl::encoding::DefaultFuchsiaResourceDialect
5931                    )
5932                });
5933                fidl::decode!(
5934                    fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<CoordinatorListenerMarker>>,
5935                    fidl::encoding::DefaultFuchsiaResourceDialect,
5936                    val_ref,
5937                    decoder,
5938                    inner_offset,
5939                    inner_depth
5940                )?;
5941                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5942                {
5943                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
5944                }
5945                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5946                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5947                }
5948            }
5949
5950            next_offset += envelope_size;
5951            _next_ordinal_to_read += 1;
5952            if next_offset >= end_offset {
5953                return Ok(());
5954            }
5955
5956            // Decode unknown envelopes for gaps in ordinals.
5957            while _next_ordinal_to_read < 3 {
5958                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5959                _next_ordinal_to_read += 1;
5960                next_offset += envelope_size;
5961            }
5962
5963            let next_out_of_line = decoder.next_out_of_line();
5964            let handles_before = decoder.remaining_handles();
5965            if let Some((inlined, num_bytes, num_handles)) =
5966                fidl::encoding::decode_envelope_header(decoder, next_offset)?
5967            {
5968                let member_inline_size =
5969                    <ClientPriority as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5970                if inlined != (member_inline_size <= 4) {
5971                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
5972                }
5973                let inner_offset;
5974                let mut inner_depth = depth.clone();
5975                if inlined {
5976                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5977                    inner_offset = next_offset;
5978                } else {
5979                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5980                    inner_depth.increment()?;
5981                }
5982                let val_ref = self.priority.get_or_insert_with(|| {
5983                    fidl::new_empty!(ClientPriority, fidl::encoding::DefaultFuchsiaResourceDialect)
5984                });
5985                fidl::decode!(
5986                    ClientPriority,
5987                    fidl::encoding::DefaultFuchsiaResourceDialect,
5988                    val_ref,
5989                    decoder,
5990                    inner_offset,
5991                    inner_depth
5992                )?;
5993                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5994                {
5995                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
5996                }
5997                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5998                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5999                }
6000            }
6001
6002            next_offset += envelope_size;
6003
6004            // Decode the remaining unknown envelopes.
6005            while next_offset < end_offset {
6006                _next_ordinal_to_read += 1;
6007                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6008                next_offset += envelope_size;
6009            }
6010
6011            Ok(())
6012        }
6013    }
6014}