1#![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_images_common::*;
11use futures::future::{self, MaybeDone, TryFutureExt};
12use zx_status;
13
14#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
15pub struct ImagePipe2AddBufferCollection2Request {
16 pub buffer_collection_id: u32,
17 pub buffer_collection_token:
18 fidl::endpoints::ClientEnd<fidl_fuchsia_sysmem2::BufferCollectionTokenMarker>,
19}
20
21impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
22 for ImagePipe2AddBufferCollection2Request
23{
24}
25
26#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
27pub struct ImagePipe2AddBufferCollectionRequest {
28 pub buffer_collection_id: u32,
29 pub buffer_collection_token:
30 fidl::endpoints::ClientEnd<fidl_fuchsia_sysmem::BufferCollectionTokenMarker>,
31}
32
33impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
34 for ImagePipe2AddBufferCollectionRequest
35{
36}
37
38#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
39pub struct ImagePipe2PresentImageRequest {
40 pub image_id: u32,
41 pub presentation_time: u64,
42 pub acquire_fences: Vec<fidl::Event>,
43 pub release_fences: Vec<fidl::Event>,
44}
45
46impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
47 for ImagePipe2PresentImageRequest
48{
49}
50
51#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
52pub struct ImagePipe2Marker;
53
54impl fidl::endpoints::ProtocolMarker for ImagePipe2Marker {
55 type Proxy = ImagePipe2Proxy;
56 type RequestStream = ImagePipe2RequestStream;
57 #[cfg(target_os = "fuchsia")]
58 type SynchronousProxy = ImagePipe2SynchronousProxy;
59
60 const DEBUG_NAME: &'static str = "(anonymous) ImagePipe2";
61}
62
63pub trait ImagePipe2ProxyInterface: Send + Sync {
64 fn r#add_buffer_collection2(
65 &self,
66 buffer_collection_id: u32,
67 buffer_collection_token: fidl::endpoints::ClientEnd<
68 fidl_fuchsia_sysmem2::BufferCollectionTokenMarker,
69 >,
70 ) -> Result<(), fidl::Error>;
71 fn r#add_buffer_collection(
72 &self,
73 buffer_collection_id: u32,
74 buffer_collection_token: fidl::endpoints::ClientEnd<
75 fidl_fuchsia_sysmem::BufferCollectionTokenMarker,
76 >,
77 ) -> Result<(), fidl::Error>;
78 fn r#add_image(
79 &self,
80 image_id: u32,
81 buffer_collection_id: u32,
82 buffer_collection_index: u32,
83 image_format: &fidl_fuchsia_sysmem::ImageFormat2,
84 ) -> Result<(), fidl::Error>;
85 fn r#remove_buffer_collection(&self, buffer_collection_id: u32) -> Result<(), fidl::Error>;
86 fn r#remove_image(&self, image_id: u32) -> Result<(), fidl::Error>;
87 type PresentImageResponseFut: std::future::Future<Output = Result<PresentationInfo, fidl::Error>>
88 + Send;
89 fn r#present_image(
90 &self,
91 image_id: u32,
92 presentation_time: u64,
93 acquire_fences: Vec<fidl::Event>,
94 release_fences: Vec<fidl::Event>,
95 ) -> Self::PresentImageResponseFut;
96}
97#[derive(Debug)]
98#[cfg(target_os = "fuchsia")]
99pub struct ImagePipe2SynchronousProxy {
100 client: fidl::client::sync::Client,
101}
102
103#[cfg(target_os = "fuchsia")]
104impl fidl::endpoints::SynchronousProxy for ImagePipe2SynchronousProxy {
105 type Proxy = ImagePipe2Proxy;
106 type Protocol = ImagePipe2Marker;
107
108 fn from_channel(inner: fidl::Channel) -> Self {
109 Self::new(inner)
110 }
111
112 fn into_channel(self) -> fidl::Channel {
113 self.client.into_channel()
114 }
115
116 fn as_channel(&self) -> &fidl::Channel {
117 self.client.as_channel()
118 }
119}
120
121#[cfg(target_os = "fuchsia")]
122impl ImagePipe2SynchronousProxy {
123 pub fn new(channel: fidl::Channel) -> Self {
124 let protocol_name = <ImagePipe2Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
125 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
126 }
127
128 pub fn into_channel(self) -> fidl::Channel {
129 self.client.into_channel()
130 }
131
132 pub fn wait_for_event(
135 &self,
136 deadline: zx::MonotonicInstant,
137 ) -> Result<ImagePipe2Event, fidl::Error> {
138 ImagePipe2Event::decode(self.client.wait_for_event(deadline)?)
139 }
140
141 pub fn r#add_buffer_collection2(
153 &self,
154 mut buffer_collection_id: u32,
155 mut buffer_collection_token: fidl::endpoints::ClientEnd<
156 fidl_fuchsia_sysmem2::BufferCollectionTokenMarker,
157 >,
158 ) -> Result<(), fidl::Error> {
159 self.client.send::<ImagePipe2AddBufferCollection2Request>(
160 (buffer_collection_id, buffer_collection_token),
161 0x181c72c935b0b4ee,
162 fidl::encoding::DynamicFlags::empty(),
163 )
164 }
165
166 pub fn r#add_buffer_collection(
167 &self,
168 mut buffer_collection_id: u32,
169 mut buffer_collection_token: fidl::endpoints::ClientEnd<
170 fidl_fuchsia_sysmem::BufferCollectionTokenMarker,
171 >,
172 ) -> Result<(), fidl::Error> {
173 self.client.send::<ImagePipe2AddBufferCollectionRequest>(
174 (buffer_collection_id, buffer_collection_token),
175 0x663ec76e20c87c05,
176 fidl::encoding::DynamicFlags::empty(),
177 )
178 }
179
180 pub fn r#add_image(
200 &self,
201 mut image_id: u32,
202 mut buffer_collection_id: u32,
203 mut buffer_collection_index: u32,
204 mut image_format: &fidl_fuchsia_sysmem::ImageFormat2,
205 ) -> Result<(), fidl::Error> {
206 self.client.send::<ImagePipe2AddImageRequest>(
207 (image_id, buffer_collection_id, buffer_collection_index, image_format),
208 0x23566808b13af395,
209 fidl::encoding::DynamicFlags::empty(),
210 )
211 }
212
213 pub fn r#remove_buffer_collection(
226 &self,
227 mut buffer_collection_id: u32,
228 ) -> Result<(), fidl::Error> {
229 self.client.send::<ImagePipe2RemoveBufferCollectionRequest>(
230 (buffer_collection_id,),
231 0x16bebb759a932299,
232 fidl::encoding::DynamicFlags::empty(),
233 )
234 }
235
236 pub fn r#remove_image(&self, mut image_id: u32) -> Result<(), fidl::Error> {
251 self.client.send::<ImagePipe2RemoveImageRequest>(
252 (image_id,),
253 0x16e8edd0f4d50f68,
254 fidl::encoding::DynamicFlags::empty(),
255 )
256 }
257
258 pub fn r#present_image(
294 &self,
295 mut image_id: u32,
296 mut presentation_time: u64,
297 mut acquire_fences: Vec<fidl::Event>,
298 mut release_fences: Vec<fidl::Event>,
299 ___deadline: zx::MonotonicInstant,
300 ) -> Result<PresentationInfo, fidl::Error> {
301 let _response = self
302 .client
303 .send_query::<ImagePipe2PresentImageRequest, ImagePipe2PresentImageResponse>(
304 (image_id, presentation_time, acquire_fences.as_mut(), release_fences.as_mut()),
305 0x73cfb50f577c143a,
306 fidl::encoding::DynamicFlags::empty(),
307 ___deadline,
308 )?;
309 Ok(_response.presentation_info)
310 }
311}
312
313#[cfg(target_os = "fuchsia")]
314impl From<ImagePipe2SynchronousProxy> for zx::Handle {
315 fn from(value: ImagePipe2SynchronousProxy) -> Self {
316 value.into_channel().into()
317 }
318}
319
320#[cfg(target_os = "fuchsia")]
321impl From<fidl::Channel> for ImagePipe2SynchronousProxy {
322 fn from(value: fidl::Channel) -> Self {
323 Self::new(value)
324 }
325}
326
327#[derive(Debug, Clone)]
328pub struct ImagePipe2Proxy {
329 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
330}
331
332impl fidl::endpoints::Proxy for ImagePipe2Proxy {
333 type Protocol = ImagePipe2Marker;
334
335 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
336 Self::new(inner)
337 }
338
339 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
340 self.client.into_channel().map_err(|client| Self { client })
341 }
342
343 fn as_channel(&self) -> &::fidl::AsyncChannel {
344 self.client.as_channel()
345 }
346}
347
348impl ImagePipe2Proxy {
349 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
351 let protocol_name = <ImagePipe2Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
352 Self { client: fidl::client::Client::new(channel, protocol_name) }
353 }
354
355 pub fn take_event_stream(&self) -> ImagePipe2EventStream {
361 ImagePipe2EventStream { event_receiver: self.client.take_event_receiver() }
362 }
363
364 pub fn r#add_buffer_collection2(
376 &self,
377 mut buffer_collection_id: u32,
378 mut buffer_collection_token: fidl::endpoints::ClientEnd<
379 fidl_fuchsia_sysmem2::BufferCollectionTokenMarker,
380 >,
381 ) -> Result<(), fidl::Error> {
382 ImagePipe2ProxyInterface::r#add_buffer_collection2(
383 self,
384 buffer_collection_id,
385 buffer_collection_token,
386 )
387 }
388
389 pub fn r#add_buffer_collection(
390 &self,
391 mut buffer_collection_id: u32,
392 mut buffer_collection_token: fidl::endpoints::ClientEnd<
393 fidl_fuchsia_sysmem::BufferCollectionTokenMarker,
394 >,
395 ) -> Result<(), fidl::Error> {
396 ImagePipe2ProxyInterface::r#add_buffer_collection(
397 self,
398 buffer_collection_id,
399 buffer_collection_token,
400 )
401 }
402
403 pub fn r#add_image(
423 &self,
424 mut image_id: u32,
425 mut buffer_collection_id: u32,
426 mut buffer_collection_index: u32,
427 mut image_format: &fidl_fuchsia_sysmem::ImageFormat2,
428 ) -> Result<(), fidl::Error> {
429 ImagePipe2ProxyInterface::r#add_image(
430 self,
431 image_id,
432 buffer_collection_id,
433 buffer_collection_index,
434 image_format,
435 )
436 }
437
438 pub fn r#remove_buffer_collection(
451 &self,
452 mut buffer_collection_id: u32,
453 ) -> Result<(), fidl::Error> {
454 ImagePipe2ProxyInterface::r#remove_buffer_collection(self, buffer_collection_id)
455 }
456
457 pub fn r#remove_image(&self, mut image_id: u32) -> Result<(), fidl::Error> {
472 ImagePipe2ProxyInterface::r#remove_image(self, image_id)
473 }
474
475 pub fn r#present_image(
511 &self,
512 mut image_id: u32,
513 mut presentation_time: u64,
514 mut acquire_fences: Vec<fidl::Event>,
515 mut release_fences: Vec<fidl::Event>,
516 ) -> fidl::client::QueryResponseFut<
517 PresentationInfo,
518 fidl::encoding::DefaultFuchsiaResourceDialect,
519 > {
520 ImagePipe2ProxyInterface::r#present_image(
521 self,
522 image_id,
523 presentation_time,
524 acquire_fences,
525 release_fences,
526 )
527 }
528}
529
530impl ImagePipe2ProxyInterface for ImagePipe2Proxy {
531 fn r#add_buffer_collection2(
532 &self,
533 mut buffer_collection_id: u32,
534 mut buffer_collection_token: fidl::endpoints::ClientEnd<
535 fidl_fuchsia_sysmem2::BufferCollectionTokenMarker,
536 >,
537 ) -> Result<(), fidl::Error> {
538 self.client.send::<ImagePipe2AddBufferCollection2Request>(
539 (buffer_collection_id, buffer_collection_token),
540 0x181c72c935b0b4ee,
541 fidl::encoding::DynamicFlags::empty(),
542 )
543 }
544
545 fn r#add_buffer_collection(
546 &self,
547 mut buffer_collection_id: u32,
548 mut buffer_collection_token: fidl::endpoints::ClientEnd<
549 fidl_fuchsia_sysmem::BufferCollectionTokenMarker,
550 >,
551 ) -> Result<(), fidl::Error> {
552 self.client.send::<ImagePipe2AddBufferCollectionRequest>(
553 (buffer_collection_id, buffer_collection_token),
554 0x663ec76e20c87c05,
555 fidl::encoding::DynamicFlags::empty(),
556 )
557 }
558
559 fn r#add_image(
560 &self,
561 mut image_id: u32,
562 mut buffer_collection_id: u32,
563 mut buffer_collection_index: u32,
564 mut image_format: &fidl_fuchsia_sysmem::ImageFormat2,
565 ) -> Result<(), fidl::Error> {
566 self.client.send::<ImagePipe2AddImageRequest>(
567 (image_id, buffer_collection_id, buffer_collection_index, image_format),
568 0x23566808b13af395,
569 fidl::encoding::DynamicFlags::empty(),
570 )
571 }
572
573 fn r#remove_buffer_collection(&self, mut buffer_collection_id: u32) -> Result<(), fidl::Error> {
574 self.client.send::<ImagePipe2RemoveBufferCollectionRequest>(
575 (buffer_collection_id,),
576 0x16bebb759a932299,
577 fidl::encoding::DynamicFlags::empty(),
578 )
579 }
580
581 fn r#remove_image(&self, mut image_id: u32) -> Result<(), fidl::Error> {
582 self.client.send::<ImagePipe2RemoveImageRequest>(
583 (image_id,),
584 0x16e8edd0f4d50f68,
585 fidl::encoding::DynamicFlags::empty(),
586 )
587 }
588
589 type PresentImageResponseFut = fidl::client::QueryResponseFut<
590 PresentationInfo,
591 fidl::encoding::DefaultFuchsiaResourceDialect,
592 >;
593 fn r#present_image(
594 &self,
595 mut image_id: u32,
596 mut presentation_time: u64,
597 mut acquire_fences: Vec<fidl::Event>,
598 mut release_fences: Vec<fidl::Event>,
599 ) -> Self::PresentImageResponseFut {
600 fn _decode(
601 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
602 ) -> Result<PresentationInfo, fidl::Error> {
603 let _response = fidl::client::decode_transaction_body::<
604 ImagePipe2PresentImageResponse,
605 fidl::encoding::DefaultFuchsiaResourceDialect,
606 0x73cfb50f577c143a,
607 >(_buf?)?;
608 Ok(_response.presentation_info)
609 }
610 self.client.send_query_and_decode::<ImagePipe2PresentImageRequest, PresentationInfo>(
611 (image_id, presentation_time, acquire_fences.as_mut(), release_fences.as_mut()),
612 0x73cfb50f577c143a,
613 fidl::encoding::DynamicFlags::empty(),
614 _decode,
615 )
616 }
617}
618
619pub struct ImagePipe2EventStream {
620 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
621}
622
623impl std::marker::Unpin for ImagePipe2EventStream {}
624
625impl futures::stream::FusedStream for ImagePipe2EventStream {
626 fn is_terminated(&self) -> bool {
627 self.event_receiver.is_terminated()
628 }
629}
630
631impl futures::Stream for ImagePipe2EventStream {
632 type Item = Result<ImagePipe2Event, fidl::Error>;
633
634 fn poll_next(
635 mut self: std::pin::Pin<&mut Self>,
636 cx: &mut std::task::Context<'_>,
637 ) -> std::task::Poll<Option<Self::Item>> {
638 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
639 &mut self.event_receiver,
640 cx
641 )?) {
642 Some(buf) => std::task::Poll::Ready(Some(ImagePipe2Event::decode(buf))),
643 None => std::task::Poll::Ready(None),
644 }
645 }
646}
647
648#[derive(Debug)]
649pub enum ImagePipe2Event {}
650
651impl ImagePipe2Event {
652 fn decode(
654 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
655 ) -> Result<ImagePipe2Event, fidl::Error> {
656 let (bytes, _handles) = buf.split_mut();
657 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
658 debug_assert_eq!(tx_header.tx_id, 0);
659 match tx_header.ordinal {
660 _ => Err(fidl::Error::UnknownOrdinal {
661 ordinal: tx_header.ordinal,
662 protocol_name: <ImagePipe2Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
663 }),
664 }
665 }
666}
667
668pub struct ImagePipe2RequestStream {
670 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
671 is_terminated: bool,
672}
673
674impl std::marker::Unpin for ImagePipe2RequestStream {}
675
676impl futures::stream::FusedStream for ImagePipe2RequestStream {
677 fn is_terminated(&self) -> bool {
678 self.is_terminated
679 }
680}
681
682impl fidl::endpoints::RequestStream for ImagePipe2RequestStream {
683 type Protocol = ImagePipe2Marker;
684 type ControlHandle = ImagePipe2ControlHandle;
685
686 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
687 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
688 }
689
690 fn control_handle(&self) -> Self::ControlHandle {
691 ImagePipe2ControlHandle { inner: self.inner.clone() }
692 }
693
694 fn into_inner(
695 self,
696 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
697 {
698 (self.inner, self.is_terminated)
699 }
700
701 fn from_inner(
702 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
703 is_terminated: bool,
704 ) -> Self {
705 Self { inner, is_terminated }
706 }
707}
708
709impl futures::Stream for ImagePipe2RequestStream {
710 type Item = Result<ImagePipe2Request, fidl::Error>;
711
712 fn poll_next(
713 mut self: std::pin::Pin<&mut Self>,
714 cx: &mut std::task::Context<'_>,
715 ) -> std::task::Poll<Option<Self::Item>> {
716 let this = &mut *self;
717 if this.inner.check_shutdown(cx) {
718 this.is_terminated = true;
719 return std::task::Poll::Ready(None);
720 }
721 if this.is_terminated {
722 panic!("polled ImagePipe2RequestStream after completion");
723 }
724 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
725 |bytes, handles| {
726 match this.inner.channel().read_etc(cx, bytes, handles) {
727 std::task::Poll::Ready(Ok(())) => {}
728 std::task::Poll::Pending => return std::task::Poll::Pending,
729 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
730 this.is_terminated = true;
731 return std::task::Poll::Ready(None);
732 }
733 std::task::Poll::Ready(Err(e)) => {
734 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
735 e.into(),
736 ))))
737 }
738 }
739
740 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
742
743 std::task::Poll::Ready(Some(match header.ordinal {
744 0x181c72c935b0b4ee => {
745 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
746 let mut req = fidl::new_empty!(
747 ImagePipe2AddBufferCollection2Request,
748 fidl::encoding::DefaultFuchsiaResourceDialect
749 );
750 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ImagePipe2AddBufferCollection2Request>(&header, _body_bytes, handles, &mut req)?;
751 let control_handle = ImagePipe2ControlHandle { inner: this.inner.clone() };
752 Ok(ImagePipe2Request::AddBufferCollection2 {
753 buffer_collection_id: req.buffer_collection_id,
754 buffer_collection_token: req.buffer_collection_token,
755
756 control_handle,
757 })
758 }
759 0x663ec76e20c87c05 => {
760 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
761 let mut req = fidl::new_empty!(
762 ImagePipe2AddBufferCollectionRequest,
763 fidl::encoding::DefaultFuchsiaResourceDialect
764 );
765 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ImagePipe2AddBufferCollectionRequest>(&header, _body_bytes, handles, &mut req)?;
766 let control_handle = ImagePipe2ControlHandle { inner: this.inner.clone() };
767 Ok(ImagePipe2Request::AddBufferCollection {
768 buffer_collection_id: req.buffer_collection_id,
769 buffer_collection_token: req.buffer_collection_token,
770
771 control_handle,
772 })
773 }
774 0x23566808b13af395 => {
775 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
776 let mut req = fidl::new_empty!(
777 ImagePipe2AddImageRequest,
778 fidl::encoding::DefaultFuchsiaResourceDialect
779 );
780 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ImagePipe2AddImageRequest>(&header, _body_bytes, handles, &mut req)?;
781 let control_handle = ImagePipe2ControlHandle { inner: this.inner.clone() };
782 Ok(ImagePipe2Request::AddImage {
783 image_id: req.image_id,
784 buffer_collection_id: req.buffer_collection_id,
785 buffer_collection_index: req.buffer_collection_index,
786 image_format: req.image_format,
787
788 control_handle,
789 })
790 }
791 0x16bebb759a932299 => {
792 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
793 let mut req = fidl::new_empty!(
794 ImagePipe2RemoveBufferCollectionRequest,
795 fidl::encoding::DefaultFuchsiaResourceDialect
796 );
797 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ImagePipe2RemoveBufferCollectionRequest>(&header, _body_bytes, handles, &mut req)?;
798 let control_handle = ImagePipe2ControlHandle { inner: this.inner.clone() };
799 Ok(ImagePipe2Request::RemoveBufferCollection {
800 buffer_collection_id: req.buffer_collection_id,
801
802 control_handle,
803 })
804 }
805 0x16e8edd0f4d50f68 => {
806 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
807 let mut req = fidl::new_empty!(
808 ImagePipe2RemoveImageRequest,
809 fidl::encoding::DefaultFuchsiaResourceDialect
810 );
811 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ImagePipe2RemoveImageRequest>(&header, _body_bytes, handles, &mut req)?;
812 let control_handle = ImagePipe2ControlHandle { inner: this.inner.clone() };
813 Ok(ImagePipe2Request::RemoveImage {
814 image_id: req.image_id,
815
816 control_handle,
817 })
818 }
819 0x73cfb50f577c143a => {
820 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
821 let mut req = fidl::new_empty!(
822 ImagePipe2PresentImageRequest,
823 fidl::encoding::DefaultFuchsiaResourceDialect
824 );
825 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ImagePipe2PresentImageRequest>(&header, _body_bytes, handles, &mut req)?;
826 let control_handle = ImagePipe2ControlHandle { inner: this.inner.clone() };
827 Ok(ImagePipe2Request::PresentImage {
828 image_id: req.image_id,
829 presentation_time: req.presentation_time,
830 acquire_fences: req.acquire_fences,
831 release_fences: req.release_fences,
832
833 responder: ImagePipe2PresentImageResponder {
834 control_handle: std::mem::ManuallyDrop::new(control_handle),
835 tx_id: header.tx_id,
836 },
837 })
838 }
839 _ => Err(fidl::Error::UnknownOrdinal {
840 ordinal: header.ordinal,
841 protocol_name:
842 <ImagePipe2Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
843 }),
844 }))
845 },
846 )
847 }
848}
849
850#[derive(Debug)]
910pub enum ImagePipe2Request {
911 AddBufferCollection2 {
923 buffer_collection_id: u32,
924 buffer_collection_token:
925 fidl::endpoints::ClientEnd<fidl_fuchsia_sysmem2::BufferCollectionTokenMarker>,
926 control_handle: ImagePipe2ControlHandle,
927 },
928 AddBufferCollection {
929 buffer_collection_id: u32,
930 buffer_collection_token:
931 fidl::endpoints::ClientEnd<fidl_fuchsia_sysmem::BufferCollectionTokenMarker>,
932 control_handle: ImagePipe2ControlHandle,
933 },
934 AddImage {
954 image_id: u32,
955 buffer_collection_id: u32,
956 buffer_collection_index: u32,
957 image_format: fidl_fuchsia_sysmem::ImageFormat2,
958 control_handle: ImagePipe2ControlHandle,
959 },
960 RemoveBufferCollection { buffer_collection_id: u32, control_handle: ImagePipe2ControlHandle },
973 RemoveImage { image_id: u32, control_handle: ImagePipe2ControlHandle },
988 PresentImage {
1024 image_id: u32,
1025 presentation_time: u64,
1026 acquire_fences: Vec<fidl::Event>,
1027 release_fences: Vec<fidl::Event>,
1028 responder: ImagePipe2PresentImageResponder,
1029 },
1030}
1031
1032impl ImagePipe2Request {
1033 #[allow(irrefutable_let_patterns)]
1034 pub fn into_add_buffer_collection2(
1035 self,
1036 ) -> Option<(
1037 u32,
1038 fidl::endpoints::ClientEnd<fidl_fuchsia_sysmem2::BufferCollectionTokenMarker>,
1039 ImagePipe2ControlHandle,
1040 )> {
1041 if let ImagePipe2Request::AddBufferCollection2 {
1042 buffer_collection_id,
1043 buffer_collection_token,
1044 control_handle,
1045 } = self
1046 {
1047 Some((buffer_collection_id, buffer_collection_token, control_handle))
1048 } else {
1049 None
1050 }
1051 }
1052
1053 #[allow(irrefutable_let_patterns)]
1054 pub fn into_add_buffer_collection(
1055 self,
1056 ) -> Option<(
1057 u32,
1058 fidl::endpoints::ClientEnd<fidl_fuchsia_sysmem::BufferCollectionTokenMarker>,
1059 ImagePipe2ControlHandle,
1060 )> {
1061 if let ImagePipe2Request::AddBufferCollection {
1062 buffer_collection_id,
1063 buffer_collection_token,
1064 control_handle,
1065 } = self
1066 {
1067 Some((buffer_collection_id, buffer_collection_token, control_handle))
1068 } else {
1069 None
1070 }
1071 }
1072
1073 #[allow(irrefutable_let_patterns)]
1074 pub fn into_add_image(
1075 self,
1076 ) -> Option<(u32, u32, u32, fidl_fuchsia_sysmem::ImageFormat2, ImagePipe2ControlHandle)> {
1077 if let ImagePipe2Request::AddImage {
1078 image_id,
1079 buffer_collection_id,
1080 buffer_collection_index,
1081 image_format,
1082 control_handle,
1083 } = self
1084 {
1085 Some((
1086 image_id,
1087 buffer_collection_id,
1088 buffer_collection_index,
1089 image_format,
1090 control_handle,
1091 ))
1092 } else {
1093 None
1094 }
1095 }
1096
1097 #[allow(irrefutable_let_patterns)]
1098 pub fn into_remove_buffer_collection(self) -> Option<(u32, ImagePipe2ControlHandle)> {
1099 if let ImagePipe2Request::RemoveBufferCollection { buffer_collection_id, control_handle } =
1100 self
1101 {
1102 Some((buffer_collection_id, control_handle))
1103 } else {
1104 None
1105 }
1106 }
1107
1108 #[allow(irrefutable_let_patterns)]
1109 pub fn into_remove_image(self) -> Option<(u32, ImagePipe2ControlHandle)> {
1110 if let ImagePipe2Request::RemoveImage { image_id, control_handle } = self {
1111 Some((image_id, control_handle))
1112 } else {
1113 None
1114 }
1115 }
1116
1117 #[allow(irrefutable_let_patterns)]
1118 pub fn into_present_image(
1119 self,
1120 ) -> Option<(u32, u64, Vec<fidl::Event>, Vec<fidl::Event>, ImagePipe2PresentImageResponder)>
1121 {
1122 if let ImagePipe2Request::PresentImage {
1123 image_id,
1124 presentation_time,
1125 acquire_fences,
1126 release_fences,
1127 responder,
1128 } = self
1129 {
1130 Some((image_id, presentation_time, acquire_fences, release_fences, responder))
1131 } else {
1132 None
1133 }
1134 }
1135
1136 pub fn method_name(&self) -> &'static str {
1138 match *self {
1139 ImagePipe2Request::AddBufferCollection2 { .. } => "add_buffer_collection2",
1140 ImagePipe2Request::AddBufferCollection { .. } => "add_buffer_collection",
1141 ImagePipe2Request::AddImage { .. } => "add_image",
1142 ImagePipe2Request::RemoveBufferCollection { .. } => "remove_buffer_collection",
1143 ImagePipe2Request::RemoveImage { .. } => "remove_image",
1144 ImagePipe2Request::PresentImage { .. } => "present_image",
1145 }
1146 }
1147}
1148
1149#[derive(Debug, Clone)]
1150pub struct ImagePipe2ControlHandle {
1151 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1152}
1153
1154impl fidl::endpoints::ControlHandle for ImagePipe2ControlHandle {
1155 fn shutdown(&self) {
1156 self.inner.shutdown()
1157 }
1158 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1159 self.inner.shutdown_with_epitaph(status)
1160 }
1161
1162 fn is_closed(&self) -> bool {
1163 self.inner.channel().is_closed()
1164 }
1165 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1166 self.inner.channel().on_closed()
1167 }
1168
1169 #[cfg(target_os = "fuchsia")]
1170 fn signal_peer(
1171 &self,
1172 clear_mask: zx::Signals,
1173 set_mask: zx::Signals,
1174 ) -> Result<(), zx_status::Status> {
1175 use fidl::Peered;
1176 self.inner.channel().signal_peer(clear_mask, set_mask)
1177 }
1178}
1179
1180impl ImagePipe2ControlHandle {}
1181
1182#[must_use = "FIDL methods require a response to be sent"]
1183#[derive(Debug)]
1184pub struct ImagePipe2PresentImageResponder {
1185 control_handle: std::mem::ManuallyDrop<ImagePipe2ControlHandle>,
1186 tx_id: u32,
1187}
1188
1189impl std::ops::Drop for ImagePipe2PresentImageResponder {
1193 fn drop(&mut self) {
1194 self.control_handle.shutdown();
1195 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1197 }
1198}
1199
1200impl fidl::endpoints::Responder for ImagePipe2PresentImageResponder {
1201 type ControlHandle = ImagePipe2ControlHandle;
1202
1203 fn control_handle(&self) -> &ImagePipe2ControlHandle {
1204 &self.control_handle
1205 }
1206
1207 fn drop_without_shutdown(mut self) {
1208 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1210 std::mem::forget(self);
1212 }
1213}
1214
1215impl ImagePipe2PresentImageResponder {
1216 pub fn send(self, mut presentation_info: &PresentationInfo) -> Result<(), fidl::Error> {
1220 let _result = self.send_raw(presentation_info);
1221 if _result.is_err() {
1222 self.control_handle.shutdown();
1223 }
1224 self.drop_without_shutdown();
1225 _result
1226 }
1227
1228 pub fn send_no_shutdown_on_err(
1230 self,
1231 mut presentation_info: &PresentationInfo,
1232 ) -> Result<(), fidl::Error> {
1233 let _result = self.send_raw(presentation_info);
1234 self.drop_without_shutdown();
1235 _result
1236 }
1237
1238 fn send_raw(&self, mut presentation_info: &PresentationInfo) -> Result<(), fidl::Error> {
1239 self.control_handle.inner.send::<ImagePipe2PresentImageResponse>(
1240 (presentation_info,),
1241 self.tx_id,
1242 0x73cfb50f577c143a,
1243 fidl::encoding::DynamicFlags::empty(),
1244 )
1245 }
1246}
1247
1248mod internal {
1249 use super::*;
1250
1251 impl fidl::encoding::ResourceTypeMarker for ImagePipe2AddBufferCollection2Request {
1252 type Borrowed<'a> = &'a mut Self;
1253 fn take_or_borrow<'a>(
1254 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1255 ) -> Self::Borrowed<'a> {
1256 value
1257 }
1258 }
1259
1260 unsafe impl fidl::encoding::TypeMarker for ImagePipe2AddBufferCollection2Request {
1261 type Owned = Self;
1262
1263 #[inline(always)]
1264 fn inline_align(_context: fidl::encoding::Context) -> usize {
1265 4
1266 }
1267
1268 #[inline(always)]
1269 fn inline_size(_context: fidl::encoding::Context) -> usize {
1270 8
1271 }
1272 }
1273
1274 unsafe impl
1275 fidl::encoding::Encode<
1276 ImagePipe2AddBufferCollection2Request,
1277 fidl::encoding::DefaultFuchsiaResourceDialect,
1278 > for &mut ImagePipe2AddBufferCollection2Request
1279 {
1280 #[inline]
1281 unsafe fn encode(
1282 self,
1283 encoder: &mut fidl::encoding::Encoder<
1284 '_,
1285 fidl::encoding::DefaultFuchsiaResourceDialect,
1286 >,
1287 offset: usize,
1288 _depth: fidl::encoding::Depth,
1289 ) -> fidl::Result<()> {
1290 encoder.debug_check_bounds::<ImagePipe2AddBufferCollection2Request>(offset);
1291 fidl::encoding::Encode::<
1293 ImagePipe2AddBufferCollection2Request,
1294 fidl::encoding::DefaultFuchsiaResourceDialect,
1295 >::encode(
1296 (
1297 <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.buffer_collection_id),
1298 <fidl::encoding::Endpoint<
1299 fidl::endpoints::ClientEnd<
1300 fidl_fuchsia_sysmem2::BufferCollectionTokenMarker,
1301 >,
1302 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
1303 &mut self.buffer_collection_token,
1304 ),
1305 ),
1306 encoder,
1307 offset,
1308 _depth,
1309 )
1310 }
1311 }
1312 unsafe impl<
1313 T0: fidl::encoding::Encode<u32, fidl::encoding::DefaultFuchsiaResourceDialect>,
1314 T1: fidl::encoding::Encode<
1315 fidl::encoding::Endpoint<
1316 fidl::endpoints::ClientEnd<fidl_fuchsia_sysmem2::BufferCollectionTokenMarker>,
1317 >,
1318 fidl::encoding::DefaultFuchsiaResourceDialect,
1319 >,
1320 >
1321 fidl::encoding::Encode<
1322 ImagePipe2AddBufferCollection2Request,
1323 fidl::encoding::DefaultFuchsiaResourceDialect,
1324 > for (T0, T1)
1325 {
1326 #[inline]
1327 unsafe fn encode(
1328 self,
1329 encoder: &mut fidl::encoding::Encoder<
1330 '_,
1331 fidl::encoding::DefaultFuchsiaResourceDialect,
1332 >,
1333 offset: usize,
1334 depth: fidl::encoding::Depth,
1335 ) -> fidl::Result<()> {
1336 encoder.debug_check_bounds::<ImagePipe2AddBufferCollection2Request>(offset);
1337 self.0.encode(encoder, offset + 0, depth)?;
1341 self.1.encode(encoder, offset + 4, depth)?;
1342 Ok(())
1343 }
1344 }
1345
1346 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
1347 for ImagePipe2AddBufferCollection2Request
1348 {
1349 #[inline(always)]
1350 fn new_empty() -> Self {
1351 Self {
1352 buffer_collection_id: fidl::new_empty!(
1353 u32,
1354 fidl::encoding::DefaultFuchsiaResourceDialect
1355 ),
1356 buffer_collection_token: fidl::new_empty!(
1357 fidl::encoding::Endpoint<
1358 fidl::endpoints::ClientEnd<
1359 fidl_fuchsia_sysmem2::BufferCollectionTokenMarker,
1360 >,
1361 >,
1362 fidl::encoding::DefaultFuchsiaResourceDialect
1363 ),
1364 }
1365 }
1366
1367 #[inline]
1368 unsafe fn decode(
1369 &mut self,
1370 decoder: &mut fidl::encoding::Decoder<
1371 '_,
1372 fidl::encoding::DefaultFuchsiaResourceDialect,
1373 >,
1374 offset: usize,
1375 _depth: fidl::encoding::Depth,
1376 ) -> fidl::Result<()> {
1377 decoder.debug_check_bounds::<Self>(offset);
1378 fidl::decode!(
1380 u32,
1381 fidl::encoding::DefaultFuchsiaResourceDialect,
1382 &mut self.buffer_collection_id,
1383 decoder,
1384 offset + 0,
1385 _depth
1386 )?;
1387 fidl::decode!(
1388 fidl::encoding::Endpoint<
1389 fidl::endpoints::ClientEnd<fidl_fuchsia_sysmem2::BufferCollectionTokenMarker>,
1390 >,
1391 fidl::encoding::DefaultFuchsiaResourceDialect,
1392 &mut self.buffer_collection_token,
1393 decoder,
1394 offset + 4,
1395 _depth
1396 )?;
1397 Ok(())
1398 }
1399 }
1400
1401 impl fidl::encoding::ResourceTypeMarker for ImagePipe2AddBufferCollectionRequest {
1402 type Borrowed<'a> = &'a mut Self;
1403 fn take_or_borrow<'a>(
1404 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1405 ) -> Self::Borrowed<'a> {
1406 value
1407 }
1408 }
1409
1410 unsafe impl fidl::encoding::TypeMarker for ImagePipe2AddBufferCollectionRequest {
1411 type Owned = Self;
1412
1413 #[inline(always)]
1414 fn inline_align(_context: fidl::encoding::Context) -> usize {
1415 4
1416 }
1417
1418 #[inline(always)]
1419 fn inline_size(_context: fidl::encoding::Context) -> usize {
1420 8
1421 }
1422 }
1423
1424 unsafe impl
1425 fidl::encoding::Encode<
1426 ImagePipe2AddBufferCollectionRequest,
1427 fidl::encoding::DefaultFuchsiaResourceDialect,
1428 > for &mut ImagePipe2AddBufferCollectionRequest
1429 {
1430 #[inline]
1431 unsafe fn encode(
1432 self,
1433 encoder: &mut fidl::encoding::Encoder<
1434 '_,
1435 fidl::encoding::DefaultFuchsiaResourceDialect,
1436 >,
1437 offset: usize,
1438 _depth: fidl::encoding::Depth,
1439 ) -> fidl::Result<()> {
1440 encoder.debug_check_bounds::<ImagePipe2AddBufferCollectionRequest>(offset);
1441 fidl::encoding::Encode::<
1443 ImagePipe2AddBufferCollectionRequest,
1444 fidl::encoding::DefaultFuchsiaResourceDialect,
1445 >::encode(
1446 (
1447 <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.buffer_collection_id),
1448 <fidl::encoding::Endpoint<
1449 fidl::endpoints::ClientEnd<
1450 fidl_fuchsia_sysmem::BufferCollectionTokenMarker,
1451 >,
1452 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
1453 &mut self.buffer_collection_token,
1454 ),
1455 ),
1456 encoder,
1457 offset,
1458 _depth,
1459 )
1460 }
1461 }
1462 unsafe impl<
1463 T0: fidl::encoding::Encode<u32, fidl::encoding::DefaultFuchsiaResourceDialect>,
1464 T1: fidl::encoding::Encode<
1465 fidl::encoding::Endpoint<
1466 fidl::endpoints::ClientEnd<fidl_fuchsia_sysmem::BufferCollectionTokenMarker>,
1467 >,
1468 fidl::encoding::DefaultFuchsiaResourceDialect,
1469 >,
1470 >
1471 fidl::encoding::Encode<
1472 ImagePipe2AddBufferCollectionRequest,
1473 fidl::encoding::DefaultFuchsiaResourceDialect,
1474 > for (T0, T1)
1475 {
1476 #[inline]
1477 unsafe fn encode(
1478 self,
1479 encoder: &mut fidl::encoding::Encoder<
1480 '_,
1481 fidl::encoding::DefaultFuchsiaResourceDialect,
1482 >,
1483 offset: usize,
1484 depth: fidl::encoding::Depth,
1485 ) -> fidl::Result<()> {
1486 encoder.debug_check_bounds::<ImagePipe2AddBufferCollectionRequest>(offset);
1487 self.0.encode(encoder, offset + 0, depth)?;
1491 self.1.encode(encoder, offset + 4, depth)?;
1492 Ok(())
1493 }
1494 }
1495
1496 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
1497 for ImagePipe2AddBufferCollectionRequest
1498 {
1499 #[inline(always)]
1500 fn new_empty() -> Self {
1501 Self {
1502 buffer_collection_id: fidl::new_empty!(
1503 u32,
1504 fidl::encoding::DefaultFuchsiaResourceDialect
1505 ),
1506 buffer_collection_token: fidl::new_empty!(
1507 fidl::encoding::Endpoint<
1508 fidl::endpoints::ClientEnd<
1509 fidl_fuchsia_sysmem::BufferCollectionTokenMarker,
1510 >,
1511 >,
1512 fidl::encoding::DefaultFuchsiaResourceDialect
1513 ),
1514 }
1515 }
1516
1517 #[inline]
1518 unsafe fn decode(
1519 &mut self,
1520 decoder: &mut fidl::encoding::Decoder<
1521 '_,
1522 fidl::encoding::DefaultFuchsiaResourceDialect,
1523 >,
1524 offset: usize,
1525 _depth: fidl::encoding::Depth,
1526 ) -> fidl::Result<()> {
1527 decoder.debug_check_bounds::<Self>(offset);
1528 fidl::decode!(
1530 u32,
1531 fidl::encoding::DefaultFuchsiaResourceDialect,
1532 &mut self.buffer_collection_id,
1533 decoder,
1534 offset + 0,
1535 _depth
1536 )?;
1537 fidl::decode!(
1538 fidl::encoding::Endpoint<
1539 fidl::endpoints::ClientEnd<fidl_fuchsia_sysmem::BufferCollectionTokenMarker>,
1540 >,
1541 fidl::encoding::DefaultFuchsiaResourceDialect,
1542 &mut self.buffer_collection_token,
1543 decoder,
1544 offset + 4,
1545 _depth
1546 )?;
1547 Ok(())
1548 }
1549 }
1550
1551 impl fidl::encoding::ResourceTypeMarker for ImagePipe2PresentImageRequest {
1552 type Borrowed<'a> = &'a mut Self;
1553 fn take_or_borrow<'a>(
1554 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1555 ) -> Self::Borrowed<'a> {
1556 value
1557 }
1558 }
1559
1560 unsafe impl fidl::encoding::TypeMarker for ImagePipe2PresentImageRequest {
1561 type Owned = Self;
1562
1563 #[inline(always)]
1564 fn inline_align(_context: fidl::encoding::Context) -> usize {
1565 8
1566 }
1567
1568 #[inline(always)]
1569 fn inline_size(_context: fidl::encoding::Context) -> usize {
1570 48
1571 }
1572 }
1573
1574 unsafe impl
1575 fidl::encoding::Encode<
1576 ImagePipe2PresentImageRequest,
1577 fidl::encoding::DefaultFuchsiaResourceDialect,
1578 > for &mut ImagePipe2PresentImageRequest
1579 {
1580 #[inline]
1581 unsafe fn encode(
1582 self,
1583 encoder: &mut fidl::encoding::Encoder<
1584 '_,
1585 fidl::encoding::DefaultFuchsiaResourceDialect,
1586 >,
1587 offset: usize,
1588 _depth: fidl::encoding::Depth,
1589 ) -> fidl::Result<()> {
1590 encoder.debug_check_bounds::<ImagePipe2PresentImageRequest>(offset);
1591 fidl::encoding::Encode::<
1593 ImagePipe2PresentImageRequest,
1594 fidl::encoding::DefaultFuchsiaResourceDialect,
1595 >::encode(
1596 (
1597 <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.image_id),
1598 <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.presentation_time),
1599 <fidl::encoding::Vector<
1600 fidl::encoding::HandleType<
1601 fidl::Event,
1602 { fidl::ObjectType::EVENT.into_raw() },
1603 2147483648,
1604 >,
1605 16,
1606 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
1607 &mut self.acquire_fences,
1608 ),
1609 <fidl::encoding::Vector<
1610 fidl::encoding::HandleType<
1611 fidl::Event,
1612 { fidl::ObjectType::EVENT.into_raw() },
1613 2147483648,
1614 >,
1615 16,
1616 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
1617 &mut self.release_fences,
1618 ),
1619 ),
1620 encoder,
1621 offset,
1622 _depth,
1623 )
1624 }
1625 }
1626 unsafe impl<
1627 T0: fidl::encoding::Encode<u32, fidl::encoding::DefaultFuchsiaResourceDialect>,
1628 T1: fidl::encoding::Encode<u64, fidl::encoding::DefaultFuchsiaResourceDialect>,
1629 T2: fidl::encoding::Encode<
1630 fidl::encoding::Vector<
1631 fidl::encoding::HandleType<
1632 fidl::Event,
1633 { fidl::ObjectType::EVENT.into_raw() },
1634 2147483648,
1635 >,
1636 16,
1637 >,
1638 fidl::encoding::DefaultFuchsiaResourceDialect,
1639 >,
1640 T3: fidl::encoding::Encode<
1641 fidl::encoding::Vector<
1642 fidl::encoding::HandleType<
1643 fidl::Event,
1644 { fidl::ObjectType::EVENT.into_raw() },
1645 2147483648,
1646 >,
1647 16,
1648 >,
1649 fidl::encoding::DefaultFuchsiaResourceDialect,
1650 >,
1651 >
1652 fidl::encoding::Encode<
1653 ImagePipe2PresentImageRequest,
1654 fidl::encoding::DefaultFuchsiaResourceDialect,
1655 > for (T0, T1, T2, T3)
1656 {
1657 #[inline]
1658 unsafe fn encode(
1659 self,
1660 encoder: &mut fidl::encoding::Encoder<
1661 '_,
1662 fidl::encoding::DefaultFuchsiaResourceDialect,
1663 >,
1664 offset: usize,
1665 depth: fidl::encoding::Depth,
1666 ) -> fidl::Result<()> {
1667 encoder.debug_check_bounds::<ImagePipe2PresentImageRequest>(offset);
1668 unsafe {
1671 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
1672 (ptr as *mut u64).write_unaligned(0);
1673 }
1674 self.0.encode(encoder, offset + 0, depth)?;
1676 self.1.encode(encoder, offset + 8, depth)?;
1677 self.2.encode(encoder, offset + 16, depth)?;
1678 self.3.encode(encoder, offset + 32, depth)?;
1679 Ok(())
1680 }
1681 }
1682
1683 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
1684 for ImagePipe2PresentImageRequest
1685 {
1686 #[inline(always)]
1687 fn new_empty() -> Self {
1688 Self {
1689 image_id: fidl::new_empty!(u32, fidl::encoding::DefaultFuchsiaResourceDialect),
1690 presentation_time: fidl::new_empty!(
1691 u64,
1692 fidl::encoding::DefaultFuchsiaResourceDialect
1693 ),
1694 acquire_fences: fidl::new_empty!(
1695 fidl::encoding::Vector<
1696 fidl::encoding::HandleType<
1697 fidl::Event,
1698 { fidl::ObjectType::EVENT.into_raw() },
1699 2147483648,
1700 >,
1701 16,
1702 >,
1703 fidl::encoding::DefaultFuchsiaResourceDialect
1704 ),
1705 release_fences: fidl::new_empty!(
1706 fidl::encoding::Vector<
1707 fidl::encoding::HandleType<
1708 fidl::Event,
1709 { fidl::ObjectType::EVENT.into_raw() },
1710 2147483648,
1711 >,
1712 16,
1713 >,
1714 fidl::encoding::DefaultFuchsiaResourceDialect
1715 ),
1716 }
1717 }
1718
1719 #[inline]
1720 unsafe fn decode(
1721 &mut self,
1722 decoder: &mut fidl::encoding::Decoder<
1723 '_,
1724 fidl::encoding::DefaultFuchsiaResourceDialect,
1725 >,
1726 offset: usize,
1727 _depth: fidl::encoding::Depth,
1728 ) -> fidl::Result<()> {
1729 decoder.debug_check_bounds::<Self>(offset);
1730 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
1732 let padval = unsafe { (ptr as *const u64).read_unaligned() };
1733 let mask = 0xffffffff00000000u64;
1734 let maskedval = padval & mask;
1735 if maskedval != 0 {
1736 return Err(fidl::Error::NonZeroPadding {
1737 padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
1738 });
1739 }
1740 fidl::decode!(
1741 u32,
1742 fidl::encoding::DefaultFuchsiaResourceDialect,
1743 &mut self.image_id,
1744 decoder,
1745 offset + 0,
1746 _depth
1747 )?;
1748 fidl::decode!(
1749 u64,
1750 fidl::encoding::DefaultFuchsiaResourceDialect,
1751 &mut self.presentation_time,
1752 decoder,
1753 offset + 8,
1754 _depth
1755 )?;
1756 fidl::decode!(
1757 fidl::encoding::Vector<
1758 fidl::encoding::HandleType<
1759 fidl::Event,
1760 { fidl::ObjectType::EVENT.into_raw() },
1761 2147483648,
1762 >,
1763 16,
1764 >,
1765 fidl::encoding::DefaultFuchsiaResourceDialect,
1766 &mut self.acquire_fences,
1767 decoder,
1768 offset + 16,
1769 _depth
1770 )?;
1771 fidl::decode!(
1772 fidl::encoding::Vector<
1773 fidl::encoding::HandleType<
1774 fidl::Event,
1775 { fidl::ObjectType::EVENT.into_raw() },
1776 2147483648,
1777 >,
1778 16,
1779 >,
1780 fidl::encoding::DefaultFuchsiaResourceDialect,
1781 &mut self.release_fences,
1782 decoder,
1783 offset + 32,
1784 _depth
1785 )?;
1786 Ok(())
1787 }
1788 }
1789}