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