1#![warn(clippy::all)]
4#![allow(unused_parens, unused_mut, unused_imports, nonstandard_style)]
5
6use bitflags::bitflags;
7use fdomain_client::fidl::{ControlHandle as _, FDomainFlexibleIntoResult as _, Responder as _};
8use fidl::encoding::{MessageBufFor, ProxyChannelBox, ResourceDialect};
9pub use fidl_fuchsia_images_common::*;
10use futures::future::{self, MaybeDone, TryFutureExt};
11use zx_status;
12
13#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
14pub struct ImagePipe2AddBufferCollection2Request {
15 pub buffer_collection_id: u32,
16 pub buffer_collection_token:
17 fdomain_client::fidl::ClientEnd<fdomain_fuchsia_sysmem2::BufferCollectionTokenMarker>,
18}
19
20impl fidl::Standalone<fdomain_client::fidl::FDomainResourceDialect>
21 for ImagePipe2AddBufferCollection2Request
22{
23}
24
25#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
26pub struct ImagePipe2AddBufferCollectionRequest {
27 pub buffer_collection_id: u32,
28 pub buffer_collection_token:
29 fdomain_client::fidl::ClientEnd<fdomain_fuchsia_sysmem::BufferCollectionTokenMarker>,
30}
31
32impl fidl::Standalone<fdomain_client::fidl::FDomainResourceDialect>
33 for ImagePipe2AddBufferCollectionRequest
34{
35}
36
37#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
38pub struct ImagePipe2PresentImageRequest {
39 pub image_id: u32,
40 pub presentation_time: u64,
41 pub acquire_fences: Vec<fdomain_client::Event>,
42 pub release_fences: Vec<fdomain_client::Event>,
43}
44
45impl fidl::Standalone<fdomain_client::fidl::FDomainResourceDialect>
46 for ImagePipe2PresentImageRequest
47{
48}
49
50#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
51pub struct ImagePipe2Marker;
52
53impl fdomain_client::fidl::ProtocolMarker for ImagePipe2Marker {
54 type Proxy = ImagePipe2Proxy;
55 type RequestStream = ImagePipe2RequestStream;
56
57 const DEBUG_NAME: &'static str = "(anonymous) ImagePipe2";
58}
59
60pub trait ImagePipe2ProxyInterface: Send + Sync {
61 fn r#add_buffer_collection2(
62 &self,
63 buffer_collection_id: u32,
64 buffer_collection_token: fdomain_client::fidl::ClientEnd<
65 fdomain_fuchsia_sysmem2::BufferCollectionTokenMarker,
66 >,
67 ) -> Result<(), fidl::Error>;
68 fn r#add_buffer_collection(
69 &self,
70 buffer_collection_id: u32,
71 buffer_collection_token: fdomain_client::fidl::ClientEnd<
72 fdomain_fuchsia_sysmem::BufferCollectionTokenMarker,
73 >,
74 ) -> Result<(), fidl::Error>;
75 fn r#add_image(
76 &self,
77 image_id: u32,
78 buffer_collection_id: u32,
79 buffer_collection_index: u32,
80 image_format: &fdomain_fuchsia_sysmem::ImageFormat2,
81 ) -> Result<(), fidl::Error>;
82 fn r#remove_buffer_collection(&self, buffer_collection_id: u32) -> Result<(), fidl::Error>;
83 fn r#remove_image(&self, image_id: u32) -> Result<(), fidl::Error>;
84 type PresentImageResponseFut: std::future::Future<Output = Result<PresentationInfo, fidl::Error>>
85 + Send;
86 fn r#present_image(
87 &self,
88 image_id: u32,
89 presentation_time: u64,
90 acquire_fences: Vec<fdomain_client::Event>,
91 release_fences: Vec<fdomain_client::Event>,
92 ) -> Self::PresentImageResponseFut;
93}
94
95#[derive(Debug, Clone)]
96pub struct ImagePipe2Proxy {
97 client: fidl::client::Client<fdomain_client::fidl::FDomainResourceDialect>,
98}
99
100impl fdomain_client::fidl::Proxy for ImagePipe2Proxy {
101 type Protocol = ImagePipe2Marker;
102
103 fn from_channel(inner: fdomain_client::Channel) -> Self {
104 Self::new(inner)
105 }
106
107 fn into_channel(self) -> Result<fdomain_client::Channel, Self> {
108 self.client.into_channel().map_err(|client| Self { client })
109 }
110
111 fn as_channel(&self) -> &fdomain_client::Channel {
112 self.client.as_channel()
113 }
114}
115
116impl ImagePipe2Proxy {
117 pub fn new(channel: fdomain_client::Channel) -> Self {
119 let protocol_name = <ImagePipe2Marker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME;
120 Self { client: fidl::client::Client::new(channel, protocol_name) }
121 }
122
123 pub fn take_event_stream(&self) -> ImagePipe2EventStream {
129 ImagePipe2EventStream { event_receiver: self.client.take_event_receiver() }
130 }
131
132 pub fn r#add_buffer_collection2(
144 &self,
145 mut buffer_collection_id: u32,
146 mut buffer_collection_token: fdomain_client::fidl::ClientEnd<
147 fdomain_fuchsia_sysmem2::BufferCollectionTokenMarker,
148 >,
149 ) -> Result<(), fidl::Error> {
150 ImagePipe2ProxyInterface::r#add_buffer_collection2(
151 self,
152 buffer_collection_id,
153 buffer_collection_token,
154 )
155 }
156
157 pub fn r#add_buffer_collection(
158 &self,
159 mut buffer_collection_id: u32,
160 mut buffer_collection_token: fdomain_client::fidl::ClientEnd<
161 fdomain_fuchsia_sysmem::BufferCollectionTokenMarker,
162 >,
163 ) -> Result<(), fidl::Error> {
164 ImagePipe2ProxyInterface::r#add_buffer_collection(
165 self,
166 buffer_collection_id,
167 buffer_collection_token,
168 )
169 }
170
171 pub fn r#add_image(
191 &self,
192 mut image_id: u32,
193 mut buffer_collection_id: u32,
194 mut buffer_collection_index: u32,
195 mut image_format: &fdomain_fuchsia_sysmem::ImageFormat2,
196 ) -> Result<(), fidl::Error> {
197 ImagePipe2ProxyInterface::r#add_image(
198 self,
199 image_id,
200 buffer_collection_id,
201 buffer_collection_index,
202 image_format,
203 )
204 }
205
206 pub fn r#remove_buffer_collection(
219 &self,
220 mut buffer_collection_id: u32,
221 ) -> Result<(), fidl::Error> {
222 ImagePipe2ProxyInterface::r#remove_buffer_collection(self, buffer_collection_id)
223 }
224
225 pub fn r#remove_image(&self, mut image_id: u32) -> Result<(), fidl::Error> {
240 ImagePipe2ProxyInterface::r#remove_image(self, image_id)
241 }
242
243 pub fn r#present_image(
279 &self,
280 mut image_id: u32,
281 mut presentation_time: u64,
282 mut acquire_fences: Vec<fdomain_client::Event>,
283 mut release_fences: Vec<fdomain_client::Event>,
284 ) -> fidl::client::QueryResponseFut<
285 PresentationInfo,
286 fdomain_client::fidl::FDomainResourceDialect,
287 > {
288 ImagePipe2ProxyInterface::r#present_image(
289 self,
290 image_id,
291 presentation_time,
292 acquire_fences,
293 release_fences,
294 )
295 }
296}
297
298impl ImagePipe2ProxyInterface for ImagePipe2Proxy {
299 fn r#add_buffer_collection2(
300 &self,
301 mut buffer_collection_id: u32,
302 mut buffer_collection_token: fdomain_client::fidl::ClientEnd<
303 fdomain_fuchsia_sysmem2::BufferCollectionTokenMarker,
304 >,
305 ) -> Result<(), fidl::Error> {
306 self.client.send::<ImagePipe2AddBufferCollection2Request>(
307 (buffer_collection_id, buffer_collection_token),
308 0x181c72c935b0b4ee,
309 fidl::encoding::DynamicFlags::empty(),
310 )
311 }
312
313 fn r#add_buffer_collection(
314 &self,
315 mut buffer_collection_id: u32,
316 mut buffer_collection_token: fdomain_client::fidl::ClientEnd<
317 fdomain_fuchsia_sysmem::BufferCollectionTokenMarker,
318 >,
319 ) -> Result<(), fidl::Error> {
320 self.client.send::<ImagePipe2AddBufferCollectionRequest>(
321 (buffer_collection_id, buffer_collection_token),
322 0x663ec76e20c87c05,
323 fidl::encoding::DynamicFlags::empty(),
324 )
325 }
326
327 fn r#add_image(
328 &self,
329 mut image_id: u32,
330 mut buffer_collection_id: u32,
331 mut buffer_collection_index: u32,
332 mut image_format: &fdomain_fuchsia_sysmem::ImageFormat2,
333 ) -> Result<(), fidl::Error> {
334 self.client.send::<ImagePipe2AddImageRequest>(
335 (image_id, buffer_collection_id, buffer_collection_index, image_format),
336 0x23566808b13af395,
337 fidl::encoding::DynamicFlags::empty(),
338 )
339 }
340
341 fn r#remove_buffer_collection(&self, mut buffer_collection_id: u32) -> Result<(), fidl::Error> {
342 self.client.send::<ImagePipe2RemoveBufferCollectionRequest>(
343 (buffer_collection_id,),
344 0x16bebb759a932299,
345 fidl::encoding::DynamicFlags::empty(),
346 )
347 }
348
349 fn r#remove_image(&self, mut image_id: u32) -> Result<(), fidl::Error> {
350 self.client.send::<ImagePipe2RemoveImageRequest>(
351 (image_id,),
352 0x16e8edd0f4d50f68,
353 fidl::encoding::DynamicFlags::empty(),
354 )
355 }
356
357 type PresentImageResponseFut = fidl::client::QueryResponseFut<
358 PresentationInfo,
359 fdomain_client::fidl::FDomainResourceDialect,
360 >;
361 fn r#present_image(
362 &self,
363 mut image_id: u32,
364 mut presentation_time: u64,
365 mut acquire_fences: Vec<fdomain_client::Event>,
366 mut release_fences: Vec<fdomain_client::Event>,
367 ) -> Self::PresentImageResponseFut {
368 fn _decode(
369 mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
370 ) -> Result<PresentationInfo, fidl::Error> {
371 let _response = fidl::client::decode_transaction_body::<
372 ImagePipe2PresentImageResponse,
373 fdomain_client::fidl::FDomainResourceDialect,
374 0x73cfb50f577c143a,
375 >(_buf?)?;
376 Ok(_response.presentation_info)
377 }
378 self.client.send_query_and_decode::<ImagePipe2PresentImageRequest, PresentationInfo>(
379 (image_id, presentation_time, acquire_fences.as_mut(), release_fences.as_mut()),
380 0x73cfb50f577c143a,
381 fidl::encoding::DynamicFlags::empty(),
382 _decode,
383 )
384 }
385}
386
387pub struct ImagePipe2EventStream {
388 event_receiver: fidl::client::EventReceiver<fdomain_client::fidl::FDomainResourceDialect>,
389}
390
391impl std::marker::Unpin for ImagePipe2EventStream {}
392
393impl futures::stream::FusedStream for ImagePipe2EventStream {
394 fn is_terminated(&self) -> bool {
395 self.event_receiver.is_terminated()
396 }
397}
398
399impl futures::Stream for ImagePipe2EventStream {
400 type Item = Result<ImagePipe2Event, fidl::Error>;
401
402 fn poll_next(
403 mut self: std::pin::Pin<&mut Self>,
404 cx: &mut std::task::Context<'_>,
405 ) -> std::task::Poll<Option<Self::Item>> {
406 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
407 &mut self.event_receiver,
408 cx
409 )?) {
410 Some(buf) => std::task::Poll::Ready(Some(ImagePipe2Event::decode(buf))),
411 None => std::task::Poll::Ready(None),
412 }
413 }
414}
415
416#[derive(Debug)]
417pub enum ImagePipe2Event {}
418
419impl ImagePipe2Event {
420 fn decode(
422 mut buf: <fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
423 ) -> Result<ImagePipe2Event, fidl::Error> {
424 let (bytes, _handles) = buf.split_mut();
425 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
426 debug_assert_eq!(tx_header.tx_id, 0);
427 match tx_header.ordinal {
428 _ => Err(fidl::Error::UnknownOrdinal {
429 ordinal: tx_header.ordinal,
430 protocol_name:
431 <ImagePipe2Marker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
432 }),
433 }
434 }
435}
436
437pub struct ImagePipe2RequestStream {
439 inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
440 is_terminated: bool,
441}
442
443impl std::marker::Unpin for ImagePipe2RequestStream {}
444
445impl futures::stream::FusedStream for ImagePipe2RequestStream {
446 fn is_terminated(&self) -> bool {
447 self.is_terminated
448 }
449}
450
451impl fdomain_client::fidl::RequestStream for ImagePipe2RequestStream {
452 type Protocol = ImagePipe2Marker;
453 type ControlHandle = ImagePipe2ControlHandle;
454
455 fn from_channel(channel: fdomain_client::Channel) -> Self {
456 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
457 }
458
459 fn control_handle(&self) -> Self::ControlHandle {
460 ImagePipe2ControlHandle { inner: self.inner.clone() }
461 }
462
463 fn into_inner(
464 self,
465 ) -> (::std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>, bool)
466 {
467 (self.inner, self.is_terminated)
468 }
469
470 fn from_inner(
471 inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
472 is_terminated: bool,
473 ) -> Self {
474 Self { inner, is_terminated }
475 }
476}
477
478impl futures::Stream for ImagePipe2RequestStream {
479 type Item = Result<ImagePipe2Request, fidl::Error>;
480
481 fn poll_next(
482 mut self: std::pin::Pin<&mut Self>,
483 cx: &mut std::task::Context<'_>,
484 ) -> std::task::Poll<Option<Self::Item>> {
485 let this = &mut *self;
486 if this.inner.check_shutdown(cx) {
487 this.is_terminated = true;
488 return std::task::Poll::Ready(None);
489 }
490 if this.is_terminated {
491 panic!("polled ImagePipe2RequestStream after completion");
492 }
493 fidl::encoding::with_tls_decode_buf::<_, fdomain_client::fidl::FDomainResourceDialect>(
494 |bytes, handles| {
495 match this.inner.channel().read_etc(cx, bytes, handles) {
496 std::task::Poll::Ready(Ok(())) => {}
497 std::task::Poll::Pending => return std::task::Poll::Pending,
498 std::task::Poll::Ready(Err(None)) => {
499 this.is_terminated = true;
500 return std::task::Poll::Ready(None);
501 }
502 std::task::Poll::Ready(Err(Some(e))) => {
503 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
504 e.into(),
505 ))));
506 }
507 }
508
509 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
511
512 std::task::Poll::Ready(Some(match header.ordinal {
513 0x181c72c935b0b4ee => {
514 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
515 let mut req = fidl::new_empty!(
516 ImagePipe2AddBufferCollection2Request,
517 fdomain_client::fidl::FDomainResourceDialect
518 );
519 fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<ImagePipe2AddBufferCollection2Request>(&header, _body_bytes, handles, &mut req)?;
520 let control_handle = ImagePipe2ControlHandle { inner: this.inner.clone() };
521 Ok(ImagePipe2Request::AddBufferCollection2 {
522 buffer_collection_id: req.buffer_collection_id,
523 buffer_collection_token: req.buffer_collection_token,
524
525 control_handle,
526 })
527 }
528 0x663ec76e20c87c05 => {
529 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
530 let mut req = fidl::new_empty!(
531 ImagePipe2AddBufferCollectionRequest,
532 fdomain_client::fidl::FDomainResourceDialect
533 );
534 fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<ImagePipe2AddBufferCollectionRequest>(&header, _body_bytes, handles, &mut req)?;
535 let control_handle = ImagePipe2ControlHandle { inner: this.inner.clone() };
536 Ok(ImagePipe2Request::AddBufferCollection {
537 buffer_collection_id: req.buffer_collection_id,
538 buffer_collection_token: req.buffer_collection_token,
539
540 control_handle,
541 })
542 }
543 0x23566808b13af395 => {
544 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
545 let mut req = fidl::new_empty!(
546 ImagePipe2AddImageRequest,
547 fdomain_client::fidl::FDomainResourceDialect
548 );
549 fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<ImagePipe2AddImageRequest>(&header, _body_bytes, handles, &mut req)?;
550 let control_handle = ImagePipe2ControlHandle { inner: this.inner.clone() };
551 Ok(ImagePipe2Request::AddImage {
552 image_id: req.image_id,
553 buffer_collection_id: req.buffer_collection_id,
554 buffer_collection_index: req.buffer_collection_index,
555 image_format: req.image_format,
556
557 control_handle,
558 })
559 }
560 0x16bebb759a932299 => {
561 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
562 let mut req = fidl::new_empty!(
563 ImagePipe2RemoveBufferCollectionRequest,
564 fdomain_client::fidl::FDomainResourceDialect
565 );
566 fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<ImagePipe2RemoveBufferCollectionRequest>(&header, _body_bytes, handles, &mut req)?;
567 let control_handle = ImagePipe2ControlHandle { inner: this.inner.clone() };
568 Ok(ImagePipe2Request::RemoveBufferCollection {
569 buffer_collection_id: req.buffer_collection_id,
570
571 control_handle,
572 })
573 }
574 0x16e8edd0f4d50f68 => {
575 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
576 let mut req = fidl::new_empty!(
577 ImagePipe2RemoveImageRequest,
578 fdomain_client::fidl::FDomainResourceDialect
579 );
580 fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<ImagePipe2RemoveImageRequest>(&header, _body_bytes, handles, &mut req)?;
581 let control_handle = ImagePipe2ControlHandle { inner: this.inner.clone() };
582 Ok(ImagePipe2Request::RemoveImage {
583 image_id: req.image_id,
584
585 control_handle,
586 })
587 }
588 0x73cfb50f577c143a => {
589 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
590 let mut req = fidl::new_empty!(
591 ImagePipe2PresentImageRequest,
592 fdomain_client::fidl::FDomainResourceDialect
593 );
594 fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<ImagePipe2PresentImageRequest>(&header, _body_bytes, handles, &mut req)?;
595 let control_handle = ImagePipe2ControlHandle { inner: this.inner.clone() };
596 Ok(ImagePipe2Request::PresentImage {
597 image_id: req.image_id,
598 presentation_time: req.presentation_time,
599 acquire_fences: req.acquire_fences,
600 release_fences: req.release_fences,
601
602 responder: ImagePipe2PresentImageResponder {
603 control_handle: std::mem::ManuallyDrop::new(control_handle),
604 tx_id: header.tx_id,
605 },
606 })
607 }
608 _ => Err(fidl::Error::UnknownOrdinal {
609 ordinal: header.ordinal,
610 protocol_name:
611 <ImagePipe2Marker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
612 }),
613 }))
614 },
615 )
616 }
617}
618
619#[derive(Debug)]
679pub enum ImagePipe2Request {
680 AddBufferCollection2 {
692 buffer_collection_id: u32,
693 buffer_collection_token:
694 fdomain_client::fidl::ClientEnd<fdomain_fuchsia_sysmem2::BufferCollectionTokenMarker>,
695 control_handle: ImagePipe2ControlHandle,
696 },
697 AddBufferCollection {
698 buffer_collection_id: u32,
699 buffer_collection_token:
700 fdomain_client::fidl::ClientEnd<fdomain_fuchsia_sysmem::BufferCollectionTokenMarker>,
701 control_handle: ImagePipe2ControlHandle,
702 },
703 AddImage {
723 image_id: u32,
724 buffer_collection_id: u32,
725 buffer_collection_index: u32,
726 image_format: fdomain_fuchsia_sysmem::ImageFormat2,
727 control_handle: ImagePipe2ControlHandle,
728 },
729 RemoveBufferCollection { buffer_collection_id: u32, control_handle: ImagePipe2ControlHandle },
742 RemoveImage { image_id: u32, control_handle: ImagePipe2ControlHandle },
757 PresentImage {
793 image_id: u32,
794 presentation_time: u64,
795 acquire_fences: Vec<fdomain_client::Event>,
796 release_fences: Vec<fdomain_client::Event>,
797 responder: ImagePipe2PresentImageResponder,
798 },
799}
800
801impl ImagePipe2Request {
802 #[allow(irrefutable_let_patterns)]
803 pub fn into_add_buffer_collection2(
804 self,
805 ) -> Option<(
806 u32,
807 fdomain_client::fidl::ClientEnd<fdomain_fuchsia_sysmem2::BufferCollectionTokenMarker>,
808 ImagePipe2ControlHandle,
809 )> {
810 if let ImagePipe2Request::AddBufferCollection2 {
811 buffer_collection_id,
812 buffer_collection_token,
813 control_handle,
814 } = self
815 {
816 Some((buffer_collection_id, buffer_collection_token, control_handle))
817 } else {
818 None
819 }
820 }
821
822 #[allow(irrefutable_let_patterns)]
823 pub fn into_add_buffer_collection(
824 self,
825 ) -> Option<(
826 u32,
827 fdomain_client::fidl::ClientEnd<fdomain_fuchsia_sysmem::BufferCollectionTokenMarker>,
828 ImagePipe2ControlHandle,
829 )> {
830 if let ImagePipe2Request::AddBufferCollection {
831 buffer_collection_id,
832 buffer_collection_token,
833 control_handle,
834 } = self
835 {
836 Some((buffer_collection_id, buffer_collection_token, control_handle))
837 } else {
838 None
839 }
840 }
841
842 #[allow(irrefutable_let_patterns)]
843 pub fn into_add_image(
844 self,
845 ) -> Option<(u32, u32, u32, fdomain_fuchsia_sysmem::ImageFormat2, ImagePipe2ControlHandle)>
846 {
847 if let ImagePipe2Request::AddImage {
848 image_id,
849 buffer_collection_id,
850 buffer_collection_index,
851 image_format,
852 control_handle,
853 } = self
854 {
855 Some((
856 image_id,
857 buffer_collection_id,
858 buffer_collection_index,
859 image_format,
860 control_handle,
861 ))
862 } else {
863 None
864 }
865 }
866
867 #[allow(irrefutable_let_patterns)]
868 pub fn into_remove_buffer_collection(self) -> Option<(u32, ImagePipe2ControlHandle)> {
869 if let ImagePipe2Request::RemoveBufferCollection { buffer_collection_id, control_handle } =
870 self
871 {
872 Some((buffer_collection_id, control_handle))
873 } else {
874 None
875 }
876 }
877
878 #[allow(irrefutable_let_patterns)]
879 pub fn into_remove_image(self) -> Option<(u32, ImagePipe2ControlHandle)> {
880 if let ImagePipe2Request::RemoveImage { image_id, control_handle } = self {
881 Some((image_id, control_handle))
882 } else {
883 None
884 }
885 }
886
887 #[allow(irrefutable_let_patterns)]
888 pub fn into_present_image(
889 self,
890 ) -> Option<(
891 u32,
892 u64,
893 Vec<fdomain_client::Event>,
894 Vec<fdomain_client::Event>,
895 ImagePipe2PresentImageResponder,
896 )> {
897 if let ImagePipe2Request::PresentImage {
898 image_id,
899 presentation_time,
900 acquire_fences,
901 release_fences,
902 responder,
903 } = self
904 {
905 Some((image_id, presentation_time, acquire_fences, release_fences, responder))
906 } else {
907 None
908 }
909 }
910
911 pub fn method_name(&self) -> &'static str {
913 match *self {
914 ImagePipe2Request::AddBufferCollection2 { .. } => "add_buffer_collection2",
915 ImagePipe2Request::AddBufferCollection { .. } => "add_buffer_collection",
916 ImagePipe2Request::AddImage { .. } => "add_image",
917 ImagePipe2Request::RemoveBufferCollection { .. } => "remove_buffer_collection",
918 ImagePipe2Request::RemoveImage { .. } => "remove_image",
919 ImagePipe2Request::PresentImage { .. } => "present_image",
920 }
921 }
922}
923
924#[derive(Debug, Clone)]
925pub struct ImagePipe2ControlHandle {
926 inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
927}
928
929impl ImagePipe2ControlHandle {
930 pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
931 self.inner.shutdown_with_epitaph(status.into())
932 }
933}
934
935impl fdomain_client::fidl::ControlHandle for ImagePipe2ControlHandle {
936 fn shutdown(&self) {
937 self.inner.shutdown()
938 }
939
940 fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
941 self.inner.shutdown_with_epitaph(status)
942 }
943
944 fn is_closed(&self) -> bool {
945 self.inner.channel().is_closed()
946 }
947 fn on_closed(&self) -> fdomain_client::OnFDomainSignals {
948 self.inner.channel().on_closed()
949 }
950}
951
952impl ImagePipe2ControlHandle {}
953
954#[must_use = "FIDL methods require a response to be sent"]
955#[derive(Debug)]
956pub struct ImagePipe2PresentImageResponder {
957 control_handle: std::mem::ManuallyDrop<ImagePipe2ControlHandle>,
958 tx_id: u32,
959}
960
961impl std::ops::Drop for ImagePipe2PresentImageResponder {
965 fn drop(&mut self) {
966 self.control_handle.shutdown();
967 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
969 }
970}
971
972impl fdomain_client::fidl::Responder for ImagePipe2PresentImageResponder {
973 type ControlHandle = ImagePipe2ControlHandle;
974
975 fn control_handle(&self) -> &ImagePipe2ControlHandle {
976 &self.control_handle
977 }
978
979 fn drop_without_shutdown(mut self) {
980 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
982 std::mem::forget(self);
984 }
985}
986
987impl ImagePipe2PresentImageResponder {
988 pub fn send(self, mut presentation_info: &PresentationInfo) -> Result<(), fidl::Error> {
992 let _result = self.send_raw(presentation_info);
993 if _result.is_err() {
994 self.control_handle.shutdown();
995 }
996 self.drop_without_shutdown();
997 _result
998 }
999
1000 pub fn send_no_shutdown_on_err(
1002 self,
1003 mut presentation_info: &PresentationInfo,
1004 ) -> Result<(), fidl::Error> {
1005 let _result = self.send_raw(presentation_info);
1006 self.drop_without_shutdown();
1007 _result
1008 }
1009
1010 fn send_raw(&self, mut presentation_info: &PresentationInfo) -> Result<(), fidl::Error> {
1011 self.control_handle.inner.send::<ImagePipe2PresentImageResponse>(
1012 (presentation_info,),
1013 self.tx_id,
1014 0x73cfb50f577c143a,
1015 fidl::encoding::DynamicFlags::empty(),
1016 )
1017 }
1018}
1019
1020mod internal {
1021 use super::*;
1022
1023 impl fidl::encoding::ResourceTypeMarker for ImagePipe2AddBufferCollection2Request {
1024 type Borrowed<'a> = &'a mut Self;
1025 fn take_or_borrow<'a>(
1026 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1027 ) -> Self::Borrowed<'a> {
1028 value
1029 }
1030 }
1031
1032 unsafe impl fidl::encoding::TypeMarker for ImagePipe2AddBufferCollection2Request {
1033 type Owned = Self;
1034
1035 #[inline(always)]
1036 fn inline_align(_context: fidl::encoding::Context) -> usize {
1037 4
1038 }
1039
1040 #[inline(always)]
1041 fn inline_size(_context: fidl::encoding::Context) -> usize {
1042 8
1043 }
1044 }
1045
1046 unsafe impl
1047 fidl::encoding::Encode<
1048 ImagePipe2AddBufferCollection2Request,
1049 fdomain_client::fidl::FDomainResourceDialect,
1050 > for &mut ImagePipe2AddBufferCollection2Request
1051 {
1052 #[inline]
1053 unsafe fn encode(
1054 self,
1055 encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
1056 offset: usize,
1057 _depth: fidl::encoding::Depth,
1058 ) -> fidl::Result<()> {
1059 encoder.debug_check_bounds::<ImagePipe2AddBufferCollection2Request>(offset);
1060 fidl::encoding::Encode::<
1062 ImagePipe2AddBufferCollection2Request,
1063 fdomain_client::fidl::FDomainResourceDialect,
1064 >::encode(
1065 (
1066 <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.buffer_collection_id),
1067 <fidl::encoding::Endpoint<
1068 fdomain_client::fidl::ClientEnd<
1069 fdomain_fuchsia_sysmem2::BufferCollectionTokenMarker,
1070 >,
1071 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
1072 &mut self.buffer_collection_token,
1073 ),
1074 ),
1075 encoder,
1076 offset,
1077 _depth,
1078 )
1079 }
1080 }
1081 unsafe impl<
1082 T0: fidl::encoding::Encode<u32, fdomain_client::fidl::FDomainResourceDialect>,
1083 T1: fidl::encoding::Encode<
1084 fidl::encoding::Endpoint<
1085 fdomain_client::fidl::ClientEnd<
1086 fdomain_fuchsia_sysmem2::BufferCollectionTokenMarker,
1087 >,
1088 >,
1089 fdomain_client::fidl::FDomainResourceDialect,
1090 >,
1091 >
1092 fidl::encoding::Encode<
1093 ImagePipe2AddBufferCollection2Request,
1094 fdomain_client::fidl::FDomainResourceDialect,
1095 > for (T0, T1)
1096 {
1097 #[inline]
1098 unsafe fn encode(
1099 self,
1100 encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
1101 offset: usize,
1102 depth: fidl::encoding::Depth,
1103 ) -> fidl::Result<()> {
1104 encoder.debug_check_bounds::<ImagePipe2AddBufferCollection2Request>(offset);
1105 self.0.encode(encoder, offset + 0, depth)?;
1109 self.1.encode(encoder, offset + 4, depth)?;
1110 Ok(())
1111 }
1112 }
1113
1114 impl fidl::encoding::Decode<Self, fdomain_client::fidl::FDomainResourceDialect>
1115 for ImagePipe2AddBufferCollection2Request
1116 {
1117 #[inline(always)]
1118 fn new_empty() -> Self {
1119 Self {
1120 buffer_collection_id: fidl::new_empty!(
1121 u32,
1122 fdomain_client::fidl::FDomainResourceDialect
1123 ),
1124 buffer_collection_token: fidl::new_empty!(
1125 fidl::encoding::Endpoint<
1126 fdomain_client::fidl::ClientEnd<
1127 fdomain_fuchsia_sysmem2::BufferCollectionTokenMarker,
1128 >,
1129 >,
1130 fdomain_client::fidl::FDomainResourceDialect
1131 ),
1132 }
1133 }
1134
1135 #[inline]
1136 unsafe fn decode(
1137 &mut self,
1138 decoder: &mut fidl::encoding::Decoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
1139 offset: usize,
1140 _depth: fidl::encoding::Depth,
1141 ) -> fidl::Result<()> {
1142 decoder.debug_check_bounds::<Self>(offset);
1143 fidl::decode!(
1145 u32,
1146 fdomain_client::fidl::FDomainResourceDialect,
1147 &mut self.buffer_collection_id,
1148 decoder,
1149 offset + 0,
1150 _depth
1151 )?;
1152 fidl::decode!(
1153 fidl::encoding::Endpoint<
1154 fdomain_client::fidl::ClientEnd<
1155 fdomain_fuchsia_sysmem2::BufferCollectionTokenMarker,
1156 >,
1157 >,
1158 fdomain_client::fidl::FDomainResourceDialect,
1159 &mut self.buffer_collection_token,
1160 decoder,
1161 offset + 4,
1162 _depth
1163 )?;
1164 Ok(())
1165 }
1166 }
1167
1168 impl fidl::encoding::ResourceTypeMarker for ImagePipe2AddBufferCollectionRequest {
1169 type Borrowed<'a> = &'a mut Self;
1170 fn take_or_borrow<'a>(
1171 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1172 ) -> Self::Borrowed<'a> {
1173 value
1174 }
1175 }
1176
1177 unsafe impl fidl::encoding::TypeMarker for ImagePipe2AddBufferCollectionRequest {
1178 type Owned = Self;
1179
1180 #[inline(always)]
1181 fn inline_align(_context: fidl::encoding::Context) -> usize {
1182 4
1183 }
1184
1185 #[inline(always)]
1186 fn inline_size(_context: fidl::encoding::Context) -> usize {
1187 8
1188 }
1189 }
1190
1191 unsafe impl
1192 fidl::encoding::Encode<
1193 ImagePipe2AddBufferCollectionRequest,
1194 fdomain_client::fidl::FDomainResourceDialect,
1195 > for &mut ImagePipe2AddBufferCollectionRequest
1196 {
1197 #[inline]
1198 unsafe fn encode(
1199 self,
1200 encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
1201 offset: usize,
1202 _depth: fidl::encoding::Depth,
1203 ) -> fidl::Result<()> {
1204 encoder.debug_check_bounds::<ImagePipe2AddBufferCollectionRequest>(offset);
1205 fidl::encoding::Encode::<
1207 ImagePipe2AddBufferCollectionRequest,
1208 fdomain_client::fidl::FDomainResourceDialect,
1209 >::encode(
1210 (
1211 <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.buffer_collection_id),
1212 <fidl::encoding::Endpoint<
1213 fdomain_client::fidl::ClientEnd<
1214 fdomain_fuchsia_sysmem::BufferCollectionTokenMarker,
1215 >,
1216 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
1217 &mut self.buffer_collection_token,
1218 ),
1219 ),
1220 encoder,
1221 offset,
1222 _depth,
1223 )
1224 }
1225 }
1226 unsafe impl<
1227 T0: fidl::encoding::Encode<u32, fdomain_client::fidl::FDomainResourceDialect>,
1228 T1: fidl::encoding::Encode<
1229 fidl::encoding::Endpoint<
1230 fdomain_client::fidl::ClientEnd<
1231 fdomain_fuchsia_sysmem::BufferCollectionTokenMarker,
1232 >,
1233 >,
1234 fdomain_client::fidl::FDomainResourceDialect,
1235 >,
1236 >
1237 fidl::encoding::Encode<
1238 ImagePipe2AddBufferCollectionRequest,
1239 fdomain_client::fidl::FDomainResourceDialect,
1240 > for (T0, T1)
1241 {
1242 #[inline]
1243 unsafe fn encode(
1244 self,
1245 encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
1246 offset: usize,
1247 depth: fidl::encoding::Depth,
1248 ) -> fidl::Result<()> {
1249 encoder.debug_check_bounds::<ImagePipe2AddBufferCollectionRequest>(offset);
1250 self.0.encode(encoder, offset + 0, depth)?;
1254 self.1.encode(encoder, offset + 4, depth)?;
1255 Ok(())
1256 }
1257 }
1258
1259 impl fidl::encoding::Decode<Self, fdomain_client::fidl::FDomainResourceDialect>
1260 for ImagePipe2AddBufferCollectionRequest
1261 {
1262 #[inline(always)]
1263 fn new_empty() -> Self {
1264 Self {
1265 buffer_collection_id: fidl::new_empty!(
1266 u32,
1267 fdomain_client::fidl::FDomainResourceDialect
1268 ),
1269 buffer_collection_token: fidl::new_empty!(
1270 fidl::encoding::Endpoint<
1271 fdomain_client::fidl::ClientEnd<
1272 fdomain_fuchsia_sysmem::BufferCollectionTokenMarker,
1273 >,
1274 >,
1275 fdomain_client::fidl::FDomainResourceDialect
1276 ),
1277 }
1278 }
1279
1280 #[inline]
1281 unsafe fn decode(
1282 &mut self,
1283 decoder: &mut fidl::encoding::Decoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
1284 offset: usize,
1285 _depth: fidl::encoding::Depth,
1286 ) -> fidl::Result<()> {
1287 decoder.debug_check_bounds::<Self>(offset);
1288 fidl::decode!(
1290 u32,
1291 fdomain_client::fidl::FDomainResourceDialect,
1292 &mut self.buffer_collection_id,
1293 decoder,
1294 offset + 0,
1295 _depth
1296 )?;
1297 fidl::decode!(
1298 fidl::encoding::Endpoint<
1299 fdomain_client::fidl::ClientEnd<
1300 fdomain_fuchsia_sysmem::BufferCollectionTokenMarker,
1301 >,
1302 >,
1303 fdomain_client::fidl::FDomainResourceDialect,
1304 &mut self.buffer_collection_token,
1305 decoder,
1306 offset + 4,
1307 _depth
1308 )?;
1309 Ok(())
1310 }
1311 }
1312
1313 impl fidl::encoding::ResourceTypeMarker for ImagePipe2PresentImageRequest {
1314 type Borrowed<'a> = &'a mut Self;
1315 fn take_or_borrow<'a>(
1316 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1317 ) -> Self::Borrowed<'a> {
1318 value
1319 }
1320 }
1321
1322 unsafe impl fidl::encoding::TypeMarker for ImagePipe2PresentImageRequest {
1323 type Owned = Self;
1324
1325 #[inline(always)]
1326 fn inline_align(_context: fidl::encoding::Context) -> usize {
1327 8
1328 }
1329
1330 #[inline(always)]
1331 fn inline_size(_context: fidl::encoding::Context) -> usize {
1332 48
1333 }
1334 }
1335
1336 unsafe impl
1337 fidl::encoding::Encode<
1338 ImagePipe2PresentImageRequest,
1339 fdomain_client::fidl::FDomainResourceDialect,
1340 > for &mut ImagePipe2PresentImageRequest
1341 {
1342 #[inline]
1343 unsafe fn encode(
1344 self,
1345 encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
1346 offset: usize,
1347 _depth: fidl::encoding::Depth,
1348 ) -> fidl::Result<()> {
1349 encoder.debug_check_bounds::<ImagePipe2PresentImageRequest>(offset);
1350 fidl::encoding::Encode::<
1352 ImagePipe2PresentImageRequest,
1353 fdomain_client::fidl::FDomainResourceDialect,
1354 >::encode(
1355 (
1356 <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.image_id),
1357 <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.presentation_time),
1358 <fidl::encoding::Vector<
1359 fidl::encoding::HandleType<
1360 fdomain_client::Event,
1361 { fidl::ObjectType::EVENT.into_raw() },
1362 2147483648,
1363 >,
1364 16,
1365 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
1366 &mut self.acquire_fences,
1367 ),
1368 <fidl::encoding::Vector<
1369 fidl::encoding::HandleType<
1370 fdomain_client::Event,
1371 { fidl::ObjectType::EVENT.into_raw() },
1372 2147483648,
1373 >,
1374 16,
1375 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
1376 &mut self.release_fences,
1377 ),
1378 ),
1379 encoder,
1380 offset,
1381 _depth,
1382 )
1383 }
1384 }
1385 unsafe impl<
1386 T0: fidl::encoding::Encode<u32, fdomain_client::fidl::FDomainResourceDialect>,
1387 T1: fidl::encoding::Encode<u64, fdomain_client::fidl::FDomainResourceDialect>,
1388 T2: fidl::encoding::Encode<
1389 fidl::encoding::Vector<
1390 fidl::encoding::HandleType<
1391 fdomain_client::Event,
1392 { fidl::ObjectType::EVENT.into_raw() },
1393 2147483648,
1394 >,
1395 16,
1396 >,
1397 fdomain_client::fidl::FDomainResourceDialect,
1398 >,
1399 T3: fidl::encoding::Encode<
1400 fidl::encoding::Vector<
1401 fidl::encoding::HandleType<
1402 fdomain_client::Event,
1403 { fidl::ObjectType::EVENT.into_raw() },
1404 2147483648,
1405 >,
1406 16,
1407 >,
1408 fdomain_client::fidl::FDomainResourceDialect,
1409 >,
1410 >
1411 fidl::encoding::Encode<
1412 ImagePipe2PresentImageRequest,
1413 fdomain_client::fidl::FDomainResourceDialect,
1414 > for (T0, T1, T2, T3)
1415 {
1416 #[inline]
1417 unsafe fn encode(
1418 self,
1419 encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
1420 offset: usize,
1421 depth: fidl::encoding::Depth,
1422 ) -> fidl::Result<()> {
1423 encoder.debug_check_bounds::<ImagePipe2PresentImageRequest>(offset);
1424 unsafe {
1427 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
1428 (ptr as *mut u64).write_unaligned(0);
1429 }
1430 self.0.encode(encoder, offset + 0, depth)?;
1432 self.1.encode(encoder, offset + 8, depth)?;
1433 self.2.encode(encoder, offset + 16, depth)?;
1434 self.3.encode(encoder, offset + 32, depth)?;
1435 Ok(())
1436 }
1437 }
1438
1439 impl fidl::encoding::Decode<Self, fdomain_client::fidl::FDomainResourceDialect>
1440 for ImagePipe2PresentImageRequest
1441 {
1442 #[inline(always)]
1443 fn new_empty() -> Self {
1444 Self {
1445 image_id: fidl::new_empty!(u32, fdomain_client::fidl::FDomainResourceDialect),
1446 presentation_time: fidl::new_empty!(
1447 u64,
1448 fdomain_client::fidl::FDomainResourceDialect
1449 ),
1450 acquire_fences: fidl::new_empty!(
1451 fidl::encoding::Vector<
1452 fidl::encoding::HandleType<
1453 fdomain_client::Event,
1454 { fidl::ObjectType::EVENT.into_raw() },
1455 2147483648,
1456 >,
1457 16,
1458 >,
1459 fdomain_client::fidl::FDomainResourceDialect
1460 ),
1461 release_fences: fidl::new_empty!(
1462 fidl::encoding::Vector<
1463 fidl::encoding::HandleType<
1464 fdomain_client::Event,
1465 { fidl::ObjectType::EVENT.into_raw() },
1466 2147483648,
1467 >,
1468 16,
1469 >,
1470 fdomain_client::fidl::FDomainResourceDialect
1471 ),
1472 }
1473 }
1474
1475 #[inline]
1476 unsafe fn decode(
1477 &mut self,
1478 decoder: &mut fidl::encoding::Decoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
1479 offset: usize,
1480 _depth: fidl::encoding::Depth,
1481 ) -> fidl::Result<()> {
1482 decoder.debug_check_bounds::<Self>(offset);
1483 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
1485 let padval = unsafe { (ptr as *const u64).read_unaligned() };
1486 let mask = 0xffffffff00000000u64;
1487 let maskedval = padval & mask;
1488 if maskedval != 0 {
1489 return Err(fidl::Error::NonZeroPadding {
1490 padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
1491 });
1492 }
1493 fidl::decode!(
1494 u32,
1495 fdomain_client::fidl::FDomainResourceDialect,
1496 &mut self.image_id,
1497 decoder,
1498 offset + 0,
1499 _depth
1500 )?;
1501 fidl::decode!(
1502 u64,
1503 fdomain_client::fidl::FDomainResourceDialect,
1504 &mut self.presentation_time,
1505 decoder,
1506 offset + 8,
1507 _depth
1508 )?;
1509 fidl::decode!(
1510 fidl::encoding::Vector<
1511 fidl::encoding::HandleType<
1512 fdomain_client::Event,
1513 { fidl::ObjectType::EVENT.into_raw() },
1514 2147483648,
1515 >,
1516 16,
1517 >,
1518 fdomain_client::fidl::FDomainResourceDialect,
1519 &mut self.acquire_fences,
1520 decoder,
1521 offset + 16,
1522 _depth
1523 )?;
1524 fidl::decode!(
1525 fidl::encoding::Vector<
1526 fidl::encoding::HandleType<
1527 fdomain_client::Event,
1528 { fidl::ObjectType::EVENT.into_raw() },
1529 2147483648,
1530 >,
1531 16,
1532 >,
1533 fdomain_client::fidl::FDomainResourceDialect,
1534 &mut self.release_fences,
1535 decoder,
1536 offset + 32,
1537 _depth
1538 )?;
1539 Ok(())
1540 }
1541 }
1542}