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 fdomain_client::fidl::ControlHandle for ImagePipe2ControlHandle {
930 fn shutdown(&self) {
931 self.inner.shutdown()
932 }
933
934 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
935 self.inner.shutdown_with_epitaph(status)
936 }
937
938 fn is_closed(&self) -> bool {
939 self.inner.channel().is_closed()
940 }
941 fn on_closed(&self) -> fdomain_client::OnFDomainSignals {
942 self.inner.channel().on_closed()
943 }
944}
945
946impl ImagePipe2ControlHandle {}
947
948#[must_use = "FIDL methods require a response to be sent"]
949#[derive(Debug)]
950pub struct ImagePipe2PresentImageResponder {
951 control_handle: std::mem::ManuallyDrop<ImagePipe2ControlHandle>,
952 tx_id: u32,
953}
954
955impl std::ops::Drop for ImagePipe2PresentImageResponder {
959 fn drop(&mut self) {
960 self.control_handle.shutdown();
961 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
963 }
964}
965
966impl fdomain_client::fidl::Responder for ImagePipe2PresentImageResponder {
967 type ControlHandle = ImagePipe2ControlHandle;
968
969 fn control_handle(&self) -> &ImagePipe2ControlHandle {
970 &self.control_handle
971 }
972
973 fn drop_without_shutdown(mut self) {
974 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
976 std::mem::forget(self);
978 }
979}
980
981impl ImagePipe2PresentImageResponder {
982 pub fn send(self, mut presentation_info: &PresentationInfo) -> Result<(), fidl::Error> {
986 let _result = self.send_raw(presentation_info);
987 if _result.is_err() {
988 self.control_handle.shutdown();
989 }
990 self.drop_without_shutdown();
991 _result
992 }
993
994 pub fn send_no_shutdown_on_err(
996 self,
997 mut presentation_info: &PresentationInfo,
998 ) -> Result<(), fidl::Error> {
999 let _result = self.send_raw(presentation_info);
1000 self.drop_without_shutdown();
1001 _result
1002 }
1003
1004 fn send_raw(&self, mut presentation_info: &PresentationInfo) -> Result<(), fidl::Error> {
1005 self.control_handle.inner.send::<ImagePipe2PresentImageResponse>(
1006 (presentation_info,),
1007 self.tx_id,
1008 0x73cfb50f577c143a,
1009 fidl::encoding::DynamicFlags::empty(),
1010 )
1011 }
1012}
1013
1014mod internal {
1015 use super::*;
1016
1017 impl fidl::encoding::ResourceTypeMarker for ImagePipe2AddBufferCollection2Request {
1018 type Borrowed<'a> = &'a mut Self;
1019 fn take_or_borrow<'a>(
1020 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1021 ) -> Self::Borrowed<'a> {
1022 value
1023 }
1024 }
1025
1026 unsafe impl fidl::encoding::TypeMarker for ImagePipe2AddBufferCollection2Request {
1027 type Owned = Self;
1028
1029 #[inline(always)]
1030 fn inline_align(_context: fidl::encoding::Context) -> usize {
1031 4
1032 }
1033
1034 #[inline(always)]
1035 fn inline_size(_context: fidl::encoding::Context) -> usize {
1036 8
1037 }
1038 }
1039
1040 unsafe impl
1041 fidl::encoding::Encode<
1042 ImagePipe2AddBufferCollection2Request,
1043 fdomain_client::fidl::FDomainResourceDialect,
1044 > for &mut ImagePipe2AddBufferCollection2Request
1045 {
1046 #[inline]
1047 unsafe fn encode(
1048 self,
1049 encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
1050 offset: usize,
1051 _depth: fidl::encoding::Depth,
1052 ) -> fidl::Result<()> {
1053 encoder.debug_check_bounds::<ImagePipe2AddBufferCollection2Request>(offset);
1054 fidl::encoding::Encode::<
1056 ImagePipe2AddBufferCollection2Request,
1057 fdomain_client::fidl::FDomainResourceDialect,
1058 >::encode(
1059 (
1060 <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.buffer_collection_id),
1061 <fidl::encoding::Endpoint<
1062 fdomain_client::fidl::ClientEnd<
1063 fdomain_fuchsia_sysmem2::BufferCollectionTokenMarker,
1064 >,
1065 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
1066 &mut self.buffer_collection_token,
1067 ),
1068 ),
1069 encoder,
1070 offset,
1071 _depth,
1072 )
1073 }
1074 }
1075 unsafe impl<
1076 T0: fidl::encoding::Encode<u32, fdomain_client::fidl::FDomainResourceDialect>,
1077 T1: fidl::encoding::Encode<
1078 fidl::encoding::Endpoint<
1079 fdomain_client::fidl::ClientEnd<
1080 fdomain_fuchsia_sysmem2::BufferCollectionTokenMarker,
1081 >,
1082 >,
1083 fdomain_client::fidl::FDomainResourceDialect,
1084 >,
1085 >
1086 fidl::encoding::Encode<
1087 ImagePipe2AddBufferCollection2Request,
1088 fdomain_client::fidl::FDomainResourceDialect,
1089 > for (T0, T1)
1090 {
1091 #[inline]
1092 unsafe fn encode(
1093 self,
1094 encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
1095 offset: usize,
1096 depth: fidl::encoding::Depth,
1097 ) -> fidl::Result<()> {
1098 encoder.debug_check_bounds::<ImagePipe2AddBufferCollection2Request>(offset);
1099 self.0.encode(encoder, offset + 0, depth)?;
1103 self.1.encode(encoder, offset + 4, depth)?;
1104 Ok(())
1105 }
1106 }
1107
1108 impl fidl::encoding::Decode<Self, fdomain_client::fidl::FDomainResourceDialect>
1109 for ImagePipe2AddBufferCollection2Request
1110 {
1111 #[inline(always)]
1112 fn new_empty() -> Self {
1113 Self {
1114 buffer_collection_id: fidl::new_empty!(
1115 u32,
1116 fdomain_client::fidl::FDomainResourceDialect
1117 ),
1118 buffer_collection_token: fidl::new_empty!(
1119 fidl::encoding::Endpoint<
1120 fdomain_client::fidl::ClientEnd<
1121 fdomain_fuchsia_sysmem2::BufferCollectionTokenMarker,
1122 >,
1123 >,
1124 fdomain_client::fidl::FDomainResourceDialect
1125 ),
1126 }
1127 }
1128
1129 #[inline]
1130 unsafe fn decode(
1131 &mut self,
1132 decoder: &mut fidl::encoding::Decoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
1133 offset: usize,
1134 _depth: fidl::encoding::Depth,
1135 ) -> fidl::Result<()> {
1136 decoder.debug_check_bounds::<Self>(offset);
1137 fidl::decode!(
1139 u32,
1140 fdomain_client::fidl::FDomainResourceDialect,
1141 &mut self.buffer_collection_id,
1142 decoder,
1143 offset + 0,
1144 _depth
1145 )?;
1146 fidl::decode!(
1147 fidl::encoding::Endpoint<
1148 fdomain_client::fidl::ClientEnd<
1149 fdomain_fuchsia_sysmem2::BufferCollectionTokenMarker,
1150 >,
1151 >,
1152 fdomain_client::fidl::FDomainResourceDialect,
1153 &mut self.buffer_collection_token,
1154 decoder,
1155 offset + 4,
1156 _depth
1157 )?;
1158 Ok(())
1159 }
1160 }
1161
1162 impl fidl::encoding::ResourceTypeMarker for ImagePipe2AddBufferCollectionRequest {
1163 type Borrowed<'a> = &'a mut Self;
1164 fn take_or_borrow<'a>(
1165 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1166 ) -> Self::Borrowed<'a> {
1167 value
1168 }
1169 }
1170
1171 unsafe impl fidl::encoding::TypeMarker for ImagePipe2AddBufferCollectionRequest {
1172 type Owned = Self;
1173
1174 #[inline(always)]
1175 fn inline_align(_context: fidl::encoding::Context) -> usize {
1176 4
1177 }
1178
1179 #[inline(always)]
1180 fn inline_size(_context: fidl::encoding::Context) -> usize {
1181 8
1182 }
1183 }
1184
1185 unsafe impl
1186 fidl::encoding::Encode<
1187 ImagePipe2AddBufferCollectionRequest,
1188 fdomain_client::fidl::FDomainResourceDialect,
1189 > for &mut ImagePipe2AddBufferCollectionRequest
1190 {
1191 #[inline]
1192 unsafe fn encode(
1193 self,
1194 encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
1195 offset: usize,
1196 _depth: fidl::encoding::Depth,
1197 ) -> fidl::Result<()> {
1198 encoder.debug_check_bounds::<ImagePipe2AddBufferCollectionRequest>(offset);
1199 fidl::encoding::Encode::<
1201 ImagePipe2AddBufferCollectionRequest,
1202 fdomain_client::fidl::FDomainResourceDialect,
1203 >::encode(
1204 (
1205 <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.buffer_collection_id),
1206 <fidl::encoding::Endpoint<
1207 fdomain_client::fidl::ClientEnd<
1208 fdomain_fuchsia_sysmem::BufferCollectionTokenMarker,
1209 >,
1210 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
1211 &mut self.buffer_collection_token,
1212 ),
1213 ),
1214 encoder,
1215 offset,
1216 _depth,
1217 )
1218 }
1219 }
1220 unsafe impl<
1221 T0: fidl::encoding::Encode<u32, fdomain_client::fidl::FDomainResourceDialect>,
1222 T1: fidl::encoding::Encode<
1223 fidl::encoding::Endpoint<
1224 fdomain_client::fidl::ClientEnd<
1225 fdomain_fuchsia_sysmem::BufferCollectionTokenMarker,
1226 >,
1227 >,
1228 fdomain_client::fidl::FDomainResourceDialect,
1229 >,
1230 >
1231 fidl::encoding::Encode<
1232 ImagePipe2AddBufferCollectionRequest,
1233 fdomain_client::fidl::FDomainResourceDialect,
1234 > for (T0, T1)
1235 {
1236 #[inline]
1237 unsafe fn encode(
1238 self,
1239 encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
1240 offset: usize,
1241 depth: fidl::encoding::Depth,
1242 ) -> fidl::Result<()> {
1243 encoder.debug_check_bounds::<ImagePipe2AddBufferCollectionRequest>(offset);
1244 self.0.encode(encoder, offset + 0, depth)?;
1248 self.1.encode(encoder, offset + 4, depth)?;
1249 Ok(())
1250 }
1251 }
1252
1253 impl fidl::encoding::Decode<Self, fdomain_client::fidl::FDomainResourceDialect>
1254 for ImagePipe2AddBufferCollectionRequest
1255 {
1256 #[inline(always)]
1257 fn new_empty() -> Self {
1258 Self {
1259 buffer_collection_id: fidl::new_empty!(
1260 u32,
1261 fdomain_client::fidl::FDomainResourceDialect
1262 ),
1263 buffer_collection_token: fidl::new_empty!(
1264 fidl::encoding::Endpoint<
1265 fdomain_client::fidl::ClientEnd<
1266 fdomain_fuchsia_sysmem::BufferCollectionTokenMarker,
1267 >,
1268 >,
1269 fdomain_client::fidl::FDomainResourceDialect
1270 ),
1271 }
1272 }
1273
1274 #[inline]
1275 unsafe fn decode(
1276 &mut self,
1277 decoder: &mut fidl::encoding::Decoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
1278 offset: usize,
1279 _depth: fidl::encoding::Depth,
1280 ) -> fidl::Result<()> {
1281 decoder.debug_check_bounds::<Self>(offset);
1282 fidl::decode!(
1284 u32,
1285 fdomain_client::fidl::FDomainResourceDialect,
1286 &mut self.buffer_collection_id,
1287 decoder,
1288 offset + 0,
1289 _depth
1290 )?;
1291 fidl::decode!(
1292 fidl::encoding::Endpoint<
1293 fdomain_client::fidl::ClientEnd<
1294 fdomain_fuchsia_sysmem::BufferCollectionTokenMarker,
1295 >,
1296 >,
1297 fdomain_client::fidl::FDomainResourceDialect,
1298 &mut self.buffer_collection_token,
1299 decoder,
1300 offset + 4,
1301 _depth
1302 )?;
1303 Ok(())
1304 }
1305 }
1306
1307 impl fidl::encoding::ResourceTypeMarker for ImagePipe2PresentImageRequest {
1308 type Borrowed<'a> = &'a mut Self;
1309 fn take_or_borrow<'a>(
1310 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1311 ) -> Self::Borrowed<'a> {
1312 value
1313 }
1314 }
1315
1316 unsafe impl fidl::encoding::TypeMarker for ImagePipe2PresentImageRequest {
1317 type Owned = Self;
1318
1319 #[inline(always)]
1320 fn inline_align(_context: fidl::encoding::Context) -> usize {
1321 8
1322 }
1323
1324 #[inline(always)]
1325 fn inline_size(_context: fidl::encoding::Context) -> usize {
1326 48
1327 }
1328 }
1329
1330 unsafe impl
1331 fidl::encoding::Encode<
1332 ImagePipe2PresentImageRequest,
1333 fdomain_client::fidl::FDomainResourceDialect,
1334 > for &mut ImagePipe2PresentImageRequest
1335 {
1336 #[inline]
1337 unsafe fn encode(
1338 self,
1339 encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
1340 offset: usize,
1341 _depth: fidl::encoding::Depth,
1342 ) -> fidl::Result<()> {
1343 encoder.debug_check_bounds::<ImagePipe2PresentImageRequest>(offset);
1344 fidl::encoding::Encode::<
1346 ImagePipe2PresentImageRequest,
1347 fdomain_client::fidl::FDomainResourceDialect,
1348 >::encode(
1349 (
1350 <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.image_id),
1351 <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.presentation_time),
1352 <fidl::encoding::Vector<
1353 fidl::encoding::HandleType<
1354 fdomain_client::Event,
1355 { fidl::ObjectType::EVENT.into_raw() },
1356 2147483648,
1357 >,
1358 16,
1359 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
1360 &mut self.acquire_fences,
1361 ),
1362 <fidl::encoding::Vector<
1363 fidl::encoding::HandleType<
1364 fdomain_client::Event,
1365 { fidl::ObjectType::EVENT.into_raw() },
1366 2147483648,
1367 >,
1368 16,
1369 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
1370 &mut self.release_fences,
1371 ),
1372 ),
1373 encoder,
1374 offset,
1375 _depth,
1376 )
1377 }
1378 }
1379 unsafe impl<
1380 T0: fidl::encoding::Encode<u32, fdomain_client::fidl::FDomainResourceDialect>,
1381 T1: fidl::encoding::Encode<u64, fdomain_client::fidl::FDomainResourceDialect>,
1382 T2: fidl::encoding::Encode<
1383 fidl::encoding::Vector<
1384 fidl::encoding::HandleType<
1385 fdomain_client::Event,
1386 { fidl::ObjectType::EVENT.into_raw() },
1387 2147483648,
1388 >,
1389 16,
1390 >,
1391 fdomain_client::fidl::FDomainResourceDialect,
1392 >,
1393 T3: fidl::encoding::Encode<
1394 fidl::encoding::Vector<
1395 fidl::encoding::HandleType<
1396 fdomain_client::Event,
1397 { fidl::ObjectType::EVENT.into_raw() },
1398 2147483648,
1399 >,
1400 16,
1401 >,
1402 fdomain_client::fidl::FDomainResourceDialect,
1403 >,
1404 >
1405 fidl::encoding::Encode<
1406 ImagePipe2PresentImageRequest,
1407 fdomain_client::fidl::FDomainResourceDialect,
1408 > for (T0, T1, T2, T3)
1409 {
1410 #[inline]
1411 unsafe fn encode(
1412 self,
1413 encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
1414 offset: usize,
1415 depth: fidl::encoding::Depth,
1416 ) -> fidl::Result<()> {
1417 encoder.debug_check_bounds::<ImagePipe2PresentImageRequest>(offset);
1418 unsafe {
1421 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
1422 (ptr as *mut u64).write_unaligned(0);
1423 }
1424 self.0.encode(encoder, offset + 0, depth)?;
1426 self.1.encode(encoder, offset + 8, depth)?;
1427 self.2.encode(encoder, offset + 16, depth)?;
1428 self.3.encode(encoder, offset + 32, depth)?;
1429 Ok(())
1430 }
1431 }
1432
1433 impl fidl::encoding::Decode<Self, fdomain_client::fidl::FDomainResourceDialect>
1434 for ImagePipe2PresentImageRequest
1435 {
1436 #[inline(always)]
1437 fn new_empty() -> Self {
1438 Self {
1439 image_id: fidl::new_empty!(u32, fdomain_client::fidl::FDomainResourceDialect),
1440 presentation_time: fidl::new_empty!(
1441 u64,
1442 fdomain_client::fidl::FDomainResourceDialect
1443 ),
1444 acquire_fences: fidl::new_empty!(
1445 fidl::encoding::Vector<
1446 fidl::encoding::HandleType<
1447 fdomain_client::Event,
1448 { fidl::ObjectType::EVENT.into_raw() },
1449 2147483648,
1450 >,
1451 16,
1452 >,
1453 fdomain_client::fidl::FDomainResourceDialect
1454 ),
1455 release_fences: fidl::new_empty!(
1456 fidl::encoding::Vector<
1457 fidl::encoding::HandleType<
1458 fdomain_client::Event,
1459 { fidl::ObjectType::EVENT.into_raw() },
1460 2147483648,
1461 >,
1462 16,
1463 >,
1464 fdomain_client::fidl::FDomainResourceDialect
1465 ),
1466 }
1467 }
1468
1469 #[inline]
1470 unsafe fn decode(
1471 &mut self,
1472 decoder: &mut fidl::encoding::Decoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
1473 offset: usize,
1474 _depth: fidl::encoding::Depth,
1475 ) -> fidl::Result<()> {
1476 decoder.debug_check_bounds::<Self>(offset);
1477 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
1479 let padval = unsafe { (ptr as *const u64).read_unaligned() };
1480 let mask = 0xffffffff00000000u64;
1481 let maskedval = padval & mask;
1482 if maskedval != 0 {
1483 return Err(fidl::Error::NonZeroPadding {
1484 padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
1485 });
1486 }
1487 fidl::decode!(
1488 u32,
1489 fdomain_client::fidl::FDomainResourceDialect,
1490 &mut self.image_id,
1491 decoder,
1492 offset + 0,
1493 _depth
1494 )?;
1495 fidl::decode!(
1496 u64,
1497 fdomain_client::fidl::FDomainResourceDialect,
1498 &mut self.presentation_time,
1499 decoder,
1500 offset + 8,
1501 _depth
1502 )?;
1503 fidl::decode!(
1504 fidl::encoding::Vector<
1505 fidl::encoding::HandleType<
1506 fdomain_client::Event,
1507 { fidl::ObjectType::EVENT.into_raw() },
1508 2147483648,
1509 >,
1510 16,
1511 >,
1512 fdomain_client::fidl::FDomainResourceDialect,
1513 &mut self.acquire_fences,
1514 decoder,
1515 offset + 16,
1516 _depth
1517 )?;
1518 fidl::decode!(
1519 fidl::encoding::Vector<
1520 fidl::encoding::HandleType<
1521 fdomain_client::Event,
1522 { fidl::ObjectType::EVENT.into_raw() },
1523 2147483648,
1524 >,
1525 16,
1526 >,
1527 fdomain_client::fidl::FDomainResourceDialect,
1528 &mut self.release_fences,
1529 decoder,
1530 offset + 32,
1531 _depth
1532 )?;
1533 Ok(())
1534 }
1535 }
1536}