1#![warn(clippy::all)]
4#![allow(unused_parens, unused_mut, unused_imports, nonstandard_style)]
5
6use bitflags::bitflags;
7use fidl::encoding::{MessageBufFor, ProxyChannelBox, ResourceDialect};
8use futures::future::{self, MaybeDone, TryFutureExt};
9use zx_status;
10
11pub const MAX_ACQUIRE_RELEASE_FENCE_COUNT: i32 = 16;
12
13#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
15#[repr(u32)]
16pub enum AlphaFormat {
17 Opaque = 0,
20 Premultiplied = 1,
23 NonPremultiplied = 2,
26}
27
28impl AlphaFormat {
29 #[inline]
30 pub fn from_primitive(prim: u32) -> Option<Self> {
31 match prim {
32 0 => Some(Self::Opaque),
33 1 => Some(Self::Premultiplied),
34 2 => Some(Self::NonPremultiplied),
35 _ => None,
36 }
37 }
38
39 #[inline]
40 pub const fn into_primitive(self) -> u32 {
41 self as u32
42 }
43}
44
45#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
47#[repr(u32)]
48pub enum ColorSpace {
49 Srgb = 0,
50}
51
52impl ColorSpace {
53 #[inline]
54 pub fn from_primitive(prim: u32) -> Option<Self> {
55 match prim {
56 0 => Some(Self::Srgb),
57 _ => None,
58 }
59 }
60
61 #[inline]
62 pub const fn into_primitive(self) -> u32 {
63 self as u32
64 }
65}
66
67#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
69#[repr(u32)]
70pub enum MemoryType {
71 HostMemory = 0,
73 VkDeviceMemory = 1,
76}
77
78impl MemoryType {
79 #[inline]
80 pub fn from_primitive(prim: u32) -> Option<Self> {
81 match prim {
82 0 => Some(Self::HostMemory),
83 1 => Some(Self::VkDeviceMemory),
84 _ => None,
85 }
86 }
87
88 #[inline]
89 pub const fn into_primitive(self) -> u32 {
90 self as u32
91 }
92}
93
94#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
96#[repr(u32)]
97pub enum PixelFormat {
98 Bgra8 = 0,
105 Yuy2 = 1,
115 Nv12 = 2,
140 Yv12 = 3,
157 R8G8B8A8 = 4,
166}
167
168impl PixelFormat {
169 #[inline]
170 pub fn from_primitive(prim: u32) -> Option<Self> {
171 match prim {
172 0 => Some(Self::Bgra8),
173 1 => Some(Self::Yuy2),
174 2 => Some(Self::Nv12),
175 3 => Some(Self::Yv12),
176 4 => Some(Self::R8G8B8A8),
177 _ => None,
178 }
179 }
180
181 #[inline]
182 pub const fn into_primitive(self) -> u32 {
183 self as u32
184 }
185}
186
187#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
189#[repr(u32)]
190pub enum Tiling {
191 Linear = 0,
194 GpuOptimal = 1,
197}
198
199impl Tiling {
200 #[inline]
201 pub fn from_primitive(prim: u32) -> Option<Self> {
202 match prim {
203 0 => Some(Self::Linear),
204 1 => Some(Self::GpuOptimal),
205 _ => None,
206 }
207 }
208
209 #[inline]
210 pub const fn into_primitive(self) -> u32 {
211 self as u32
212 }
213}
214
215#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
216#[repr(u32)]
217pub enum Transform {
218 Normal = 0,
220 FlipHorizontal = 1,
222 FlipVertical = 2,
224 FlipVerticalAndHorizontal = 3,
226}
227
228impl Transform {
229 #[inline]
230 pub fn from_primitive(prim: u32) -> Option<Self> {
231 match prim {
232 0 => Some(Self::Normal),
233 1 => Some(Self::FlipHorizontal),
234 2 => Some(Self::FlipVertical),
235 3 => Some(Self::FlipVerticalAndHorizontal),
236 _ => None,
237 }
238 }
239
240 #[inline]
241 pub const fn into_primitive(self) -> u32 {
242 self as u32
243 }
244}
245
246#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
248pub struct ImageInfo {
249 pub transform: Transform,
251 pub width: u32,
253 pub height: u32,
254 pub stride: u32,
256 pub pixel_format: PixelFormat,
258 pub color_space: ColorSpace,
260 pub tiling: Tiling,
262 pub alpha_format: AlphaFormat,
264}
265
266impl fidl::Persistable for ImageInfo {}
267
268#[derive(Clone, Debug, PartialEq)]
269pub struct ImagePipe2AddImageRequest {
270 pub image_id: u32,
271 pub buffer_collection_id: u32,
272 pub buffer_collection_index: u32,
273 pub image_format: fidl_fuchsia_sysmem::ImageFormat2,
274}
275
276impl fidl::Persistable for ImagePipe2AddImageRequest {}
277
278#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
279#[repr(C)]
280pub struct ImagePipe2PresentImageResponse {
281 pub presentation_info: PresentationInfo,
282}
283
284impl fidl::Persistable for ImagePipe2PresentImageResponse {}
285
286#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
287#[repr(C)]
288pub struct ImagePipe2RemoveBufferCollectionRequest {
289 pub buffer_collection_id: u32,
290}
291
292impl fidl::Persistable for ImagePipe2RemoveBufferCollectionRequest {}
293
294#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
295#[repr(C)]
296pub struct ImagePipe2RemoveImageRequest {
297 pub image_id: u32,
298}
299
300impl fidl::Persistable for ImagePipe2RemoveImageRequest {}
301
302#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
306#[repr(C)]
307pub struct PresentationInfo {
308 pub presentation_time: u64,
315 pub presentation_interval: u64,
323}
324
325impl fidl::Persistable for PresentationInfo {}
326
327mod internal {
328 use super::*;
329 unsafe impl fidl::encoding::TypeMarker for AlphaFormat {
330 type Owned = Self;
331
332 #[inline(always)]
333 fn inline_align(_context: fidl::encoding::Context) -> usize {
334 std::mem::align_of::<u32>()
335 }
336
337 #[inline(always)]
338 fn inline_size(_context: fidl::encoding::Context) -> usize {
339 std::mem::size_of::<u32>()
340 }
341
342 #[inline(always)]
343 fn encode_is_copy() -> bool {
344 true
345 }
346
347 #[inline(always)]
348 fn decode_is_copy() -> bool {
349 false
350 }
351 }
352
353 impl fidl::encoding::ValueTypeMarker for AlphaFormat {
354 type Borrowed<'a> = Self;
355 #[inline(always)]
356 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
357 *value
358 }
359 }
360
361 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for AlphaFormat {
362 #[inline]
363 unsafe fn encode(
364 self,
365 encoder: &mut fidl::encoding::Encoder<'_, D>,
366 offset: usize,
367 _depth: fidl::encoding::Depth,
368 ) -> fidl::Result<()> {
369 encoder.debug_check_bounds::<Self>(offset);
370 encoder.write_num(self.into_primitive(), offset);
371 Ok(())
372 }
373 }
374
375 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for AlphaFormat {
376 #[inline(always)]
377 fn new_empty() -> Self {
378 Self::Opaque
379 }
380
381 #[inline]
382 unsafe fn decode(
383 &mut self,
384 decoder: &mut fidl::encoding::Decoder<'_, D>,
385 offset: usize,
386 _depth: fidl::encoding::Depth,
387 ) -> fidl::Result<()> {
388 decoder.debug_check_bounds::<Self>(offset);
389 let prim = decoder.read_num::<u32>(offset);
390
391 *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
392 Ok(())
393 }
394 }
395 unsafe impl fidl::encoding::TypeMarker for ColorSpace {
396 type Owned = Self;
397
398 #[inline(always)]
399 fn inline_align(_context: fidl::encoding::Context) -> usize {
400 std::mem::align_of::<u32>()
401 }
402
403 #[inline(always)]
404 fn inline_size(_context: fidl::encoding::Context) -> usize {
405 std::mem::size_of::<u32>()
406 }
407
408 #[inline(always)]
409 fn encode_is_copy() -> bool {
410 true
411 }
412
413 #[inline(always)]
414 fn decode_is_copy() -> bool {
415 false
416 }
417 }
418
419 impl fidl::encoding::ValueTypeMarker for ColorSpace {
420 type Borrowed<'a> = Self;
421 #[inline(always)]
422 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
423 *value
424 }
425 }
426
427 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for ColorSpace {
428 #[inline]
429 unsafe fn encode(
430 self,
431 encoder: &mut fidl::encoding::Encoder<'_, D>,
432 offset: usize,
433 _depth: fidl::encoding::Depth,
434 ) -> fidl::Result<()> {
435 encoder.debug_check_bounds::<Self>(offset);
436 encoder.write_num(self.into_primitive(), offset);
437 Ok(())
438 }
439 }
440
441 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ColorSpace {
442 #[inline(always)]
443 fn new_empty() -> Self {
444 Self::Srgb
445 }
446
447 #[inline]
448 unsafe fn decode(
449 &mut self,
450 decoder: &mut fidl::encoding::Decoder<'_, D>,
451 offset: usize,
452 _depth: fidl::encoding::Depth,
453 ) -> fidl::Result<()> {
454 decoder.debug_check_bounds::<Self>(offset);
455 let prim = decoder.read_num::<u32>(offset);
456
457 *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
458 Ok(())
459 }
460 }
461 unsafe impl fidl::encoding::TypeMarker for MemoryType {
462 type Owned = Self;
463
464 #[inline(always)]
465 fn inline_align(_context: fidl::encoding::Context) -> usize {
466 std::mem::align_of::<u32>()
467 }
468
469 #[inline(always)]
470 fn inline_size(_context: fidl::encoding::Context) -> usize {
471 std::mem::size_of::<u32>()
472 }
473
474 #[inline(always)]
475 fn encode_is_copy() -> bool {
476 true
477 }
478
479 #[inline(always)]
480 fn decode_is_copy() -> bool {
481 false
482 }
483 }
484
485 impl fidl::encoding::ValueTypeMarker for MemoryType {
486 type Borrowed<'a> = Self;
487 #[inline(always)]
488 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
489 *value
490 }
491 }
492
493 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for MemoryType {
494 #[inline]
495 unsafe fn encode(
496 self,
497 encoder: &mut fidl::encoding::Encoder<'_, D>,
498 offset: usize,
499 _depth: fidl::encoding::Depth,
500 ) -> fidl::Result<()> {
501 encoder.debug_check_bounds::<Self>(offset);
502 encoder.write_num(self.into_primitive(), offset);
503 Ok(())
504 }
505 }
506
507 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for MemoryType {
508 #[inline(always)]
509 fn new_empty() -> Self {
510 Self::HostMemory
511 }
512
513 #[inline]
514 unsafe fn decode(
515 &mut self,
516 decoder: &mut fidl::encoding::Decoder<'_, D>,
517 offset: usize,
518 _depth: fidl::encoding::Depth,
519 ) -> fidl::Result<()> {
520 decoder.debug_check_bounds::<Self>(offset);
521 let prim = decoder.read_num::<u32>(offset);
522
523 *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
524 Ok(())
525 }
526 }
527 unsafe impl fidl::encoding::TypeMarker for PixelFormat {
528 type Owned = Self;
529
530 #[inline(always)]
531 fn inline_align(_context: fidl::encoding::Context) -> usize {
532 std::mem::align_of::<u32>()
533 }
534
535 #[inline(always)]
536 fn inline_size(_context: fidl::encoding::Context) -> usize {
537 std::mem::size_of::<u32>()
538 }
539
540 #[inline(always)]
541 fn encode_is_copy() -> bool {
542 true
543 }
544
545 #[inline(always)]
546 fn decode_is_copy() -> bool {
547 false
548 }
549 }
550
551 impl fidl::encoding::ValueTypeMarker for PixelFormat {
552 type Borrowed<'a> = Self;
553 #[inline(always)]
554 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
555 *value
556 }
557 }
558
559 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for PixelFormat {
560 #[inline]
561 unsafe fn encode(
562 self,
563 encoder: &mut fidl::encoding::Encoder<'_, D>,
564 offset: usize,
565 _depth: fidl::encoding::Depth,
566 ) -> fidl::Result<()> {
567 encoder.debug_check_bounds::<Self>(offset);
568 encoder.write_num(self.into_primitive(), offset);
569 Ok(())
570 }
571 }
572
573 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for PixelFormat {
574 #[inline(always)]
575 fn new_empty() -> Self {
576 Self::Bgra8
577 }
578
579 #[inline]
580 unsafe fn decode(
581 &mut self,
582 decoder: &mut fidl::encoding::Decoder<'_, D>,
583 offset: usize,
584 _depth: fidl::encoding::Depth,
585 ) -> fidl::Result<()> {
586 decoder.debug_check_bounds::<Self>(offset);
587 let prim = decoder.read_num::<u32>(offset);
588
589 *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
590 Ok(())
591 }
592 }
593 unsafe impl fidl::encoding::TypeMarker for Tiling {
594 type Owned = Self;
595
596 #[inline(always)]
597 fn inline_align(_context: fidl::encoding::Context) -> usize {
598 std::mem::align_of::<u32>()
599 }
600
601 #[inline(always)]
602 fn inline_size(_context: fidl::encoding::Context) -> usize {
603 std::mem::size_of::<u32>()
604 }
605
606 #[inline(always)]
607 fn encode_is_copy() -> bool {
608 true
609 }
610
611 #[inline(always)]
612 fn decode_is_copy() -> bool {
613 false
614 }
615 }
616
617 impl fidl::encoding::ValueTypeMarker for Tiling {
618 type Borrowed<'a> = Self;
619 #[inline(always)]
620 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
621 *value
622 }
623 }
624
625 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for Tiling {
626 #[inline]
627 unsafe fn encode(
628 self,
629 encoder: &mut fidl::encoding::Encoder<'_, D>,
630 offset: usize,
631 _depth: fidl::encoding::Depth,
632 ) -> fidl::Result<()> {
633 encoder.debug_check_bounds::<Self>(offset);
634 encoder.write_num(self.into_primitive(), offset);
635 Ok(())
636 }
637 }
638
639 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Tiling {
640 #[inline(always)]
641 fn new_empty() -> Self {
642 Self::Linear
643 }
644
645 #[inline]
646 unsafe fn decode(
647 &mut self,
648 decoder: &mut fidl::encoding::Decoder<'_, D>,
649 offset: usize,
650 _depth: fidl::encoding::Depth,
651 ) -> fidl::Result<()> {
652 decoder.debug_check_bounds::<Self>(offset);
653 let prim = decoder.read_num::<u32>(offset);
654
655 *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
656 Ok(())
657 }
658 }
659 unsafe impl fidl::encoding::TypeMarker for Transform {
660 type Owned = Self;
661
662 #[inline(always)]
663 fn inline_align(_context: fidl::encoding::Context) -> usize {
664 std::mem::align_of::<u32>()
665 }
666
667 #[inline(always)]
668 fn inline_size(_context: fidl::encoding::Context) -> usize {
669 std::mem::size_of::<u32>()
670 }
671
672 #[inline(always)]
673 fn encode_is_copy() -> bool {
674 true
675 }
676
677 #[inline(always)]
678 fn decode_is_copy() -> bool {
679 false
680 }
681 }
682
683 impl fidl::encoding::ValueTypeMarker for Transform {
684 type Borrowed<'a> = Self;
685 #[inline(always)]
686 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
687 *value
688 }
689 }
690
691 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for Transform {
692 #[inline]
693 unsafe fn encode(
694 self,
695 encoder: &mut fidl::encoding::Encoder<'_, D>,
696 offset: usize,
697 _depth: fidl::encoding::Depth,
698 ) -> fidl::Result<()> {
699 encoder.debug_check_bounds::<Self>(offset);
700 encoder.write_num(self.into_primitive(), offset);
701 Ok(())
702 }
703 }
704
705 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Transform {
706 #[inline(always)]
707 fn new_empty() -> Self {
708 Self::Normal
709 }
710
711 #[inline]
712 unsafe fn decode(
713 &mut self,
714 decoder: &mut fidl::encoding::Decoder<'_, D>,
715 offset: usize,
716 _depth: fidl::encoding::Depth,
717 ) -> fidl::Result<()> {
718 decoder.debug_check_bounds::<Self>(offset);
719 let prim = decoder.read_num::<u32>(offset);
720
721 *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
722 Ok(())
723 }
724 }
725
726 impl fidl::encoding::ValueTypeMarker for ImageInfo {
727 type Borrowed<'a> = &'a Self;
728 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
729 value
730 }
731 }
732
733 unsafe impl fidl::encoding::TypeMarker for ImageInfo {
734 type Owned = Self;
735
736 #[inline(always)]
737 fn inline_align(_context: fidl::encoding::Context) -> usize {
738 4
739 }
740
741 #[inline(always)]
742 fn inline_size(_context: fidl::encoding::Context) -> usize {
743 32
744 }
745 }
746
747 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<ImageInfo, D>
748 for &ImageInfo
749 {
750 #[inline]
751 unsafe fn encode(
752 self,
753 encoder: &mut fidl::encoding::Encoder<'_, D>,
754 offset: usize,
755 _depth: fidl::encoding::Depth,
756 ) -> fidl::Result<()> {
757 encoder.debug_check_bounds::<ImageInfo>(offset);
758 fidl::encoding::Encode::<ImageInfo, D>::encode(
760 (
761 <Transform as fidl::encoding::ValueTypeMarker>::borrow(&self.transform),
762 <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.width),
763 <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.height),
764 <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.stride),
765 <PixelFormat as fidl::encoding::ValueTypeMarker>::borrow(&self.pixel_format),
766 <ColorSpace as fidl::encoding::ValueTypeMarker>::borrow(&self.color_space),
767 <Tiling as fidl::encoding::ValueTypeMarker>::borrow(&self.tiling),
768 <AlphaFormat as fidl::encoding::ValueTypeMarker>::borrow(&self.alpha_format),
769 ),
770 encoder,
771 offset,
772 _depth,
773 )
774 }
775 }
776 unsafe impl<
777 D: fidl::encoding::ResourceDialect,
778 T0: fidl::encoding::Encode<Transform, D>,
779 T1: fidl::encoding::Encode<u32, D>,
780 T2: fidl::encoding::Encode<u32, D>,
781 T3: fidl::encoding::Encode<u32, D>,
782 T4: fidl::encoding::Encode<PixelFormat, D>,
783 T5: fidl::encoding::Encode<ColorSpace, D>,
784 T6: fidl::encoding::Encode<Tiling, D>,
785 T7: fidl::encoding::Encode<AlphaFormat, D>,
786 > fidl::encoding::Encode<ImageInfo, D> for (T0, T1, T2, T3, T4, T5, T6, T7)
787 {
788 #[inline]
789 unsafe fn encode(
790 self,
791 encoder: &mut fidl::encoding::Encoder<'_, D>,
792 offset: usize,
793 depth: fidl::encoding::Depth,
794 ) -> fidl::Result<()> {
795 encoder.debug_check_bounds::<ImageInfo>(offset);
796 self.0.encode(encoder, offset + 0, depth)?;
800 self.1.encode(encoder, offset + 4, depth)?;
801 self.2.encode(encoder, offset + 8, depth)?;
802 self.3.encode(encoder, offset + 12, depth)?;
803 self.4.encode(encoder, offset + 16, depth)?;
804 self.5.encode(encoder, offset + 20, depth)?;
805 self.6.encode(encoder, offset + 24, depth)?;
806 self.7.encode(encoder, offset + 28, depth)?;
807 Ok(())
808 }
809 }
810
811 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ImageInfo {
812 #[inline(always)]
813 fn new_empty() -> Self {
814 Self {
815 transform: fidl::new_empty!(Transform, D),
816 width: fidl::new_empty!(u32, D),
817 height: fidl::new_empty!(u32, D),
818 stride: fidl::new_empty!(u32, D),
819 pixel_format: fidl::new_empty!(PixelFormat, D),
820 color_space: fidl::new_empty!(ColorSpace, D),
821 tiling: fidl::new_empty!(Tiling, D),
822 alpha_format: fidl::new_empty!(AlphaFormat, D),
823 }
824 }
825
826 #[inline]
827 unsafe fn decode(
828 &mut self,
829 decoder: &mut fidl::encoding::Decoder<'_, D>,
830 offset: usize,
831 _depth: fidl::encoding::Depth,
832 ) -> fidl::Result<()> {
833 decoder.debug_check_bounds::<Self>(offset);
834 fidl::decode!(Transform, D, &mut self.transform, decoder, offset + 0, _depth)?;
836 fidl::decode!(u32, D, &mut self.width, decoder, offset + 4, _depth)?;
837 fidl::decode!(u32, D, &mut self.height, decoder, offset + 8, _depth)?;
838 fidl::decode!(u32, D, &mut self.stride, decoder, offset + 12, _depth)?;
839 fidl::decode!(PixelFormat, D, &mut self.pixel_format, decoder, offset + 16, _depth)?;
840 fidl::decode!(ColorSpace, D, &mut self.color_space, decoder, offset + 20, _depth)?;
841 fidl::decode!(Tiling, D, &mut self.tiling, decoder, offset + 24, _depth)?;
842 fidl::decode!(AlphaFormat, D, &mut self.alpha_format, decoder, offset + 28, _depth)?;
843 Ok(())
844 }
845 }
846
847 impl fidl::encoding::ValueTypeMarker for ImagePipe2AddImageRequest {
848 type Borrowed<'a> = &'a Self;
849 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
850 value
851 }
852 }
853
854 unsafe impl fidl::encoding::TypeMarker for ImagePipe2AddImageRequest {
855 type Owned = Self;
856
857 #[inline(always)]
858 fn inline_align(_context: fidl::encoding::Context) -> usize {
859 8
860 }
861
862 #[inline(always)]
863 fn inline_size(_context: fidl::encoding::Context) -> usize {
864 72
865 }
866 }
867
868 unsafe impl<D: fidl::encoding::ResourceDialect>
869 fidl::encoding::Encode<ImagePipe2AddImageRequest, D> for &ImagePipe2AddImageRequest
870 {
871 #[inline]
872 unsafe fn encode(
873 self,
874 encoder: &mut fidl::encoding::Encoder<'_, D>,
875 offset: usize,
876 _depth: fidl::encoding::Depth,
877 ) -> fidl::Result<()> {
878 encoder.debug_check_bounds::<ImagePipe2AddImageRequest>(offset);
879 fidl::encoding::Encode::<ImagePipe2AddImageRequest, D>::encode(
881 (
882 <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.image_id),
883 <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.buffer_collection_id),
884 <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.buffer_collection_index),
885 <fidl_fuchsia_sysmem::ImageFormat2 as fidl::encoding::ValueTypeMarker>::borrow(
886 &self.image_format,
887 ),
888 ),
889 encoder,
890 offset,
891 _depth,
892 )
893 }
894 }
895 unsafe impl<
896 D: fidl::encoding::ResourceDialect,
897 T0: fidl::encoding::Encode<u32, D>,
898 T1: fidl::encoding::Encode<u32, D>,
899 T2: fidl::encoding::Encode<u32, D>,
900 T3: fidl::encoding::Encode<fidl_fuchsia_sysmem::ImageFormat2, D>,
901 > fidl::encoding::Encode<ImagePipe2AddImageRequest, D> for (T0, T1, T2, T3)
902 {
903 #[inline]
904 unsafe fn encode(
905 self,
906 encoder: &mut fidl::encoding::Encoder<'_, D>,
907 offset: usize,
908 depth: fidl::encoding::Depth,
909 ) -> fidl::Result<()> {
910 encoder.debug_check_bounds::<ImagePipe2AddImageRequest>(offset);
911 unsafe {
914 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(8);
915 (ptr as *mut u64).write_unaligned(0);
916 }
917 self.0.encode(encoder, offset + 0, depth)?;
919 self.1.encode(encoder, offset + 4, depth)?;
920 self.2.encode(encoder, offset + 8, depth)?;
921 self.3.encode(encoder, offset + 16, depth)?;
922 Ok(())
923 }
924 }
925
926 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
927 for ImagePipe2AddImageRequest
928 {
929 #[inline(always)]
930 fn new_empty() -> Self {
931 Self {
932 image_id: fidl::new_empty!(u32, D),
933 buffer_collection_id: fidl::new_empty!(u32, D),
934 buffer_collection_index: fidl::new_empty!(u32, D),
935 image_format: fidl::new_empty!(fidl_fuchsia_sysmem::ImageFormat2, D),
936 }
937 }
938
939 #[inline]
940 unsafe fn decode(
941 &mut self,
942 decoder: &mut fidl::encoding::Decoder<'_, D>,
943 offset: usize,
944 _depth: fidl::encoding::Depth,
945 ) -> fidl::Result<()> {
946 decoder.debug_check_bounds::<Self>(offset);
947 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(8) };
949 let padval = unsafe { (ptr as *const u64).read_unaligned() };
950 let mask = 0xffffffff00000000u64;
951 let maskedval = padval & mask;
952 if maskedval != 0 {
953 return Err(fidl::Error::NonZeroPadding {
954 padding_start: offset + 8 + ((mask as u64).trailing_zeros() / 8) as usize,
955 });
956 }
957 fidl::decode!(u32, D, &mut self.image_id, decoder, offset + 0, _depth)?;
958 fidl::decode!(u32, D, &mut self.buffer_collection_id, decoder, offset + 4, _depth)?;
959 fidl::decode!(u32, D, &mut self.buffer_collection_index, decoder, offset + 8, _depth)?;
960 fidl::decode!(
961 fidl_fuchsia_sysmem::ImageFormat2,
962 D,
963 &mut self.image_format,
964 decoder,
965 offset + 16,
966 _depth
967 )?;
968 Ok(())
969 }
970 }
971
972 impl fidl::encoding::ValueTypeMarker for ImagePipe2PresentImageResponse {
973 type Borrowed<'a> = &'a Self;
974 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
975 value
976 }
977 }
978
979 unsafe impl fidl::encoding::TypeMarker for ImagePipe2PresentImageResponse {
980 type Owned = Self;
981
982 #[inline(always)]
983 fn inline_align(_context: fidl::encoding::Context) -> usize {
984 8
985 }
986
987 #[inline(always)]
988 fn inline_size(_context: fidl::encoding::Context) -> usize {
989 16
990 }
991 #[inline(always)]
992 fn encode_is_copy() -> bool {
993 true
994 }
995
996 #[inline(always)]
997 fn decode_is_copy() -> bool {
998 true
999 }
1000 }
1001
1002 unsafe impl<D: fidl::encoding::ResourceDialect>
1003 fidl::encoding::Encode<ImagePipe2PresentImageResponse, D>
1004 for &ImagePipe2PresentImageResponse
1005 {
1006 #[inline]
1007 unsafe fn encode(
1008 self,
1009 encoder: &mut fidl::encoding::Encoder<'_, D>,
1010 offset: usize,
1011 _depth: fidl::encoding::Depth,
1012 ) -> fidl::Result<()> {
1013 encoder.debug_check_bounds::<ImagePipe2PresentImageResponse>(offset);
1014 unsafe {
1015 let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
1017 (buf_ptr as *mut ImagePipe2PresentImageResponse)
1018 .write_unaligned((self as *const ImagePipe2PresentImageResponse).read());
1019 }
1022 Ok(())
1023 }
1024 }
1025 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<PresentationInfo, D>>
1026 fidl::encoding::Encode<ImagePipe2PresentImageResponse, D> for (T0,)
1027 {
1028 #[inline]
1029 unsafe fn encode(
1030 self,
1031 encoder: &mut fidl::encoding::Encoder<'_, D>,
1032 offset: usize,
1033 depth: fidl::encoding::Depth,
1034 ) -> fidl::Result<()> {
1035 encoder.debug_check_bounds::<ImagePipe2PresentImageResponse>(offset);
1036 self.0.encode(encoder, offset + 0, depth)?;
1040 Ok(())
1041 }
1042 }
1043
1044 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1045 for ImagePipe2PresentImageResponse
1046 {
1047 #[inline(always)]
1048 fn new_empty() -> Self {
1049 Self { presentation_info: fidl::new_empty!(PresentationInfo, D) }
1050 }
1051
1052 #[inline]
1053 unsafe fn decode(
1054 &mut self,
1055 decoder: &mut fidl::encoding::Decoder<'_, D>,
1056 offset: usize,
1057 _depth: fidl::encoding::Depth,
1058 ) -> fidl::Result<()> {
1059 decoder.debug_check_bounds::<Self>(offset);
1060 let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
1061 unsafe {
1064 std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 16);
1065 }
1066 Ok(())
1067 }
1068 }
1069
1070 impl fidl::encoding::ValueTypeMarker for ImagePipe2RemoveBufferCollectionRequest {
1071 type Borrowed<'a> = &'a Self;
1072 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1073 value
1074 }
1075 }
1076
1077 unsafe impl fidl::encoding::TypeMarker for ImagePipe2RemoveBufferCollectionRequest {
1078 type Owned = Self;
1079
1080 #[inline(always)]
1081 fn inline_align(_context: fidl::encoding::Context) -> usize {
1082 4
1083 }
1084
1085 #[inline(always)]
1086 fn inline_size(_context: fidl::encoding::Context) -> usize {
1087 4
1088 }
1089 #[inline(always)]
1090 fn encode_is_copy() -> bool {
1091 true
1092 }
1093
1094 #[inline(always)]
1095 fn decode_is_copy() -> bool {
1096 true
1097 }
1098 }
1099
1100 unsafe impl<D: fidl::encoding::ResourceDialect>
1101 fidl::encoding::Encode<ImagePipe2RemoveBufferCollectionRequest, D>
1102 for &ImagePipe2RemoveBufferCollectionRequest
1103 {
1104 #[inline]
1105 unsafe fn encode(
1106 self,
1107 encoder: &mut fidl::encoding::Encoder<'_, D>,
1108 offset: usize,
1109 _depth: fidl::encoding::Depth,
1110 ) -> fidl::Result<()> {
1111 encoder.debug_check_bounds::<ImagePipe2RemoveBufferCollectionRequest>(offset);
1112 unsafe {
1113 let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
1115 (buf_ptr as *mut ImagePipe2RemoveBufferCollectionRequest).write_unaligned(
1116 (self as *const ImagePipe2RemoveBufferCollectionRequest).read(),
1117 );
1118 }
1121 Ok(())
1122 }
1123 }
1124 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u32, D>>
1125 fidl::encoding::Encode<ImagePipe2RemoveBufferCollectionRequest, D> for (T0,)
1126 {
1127 #[inline]
1128 unsafe fn encode(
1129 self,
1130 encoder: &mut fidl::encoding::Encoder<'_, D>,
1131 offset: usize,
1132 depth: fidl::encoding::Depth,
1133 ) -> fidl::Result<()> {
1134 encoder.debug_check_bounds::<ImagePipe2RemoveBufferCollectionRequest>(offset);
1135 self.0.encode(encoder, offset + 0, depth)?;
1139 Ok(())
1140 }
1141 }
1142
1143 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1144 for ImagePipe2RemoveBufferCollectionRequest
1145 {
1146 #[inline(always)]
1147 fn new_empty() -> Self {
1148 Self { buffer_collection_id: fidl::new_empty!(u32, D) }
1149 }
1150
1151 #[inline]
1152 unsafe fn decode(
1153 &mut self,
1154 decoder: &mut fidl::encoding::Decoder<'_, D>,
1155 offset: usize,
1156 _depth: fidl::encoding::Depth,
1157 ) -> fidl::Result<()> {
1158 decoder.debug_check_bounds::<Self>(offset);
1159 let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
1160 unsafe {
1163 std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 4);
1164 }
1165 Ok(())
1166 }
1167 }
1168
1169 impl fidl::encoding::ValueTypeMarker for ImagePipe2RemoveImageRequest {
1170 type Borrowed<'a> = &'a Self;
1171 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1172 value
1173 }
1174 }
1175
1176 unsafe impl fidl::encoding::TypeMarker for ImagePipe2RemoveImageRequest {
1177 type Owned = Self;
1178
1179 #[inline(always)]
1180 fn inline_align(_context: fidl::encoding::Context) -> usize {
1181 4
1182 }
1183
1184 #[inline(always)]
1185 fn inline_size(_context: fidl::encoding::Context) -> usize {
1186 4
1187 }
1188 #[inline(always)]
1189 fn encode_is_copy() -> bool {
1190 true
1191 }
1192
1193 #[inline(always)]
1194 fn decode_is_copy() -> bool {
1195 true
1196 }
1197 }
1198
1199 unsafe impl<D: fidl::encoding::ResourceDialect>
1200 fidl::encoding::Encode<ImagePipe2RemoveImageRequest, D> for &ImagePipe2RemoveImageRequest
1201 {
1202 #[inline]
1203 unsafe fn encode(
1204 self,
1205 encoder: &mut fidl::encoding::Encoder<'_, D>,
1206 offset: usize,
1207 _depth: fidl::encoding::Depth,
1208 ) -> fidl::Result<()> {
1209 encoder.debug_check_bounds::<ImagePipe2RemoveImageRequest>(offset);
1210 unsafe {
1211 let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
1213 (buf_ptr as *mut ImagePipe2RemoveImageRequest)
1214 .write_unaligned((self as *const ImagePipe2RemoveImageRequest).read());
1215 }
1218 Ok(())
1219 }
1220 }
1221 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u32, D>>
1222 fidl::encoding::Encode<ImagePipe2RemoveImageRequest, D> for (T0,)
1223 {
1224 #[inline]
1225 unsafe fn encode(
1226 self,
1227 encoder: &mut fidl::encoding::Encoder<'_, D>,
1228 offset: usize,
1229 depth: fidl::encoding::Depth,
1230 ) -> fidl::Result<()> {
1231 encoder.debug_check_bounds::<ImagePipe2RemoveImageRequest>(offset);
1232 self.0.encode(encoder, offset + 0, depth)?;
1236 Ok(())
1237 }
1238 }
1239
1240 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1241 for ImagePipe2RemoveImageRequest
1242 {
1243 #[inline(always)]
1244 fn new_empty() -> Self {
1245 Self { image_id: fidl::new_empty!(u32, D) }
1246 }
1247
1248 #[inline]
1249 unsafe fn decode(
1250 &mut self,
1251 decoder: &mut fidl::encoding::Decoder<'_, D>,
1252 offset: usize,
1253 _depth: fidl::encoding::Depth,
1254 ) -> fidl::Result<()> {
1255 decoder.debug_check_bounds::<Self>(offset);
1256 let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
1257 unsafe {
1260 std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 4);
1261 }
1262 Ok(())
1263 }
1264 }
1265
1266 impl fidl::encoding::ValueTypeMarker for PresentationInfo {
1267 type Borrowed<'a> = &'a Self;
1268 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1269 value
1270 }
1271 }
1272
1273 unsafe impl fidl::encoding::TypeMarker for PresentationInfo {
1274 type Owned = Self;
1275
1276 #[inline(always)]
1277 fn inline_align(_context: fidl::encoding::Context) -> usize {
1278 8
1279 }
1280
1281 #[inline(always)]
1282 fn inline_size(_context: fidl::encoding::Context) -> usize {
1283 16
1284 }
1285 #[inline(always)]
1286 fn encode_is_copy() -> bool {
1287 true
1288 }
1289
1290 #[inline(always)]
1291 fn decode_is_copy() -> bool {
1292 true
1293 }
1294 }
1295
1296 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<PresentationInfo, D>
1297 for &PresentationInfo
1298 {
1299 #[inline]
1300 unsafe fn encode(
1301 self,
1302 encoder: &mut fidl::encoding::Encoder<'_, D>,
1303 offset: usize,
1304 _depth: fidl::encoding::Depth,
1305 ) -> fidl::Result<()> {
1306 encoder.debug_check_bounds::<PresentationInfo>(offset);
1307 unsafe {
1308 let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
1310 (buf_ptr as *mut PresentationInfo)
1311 .write_unaligned((self as *const PresentationInfo).read());
1312 }
1315 Ok(())
1316 }
1317 }
1318 unsafe impl<
1319 D: fidl::encoding::ResourceDialect,
1320 T0: fidl::encoding::Encode<u64, D>,
1321 T1: fidl::encoding::Encode<u64, D>,
1322 > fidl::encoding::Encode<PresentationInfo, D> for (T0, T1)
1323 {
1324 #[inline]
1325 unsafe fn encode(
1326 self,
1327 encoder: &mut fidl::encoding::Encoder<'_, D>,
1328 offset: usize,
1329 depth: fidl::encoding::Depth,
1330 ) -> fidl::Result<()> {
1331 encoder.debug_check_bounds::<PresentationInfo>(offset);
1332 self.0.encode(encoder, offset + 0, depth)?;
1336 self.1.encode(encoder, offset + 8, depth)?;
1337 Ok(())
1338 }
1339 }
1340
1341 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for PresentationInfo {
1342 #[inline(always)]
1343 fn new_empty() -> Self {
1344 Self {
1345 presentation_time: fidl::new_empty!(u64, D),
1346 presentation_interval: fidl::new_empty!(u64, D),
1347 }
1348 }
1349
1350 #[inline]
1351 unsafe fn decode(
1352 &mut self,
1353 decoder: &mut fidl::encoding::Decoder<'_, D>,
1354 offset: usize,
1355 _depth: fidl::encoding::Depth,
1356 ) -> fidl::Result<()> {
1357 decoder.debug_check_bounds::<Self>(offset);
1358 let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
1359 unsafe {
1362 std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 16);
1363 }
1364 Ok(())
1365 }
1366 }
1367}