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__common::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__common::ImageFormat2 as fidl::encoding::ValueTypeMarker>::borrow(&self.image_format),
886 ),
887 encoder, offset, _depth
888 )
889 }
890 }
891 unsafe impl<
892 D: fidl::encoding::ResourceDialect,
893 T0: fidl::encoding::Encode<u32, D>,
894 T1: fidl::encoding::Encode<u32, D>,
895 T2: fidl::encoding::Encode<u32, D>,
896 T3: fidl::encoding::Encode<fidl_fuchsia_sysmem__common::ImageFormat2, D>,
897 > fidl::encoding::Encode<ImagePipe2AddImageRequest, D> for (T0, T1, T2, T3)
898 {
899 #[inline]
900 unsafe fn encode(
901 self,
902 encoder: &mut fidl::encoding::Encoder<'_, D>,
903 offset: usize,
904 depth: fidl::encoding::Depth,
905 ) -> fidl::Result<()> {
906 encoder.debug_check_bounds::<ImagePipe2AddImageRequest>(offset);
907 unsafe {
910 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(8);
911 (ptr as *mut u64).write_unaligned(0);
912 }
913 self.0.encode(encoder, offset + 0, depth)?;
915 self.1.encode(encoder, offset + 4, depth)?;
916 self.2.encode(encoder, offset + 8, depth)?;
917 self.3.encode(encoder, offset + 16, depth)?;
918 Ok(())
919 }
920 }
921
922 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
923 for ImagePipe2AddImageRequest
924 {
925 #[inline(always)]
926 fn new_empty() -> Self {
927 Self {
928 image_id: fidl::new_empty!(u32, D),
929 buffer_collection_id: fidl::new_empty!(u32, D),
930 buffer_collection_index: fidl::new_empty!(u32, D),
931 image_format: fidl::new_empty!(fidl_fuchsia_sysmem__common::ImageFormat2, D),
932 }
933 }
934
935 #[inline]
936 unsafe fn decode(
937 &mut self,
938 decoder: &mut fidl::encoding::Decoder<'_, D>,
939 offset: usize,
940 _depth: fidl::encoding::Depth,
941 ) -> fidl::Result<()> {
942 decoder.debug_check_bounds::<Self>(offset);
943 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(8) };
945 let padval = unsafe { (ptr as *const u64).read_unaligned() };
946 let mask = 0xffffffff00000000u64;
947 let maskedval = padval & mask;
948 if maskedval != 0 {
949 return Err(fidl::Error::NonZeroPadding {
950 padding_start: offset + 8 + ((mask as u64).trailing_zeros() / 8) as usize,
951 });
952 }
953 fidl::decode!(u32, D, &mut self.image_id, decoder, offset + 0, _depth)?;
954 fidl::decode!(u32, D, &mut self.buffer_collection_id, decoder, offset + 4, _depth)?;
955 fidl::decode!(u32, D, &mut self.buffer_collection_index, decoder, offset + 8, _depth)?;
956 fidl::decode!(
957 fidl_fuchsia_sysmem__common::ImageFormat2,
958 D,
959 &mut self.image_format,
960 decoder,
961 offset + 16,
962 _depth
963 )?;
964 Ok(())
965 }
966 }
967
968 impl fidl::encoding::ValueTypeMarker for ImagePipe2PresentImageResponse {
969 type Borrowed<'a> = &'a Self;
970 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
971 value
972 }
973 }
974
975 unsafe impl fidl::encoding::TypeMarker for ImagePipe2PresentImageResponse {
976 type Owned = Self;
977
978 #[inline(always)]
979 fn inline_align(_context: fidl::encoding::Context) -> usize {
980 8
981 }
982
983 #[inline(always)]
984 fn inline_size(_context: fidl::encoding::Context) -> usize {
985 16
986 }
987 #[inline(always)]
988 fn encode_is_copy() -> bool {
989 true
990 }
991
992 #[inline(always)]
993 fn decode_is_copy() -> bool {
994 true
995 }
996 }
997
998 unsafe impl<D: fidl::encoding::ResourceDialect>
999 fidl::encoding::Encode<ImagePipe2PresentImageResponse, D>
1000 for &ImagePipe2PresentImageResponse
1001 {
1002 #[inline]
1003 unsafe fn encode(
1004 self,
1005 encoder: &mut fidl::encoding::Encoder<'_, D>,
1006 offset: usize,
1007 _depth: fidl::encoding::Depth,
1008 ) -> fidl::Result<()> {
1009 encoder.debug_check_bounds::<ImagePipe2PresentImageResponse>(offset);
1010 unsafe {
1011 let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
1013 (buf_ptr as *mut ImagePipe2PresentImageResponse)
1014 .write_unaligned((self as *const ImagePipe2PresentImageResponse).read());
1015 }
1018 Ok(())
1019 }
1020 }
1021 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<PresentationInfo, D>>
1022 fidl::encoding::Encode<ImagePipe2PresentImageResponse, D> for (T0,)
1023 {
1024 #[inline]
1025 unsafe fn encode(
1026 self,
1027 encoder: &mut fidl::encoding::Encoder<'_, D>,
1028 offset: usize,
1029 depth: fidl::encoding::Depth,
1030 ) -> fidl::Result<()> {
1031 encoder.debug_check_bounds::<ImagePipe2PresentImageResponse>(offset);
1032 self.0.encode(encoder, offset + 0, depth)?;
1036 Ok(())
1037 }
1038 }
1039
1040 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1041 for ImagePipe2PresentImageResponse
1042 {
1043 #[inline(always)]
1044 fn new_empty() -> Self {
1045 Self { presentation_info: fidl::new_empty!(PresentationInfo, D) }
1046 }
1047
1048 #[inline]
1049 unsafe fn decode(
1050 &mut self,
1051 decoder: &mut fidl::encoding::Decoder<'_, D>,
1052 offset: usize,
1053 _depth: fidl::encoding::Depth,
1054 ) -> fidl::Result<()> {
1055 decoder.debug_check_bounds::<Self>(offset);
1056 let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
1057 unsafe {
1060 std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 16);
1061 }
1062 Ok(())
1063 }
1064 }
1065
1066 impl fidl::encoding::ValueTypeMarker for ImagePipe2RemoveBufferCollectionRequest {
1067 type Borrowed<'a> = &'a Self;
1068 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1069 value
1070 }
1071 }
1072
1073 unsafe impl fidl::encoding::TypeMarker for ImagePipe2RemoveBufferCollectionRequest {
1074 type Owned = Self;
1075
1076 #[inline(always)]
1077 fn inline_align(_context: fidl::encoding::Context) -> usize {
1078 4
1079 }
1080
1081 #[inline(always)]
1082 fn inline_size(_context: fidl::encoding::Context) -> usize {
1083 4
1084 }
1085 #[inline(always)]
1086 fn encode_is_copy() -> bool {
1087 true
1088 }
1089
1090 #[inline(always)]
1091 fn decode_is_copy() -> bool {
1092 true
1093 }
1094 }
1095
1096 unsafe impl<D: fidl::encoding::ResourceDialect>
1097 fidl::encoding::Encode<ImagePipe2RemoveBufferCollectionRequest, D>
1098 for &ImagePipe2RemoveBufferCollectionRequest
1099 {
1100 #[inline]
1101 unsafe fn encode(
1102 self,
1103 encoder: &mut fidl::encoding::Encoder<'_, D>,
1104 offset: usize,
1105 _depth: fidl::encoding::Depth,
1106 ) -> fidl::Result<()> {
1107 encoder.debug_check_bounds::<ImagePipe2RemoveBufferCollectionRequest>(offset);
1108 unsafe {
1109 let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
1111 (buf_ptr as *mut ImagePipe2RemoveBufferCollectionRequest).write_unaligned(
1112 (self as *const ImagePipe2RemoveBufferCollectionRequest).read(),
1113 );
1114 }
1117 Ok(())
1118 }
1119 }
1120 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u32, D>>
1121 fidl::encoding::Encode<ImagePipe2RemoveBufferCollectionRequest, D> for (T0,)
1122 {
1123 #[inline]
1124 unsafe fn encode(
1125 self,
1126 encoder: &mut fidl::encoding::Encoder<'_, D>,
1127 offset: usize,
1128 depth: fidl::encoding::Depth,
1129 ) -> fidl::Result<()> {
1130 encoder.debug_check_bounds::<ImagePipe2RemoveBufferCollectionRequest>(offset);
1131 self.0.encode(encoder, offset + 0, depth)?;
1135 Ok(())
1136 }
1137 }
1138
1139 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1140 for ImagePipe2RemoveBufferCollectionRequest
1141 {
1142 #[inline(always)]
1143 fn new_empty() -> Self {
1144 Self { buffer_collection_id: fidl::new_empty!(u32, D) }
1145 }
1146
1147 #[inline]
1148 unsafe fn decode(
1149 &mut self,
1150 decoder: &mut fidl::encoding::Decoder<'_, D>,
1151 offset: usize,
1152 _depth: fidl::encoding::Depth,
1153 ) -> fidl::Result<()> {
1154 decoder.debug_check_bounds::<Self>(offset);
1155 let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
1156 unsafe {
1159 std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 4);
1160 }
1161 Ok(())
1162 }
1163 }
1164
1165 impl fidl::encoding::ValueTypeMarker for ImagePipe2RemoveImageRequest {
1166 type Borrowed<'a> = &'a Self;
1167 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1168 value
1169 }
1170 }
1171
1172 unsafe impl fidl::encoding::TypeMarker for ImagePipe2RemoveImageRequest {
1173 type Owned = Self;
1174
1175 #[inline(always)]
1176 fn inline_align(_context: fidl::encoding::Context) -> usize {
1177 4
1178 }
1179
1180 #[inline(always)]
1181 fn inline_size(_context: fidl::encoding::Context) -> usize {
1182 4
1183 }
1184 #[inline(always)]
1185 fn encode_is_copy() -> bool {
1186 true
1187 }
1188
1189 #[inline(always)]
1190 fn decode_is_copy() -> bool {
1191 true
1192 }
1193 }
1194
1195 unsafe impl<D: fidl::encoding::ResourceDialect>
1196 fidl::encoding::Encode<ImagePipe2RemoveImageRequest, D> for &ImagePipe2RemoveImageRequest
1197 {
1198 #[inline]
1199 unsafe fn encode(
1200 self,
1201 encoder: &mut fidl::encoding::Encoder<'_, D>,
1202 offset: usize,
1203 _depth: fidl::encoding::Depth,
1204 ) -> fidl::Result<()> {
1205 encoder.debug_check_bounds::<ImagePipe2RemoveImageRequest>(offset);
1206 unsafe {
1207 let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
1209 (buf_ptr as *mut ImagePipe2RemoveImageRequest)
1210 .write_unaligned((self as *const ImagePipe2RemoveImageRequest).read());
1211 }
1214 Ok(())
1215 }
1216 }
1217 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u32, D>>
1218 fidl::encoding::Encode<ImagePipe2RemoveImageRequest, D> for (T0,)
1219 {
1220 #[inline]
1221 unsafe fn encode(
1222 self,
1223 encoder: &mut fidl::encoding::Encoder<'_, D>,
1224 offset: usize,
1225 depth: fidl::encoding::Depth,
1226 ) -> fidl::Result<()> {
1227 encoder.debug_check_bounds::<ImagePipe2RemoveImageRequest>(offset);
1228 self.0.encode(encoder, offset + 0, depth)?;
1232 Ok(())
1233 }
1234 }
1235
1236 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1237 for ImagePipe2RemoveImageRequest
1238 {
1239 #[inline(always)]
1240 fn new_empty() -> Self {
1241 Self { image_id: fidl::new_empty!(u32, D) }
1242 }
1243
1244 #[inline]
1245 unsafe fn decode(
1246 &mut self,
1247 decoder: &mut fidl::encoding::Decoder<'_, D>,
1248 offset: usize,
1249 _depth: fidl::encoding::Depth,
1250 ) -> fidl::Result<()> {
1251 decoder.debug_check_bounds::<Self>(offset);
1252 let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
1253 unsafe {
1256 std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 4);
1257 }
1258 Ok(())
1259 }
1260 }
1261
1262 impl fidl::encoding::ValueTypeMarker for PresentationInfo {
1263 type Borrowed<'a> = &'a Self;
1264 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1265 value
1266 }
1267 }
1268
1269 unsafe impl fidl::encoding::TypeMarker for PresentationInfo {
1270 type Owned = Self;
1271
1272 #[inline(always)]
1273 fn inline_align(_context: fidl::encoding::Context) -> usize {
1274 8
1275 }
1276
1277 #[inline(always)]
1278 fn inline_size(_context: fidl::encoding::Context) -> usize {
1279 16
1280 }
1281 #[inline(always)]
1282 fn encode_is_copy() -> bool {
1283 true
1284 }
1285
1286 #[inline(always)]
1287 fn decode_is_copy() -> bool {
1288 true
1289 }
1290 }
1291
1292 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<PresentationInfo, D>
1293 for &PresentationInfo
1294 {
1295 #[inline]
1296 unsafe fn encode(
1297 self,
1298 encoder: &mut fidl::encoding::Encoder<'_, D>,
1299 offset: usize,
1300 _depth: fidl::encoding::Depth,
1301 ) -> fidl::Result<()> {
1302 encoder.debug_check_bounds::<PresentationInfo>(offset);
1303 unsafe {
1304 let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
1306 (buf_ptr as *mut PresentationInfo)
1307 .write_unaligned((self as *const PresentationInfo).read());
1308 }
1311 Ok(())
1312 }
1313 }
1314 unsafe impl<
1315 D: fidl::encoding::ResourceDialect,
1316 T0: fidl::encoding::Encode<u64, D>,
1317 T1: fidl::encoding::Encode<u64, D>,
1318 > fidl::encoding::Encode<PresentationInfo, D> for (T0, T1)
1319 {
1320 #[inline]
1321 unsafe fn encode(
1322 self,
1323 encoder: &mut fidl::encoding::Encoder<'_, D>,
1324 offset: usize,
1325 depth: fidl::encoding::Depth,
1326 ) -> fidl::Result<()> {
1327 encoder.debug_check_bounds::<PresentationInfo>(offset);
1328 self.0.encode(encoder, offset + 0, depth)?;
1332 self.1.encode(encoder, offset + 8, depth)?;
1333 Ok(())
1334 }
1335 }
1336
1337 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for PresentationInfo {
1338 #[inline(always)]
1339 fn new_empty() -> Self {
1340 Self {
1341 presentation_time: fidl::new_empty!(u64, D),
1342 presentation_interval: fidl::new_empty!(u64, D),
1343 }
1344 }
1345
1346 #[inline]
1347 unsafe fn decode(
1348 &mut self,
1349 decoder: &mut fidl::encoding::Decoder<'_, D>,
1350 offset: usize,
1351 _depth: fidl::encoding::Depth,
1352 ) -> fidl::Result<()> {
1353 decoder.debug_check_bounds::<Self>(offset);
1354 let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
1355 unsafe {
1358 std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 16);
1359 }
1360 Ok(())
1361 }
1362 }
1363}