1#![warn(clippy::all)]
3#![allow(unused_parens, unused_variables, unused_mut, unused_imports, unreachable_code)]
4
5pub mod natural {
6
7 #[doc = " Expresses the color space used to interpret video pixel values.\n\n This list has a separate entry for each variant of a color space standard.\n\n For this reason, should we ever add support for the RGB variant of 709, for\n example, we\'d add a separate entry to this list for that variant. Similarly\n for the RGB variants of 2020 or 2100. Similarly for the YcCbcCrc variant of\n 2020. Similarly for the ICtCp variant of 2100.\n\n See ImageFormatIsSupportedColorSpaceForPixelFormat() for whether a\n combination of `PixelFormat` and `ColorSpace` is potentially supported.\n\n Generally, a `ColorSpace` is not supported for any `PixelFormat` whose\n bits-per-sample isn\'t compatible with the color space\'s spec, nor for any\n `PixelFormat` which is a mismatch in terms of RGB vs. YUV.\n\n The \"limited range\" in comments below refers to where black and white are\n defined to be (and simimlar for chroma), but should not be interpreted as\n guaranteeing that there won\'t be values outside the nominal \"limited range\".\n In other words, \"limited range\" doesn\'t necessarily mean there won\'t be any\n values below black or above white, or outside the \"limited\" chroma range.\n For \"full range\", black is 0 and white is the max possible/permitted numeric\n value (and similar for chroma).\n"]
8 #[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
9 #[repr(u32)]
10 pub enum ColorSpace {
11 Invalid = 0,
12 Srgb = 1,
13 Rec601Ntsc = 2,
14 Rec601NtscFullRange = 3,
15 Rec601Pal = 4,
16 Rec601PalFullRange = 5,
17 Rec709 = 6,
18 Rec2020 = 7,
19 Rec2100 = 8,
20 Passthrough = 9,
21 DoNotCare = 4294967294,
22 UnknownOrdinal_(u32) = 4294967295,
23 }
24 impl ::std::convert::From<u32> for ColorSpace {
25 fn from(value: u32) -> Self {
26 match value {
27 0 => Self::Invalid,
28 1 => Self::Srgb,
29 2 => Self::Rec601Ntsc,
30 3 => Self::Rec601NtscFullRange,
31 4 => Self::Rec601Pal,
32 5 => Self::Rec601PalFullRange,
33 6 => Self::Rec709,
34 7 => Self::Rec2020,
35 8 => Self::Rec2100,
36 9 => Self::Passthrough,
37 4294967294 => Self::DoNotCare,
38
39 _ => Self::UnknownOrdinal_(value),
40 }
41 }
42 }
43
44 unsafe impl<___E> ::fidl_next::Encode<crate::wire::ColorSpace, ___E> for ColorSpace
45 where
46 ___E: ?Sized,
47 {
48 #[inline]
49 fn encode(
50 self,
51 encoder: &mut ___E,
52 out: &mut ::core::mem::MaybeUninit<crate::wire::ColorSpace>,
53 _: (),
54 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
55 ::fidl_next::Encode::encode(&self, encoder, out, ())
56 }
57 }
58
59 unsafe impl<'a, ___E> ::fidl_next::Encode<crate::wire::ColorSpace, ___E> for &'a ColorSpace
60 where
61 ___E: ?Sized,
62 {
63 #[inline]
64 fn encode(
65 self,
66 encoder: &mut ___E,
67 out: &mut ::core::mem::MaybeUninit<crate::wire::ColorSpace>,
68 _: (),
69 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
70 ::fidl_next::munge!(let crate::wire::ColorSpace { value } = out);
71 let _ = value.write(::fidl_next::wire::Uint32::from(match *self {
72 ColorSpace::Invalid => 0,
73
74 ColorSpace::Srgb => 1,
75
76 ColorSpace::Rec601Ntsc => 2,
77
78 ColorSpace::Rec601NtscFullRange => 3,
79
80 ColorSpace::Rec601Pal => 4,
81
82 ColorSpace::Rec601PalFullRange => 5,
83
84 ColorSpace::Rec709 => 6,
85
86 ColorSpace::Rec2020 => 7,
87
88 ColorSpace::Rec2100 => 8,
89
90 ColorSpace::Passthrough => 9,
91
92 ColorSpace::DoNotCare => 4294967294,
93
94 ColorSpace::UnknownOrdinal_(value) => value,
95 }));
96
97 Ok(())
98 }
99 }
100
101 impl ::core::convert::From<crate::wire::ColorSpace> for ColorSpace {
102 fn from(wire: crate::wire::ColorSpace) -> Self {
103 match u32::from(wire.value) {
104 0 => Self::Invalid,
105
106 1 => Self::Srgb,
107
108 2 => Self::Rec601Ntsc,
109
110 3 => Self::Rec601NtscFullRange,
111
112 4 => Self::Rec601Pal,
113
114 5 => Self::Rec601PalFullRange,
115
116 6 => Self::Rec709,
117
118 7 => Self::Rec2020,
119
120 8 => Self::Rec2100,
121
122 9 => Self::Passthrough,
123
124 4294967294 => Self::DoNotCare,
125
126 value => Self::UnknownOrdinal_(value),
127 }
128 }
129 }
130
131 impl ::fidl_next::FromWire<crate::wire::ColorSpace> for ColorSpace {
132 #[inline]
133 fn from_wire(wire: crate::wire::ColorSpace) -> Self {
134 Self::from(wire)
135 }
136 }
137
138 impl ::fidl_next::FromWireRef<crate::wire::ColorSpace> for ColorSpace {
139 #[inline]
140 fn from_wire_ref(wire: &crate::wire::ColorSpace) -> Self {
141 Self::from(*wire)
142 }
143 }
144
145 #[doc = " The upper 8 bits are a vendor code. The lower 56 bits are vendor-defined.\n\n The defined `PixelFormatModifier` values are specific, complete, and valid\n values (except for `INVALID` and `DO_NOT_CARE` which have their own\n meanings).\n\n Some other valid or potentially-valid `pixel_format_modifier` values are not\n defined as a `PixelFormatModifier` value, typically because the value isn\'t\n used in practice (or potentially is newly used but not yet defined in\n `PixelFormatModifier`). It is permitted to specify such a value as a\n `PixelFormatModifier` value in a `pixel_format_modifier` field, despite the\n lack of corresponding defined `PixelFormatModifier` value. If such a value\n is used outside test code, please consider adding it as a defined value in\n `PixelFormatModifier`. All such values must conform to the upper 8 bits\n vendor code (don\'t define/use values outside the/an appropriate vendor\n code).\n\n The separately-defined `FORMAT_MODIFIER_*` uint64 values are vendor-specific\n bit field values, not complete valid values on their own. These uint64\n values can be used to help create or interpret a `PixelFormatModifier` value\n in terms of vendor-specific bitfields.\n\n When the `pixel_format_modifier` is set to a supported value (excluding\n `DO_NOT_CARE`, `INVALID`, `LINEAR`), the arrangement of pixel data otherwise\n specified by the `pixel_format` field is \"modified\", typically to allow for\n some combination of tiling, compression (typically lossless, typically for\n memory bandwidth reduction not framebuffer size reduction), transaction\n elimination, dirt tracking, but typically not modifying the bit depth of the\n `pixel_format`. In some cases there\'s a per-image or per-tile header\n involved, or similar. The `pixel_format` field often still needs to be set\n to a valid supported value that works in combination with the\n `pixel_format_modifier`, and that `pixel_format` value can also contribute\n to the overall meaning of the `ImageFormat`. In other words, the \"modifier\"\n part of the name is more accurate than \"override\" would be.\n"]
146 #[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
147 #[repr(u64)]
148 pub enum PixelFormatModifier {
149 DoNotCare = 72057594037927934,
150 Invalid = 72057594037927935,
151 Linear = 0,
152 IntelI915XTiled = 72057594037927937,
153 IntelI915YTiled = 72057594037927938,
154 IntelI915YfTiled = 72057594037927939,
155 IntelI915YTiledCcs = 72057594054705154,
156 IntelI915YfTiledCcs = 72057594054705155,
157 ArmAfbc16X16 = 576460752303423489,
158 ArmAfbc32X8 = 576460752303423490,
159 ArmLinearTe = 576460752303427584,
160 ArmAfbc16X16Te = 576460752303427585,
161 ArmAfbc32X8Te = 576460752303427586,
162 ArmAfbc16X16YuvTiledHeader = 576460752303431697,
163 ArmAfbc16X16SplitBlockSparseYuv = 576460752303423601,
164 ArmAfbc16X16SplitBlockSparseYuvTe = 576460752303427697,
165 ArmAfbc16X16SplitBlockSparseYuvTiledHeader = 576460752303431793,
166 ArmAfbc16X16SplitBlockSparseYuvTeTiledHeader = 576460752303435889,
167 GoogleGoldfishOptimal = 7421932185906577409,
168 UnknownOrdinal_(u64) = 7421932185906577410,
169 }
170 impl ::std::convert::From<u64> for PixelFormatModifier {
171 fn from(value: u64) -> Self {
172 match value {
173 72057594037927934 => Self::DoNotCare,
174 72057594037927935 => Self::Invalid,
175 0 => Self::Linear,
176 72057594037927937 => Self::IntelI915XTiled,
177 72057594037927938 => Self::IntelI915YTiled,
178 72057594037927939 => Self::IntelI915YfTiled,
179 72057594054705154 => Self::IntelI915YTiledCcs,
180 72057594054705155 => Self::IntelI915YfTiledCcs,
181 576460752303423489 => Self::ArmAfbc16X16,
182 576460752303423490 => Self::ArmAfbc32X8,
183 576460752303427584 => Self::ArmLinearTe,
184 576460752303427585 => Self::ArmAfbc16X16Te,
185 576460752303427586 => Self::ArmAfbc32X8Te,
186 576460752303431697 => Self::ArmAfbc16X16YuvTiledHeader,
187 576460752303423601 => Self::ArmAfbc16X16SplitBlockSparseYuv,
188 576460752303427697 => Self::ArmAfbc16X16SplitBlockSparseYuvTe,
189 576460752303431793 => Self::ArmAfbc16X16SplitBlockSparseYuvTiledHeader,
190 576460752303435889 => Self::ArmAfbc16X16SplitBlockSparseYuvTeTiledHeader,
191 7421932185906577409 => Self::GoogleGoldfishOptimal,
192
193 _ => Self::UnknownOrdinal_(value),
194 }
195 }
196 }
197
198 unsafe impl<___E> ::fidl_next::Encode<crate::wire::PixelFormatModifier, ___E>
199 for PixelFormatModifier
200 where
201 ___E: ?Sized,
202 {
203 #[inline]
204 fn encode(
205 self,
206 encoder: &mut ___E,
207 out: &mut ::core::mem::MaybeUninit<crate::wire::PixelFormatModifier>,
208 _: (),
209 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
210 ::fidl_next::Encode::encode(&self, encoder, out, ())
211 }
212 }
213
214 unsafe impl<'a, ___E> ::fidl_next::Encode<crate::wire::PixelFormatModifier, ___E>
215 for &'a PixelFormatModifier
216 where
217 ___E: ?Sized,
218 {
219 #[inline]
220 fn encode(
221 self,
222 encoder: &mut ___E,
223 out: &mut ::core::mem::MaybeUninit<crate::wire::PixelFormatModifier>,
224 _: (),
225 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
226 ::fidl_next::munge!(let crate::wire::PixelFormatModifier { value } = out);
227 let _ = value.write(::fidl_next::wire::Uint64::from(match *self {
228 PixelFormatModifier::DoNotCare => 72057594037927934,
229
230 PixelFormatModifier::Invalid => 72057594037927935,
231
232 PixelFormatModifier::Linear => 0,
233
234 PixelFormatModifier::IntelI915XTiled => 72057594037927937,
235
236 PixelFormatModifier::IntelI915YTiled => 72057594037927938,
237
238 PixelFormatModifier::IntelI915YfTiled => 72057594037927939,
239
240 PixelFormatModifier::IntelI915YTiledCcs => 72057594054705154,
241
242 PixelFormatModifier::IntelI915YfTiledCcs => 72057594054705155,
243
244 PixelFormatModifier::ArmAfbc16X16 => 576460752303423489,
245
246 PixelFormatModifier::ArmAfbc32X8 => 576460752303423490,
247
248 PixelFormatModifier::ArmLinearTe => 576460752303427584,
249
250 PixelFormatModifier::ArmAfbc16X16Te => 576460752303427585,
251
252 PixelFormatModifier::ArmAfbc32X8Te => 576460752303427586,
253
254 PixelFormatModifier::ArmAfbc16X16YuvTiledHeader => 576460752303431697,
255
256 PixelFormatModifier::ArmAfbc16X16SplitBlockSparseYuv => 576460752303423601,
257
258 PixelFormatModifier::ArmAfbc16X16SplitBlockSparseYuvTe => 576460752303427697,
259
260 PixelFormatModifier::ArmAfbc16X16SplitBlockSparseYuvTiledHeader => {
261 576460752303431793
262 }
263
264 PixelFormatModifier::ArmAfbc16X16SplitBlockSparseYuvTeTiledHeader => {
265 576460752303435889
266 }
267
268 PixelFormatModifier::GoogleGoldfishOptimal => 7421932185906577409,
269
270 PixelFormatModifier::UnknownOrdinal_(value) => value,
271 }));
272
273 Ok(())
274 }
275 }
276
277 impl ::core::convert::From<crate::wire::PixelFormatModifier> for PixelFormatModifier {
278 fn from(wire: crate::wire::PixelFormatModifier) -> Self {
279 match u64::from(wire.value) {
280 72057594037927934 => Self::DoNotCare,
281
282 72057594037927935 => Self::Invalid,
283
284 0 => Self::Linear,
285
286 72057594037927937 => Self::IntelI915XTiled,
287
288 72057594037927938 => Self::IntelI915YTiled,
289
290 72057594037927939 => Self::IntelI915YfTiled,
291
292 72057594054705154 => Self::IntelI915YTiledCcs,
293
294 72057594054705155 => Self::IntelI915YfTiledCcs,
295
296 576460752303423489 => Self::ArmAfbc16X16,
297
298 576460752303423490 => Self::ArmAfbc32X8,
299
300 576460752303427584 => Self::ArmLinearTe,
301
302 576460752303427585 => Self::ArmAfbc16X16Te,
303
304 576460752303427586 => Self::ArmAfbc32X8Te,
305
306 576460752303431697 => Self::ArmAfbc16X16YuvTiledHeader,
307
308 576460752303423601 => Self::ArmAfbc16X16SplitBlockSparseYuv,
309
310 576460752303427697 => Self::ArmAfbc16X16SplitBlockSparseYuvTe,
311
312 576460752303431793 => Self::ArmAfbc16X16SplitBlockSparseYuvTiledHeader,
313
314 576460752303435889 => Self::ArmAfbc16X16SplitBlockSparseYuvTeTiledHeader,
315
316 7421932185906577409 => Self::GoogleGoldfishOptimal,
317
318 value => Self::UnknownOrdinal_(value),
319 }
320 }
321 }
322
323 impl ::fidl_next::FromWire<crate::wire::PixelFormatModifier> for PixelFormatModifier {
324 #[inline]
325 fn from_wire(wire: crate::wire::PixelFormatModifier) -> Self {
326 Self::from(wire)
327 }
328 }
329
330 impl ::fidl_next::FromWireRef<crate::wire::PixelFormatModifier> for PixelFormatModifier {
331 #[inline]
332 fn from_wire_ref(wire: &crate::wire::PixelFormatModifier) -> Self {
333 Self::from(*wire)
334 }
335 }
336
337 #[doc = " Expresses the manner in which video pixels are encoded.\n\n The ordering of the channels in the format name reflects the actual layout\n of the channel.\n\n Each of these values is opinionated re. the color spaces that should be\n contained within (in contrast with Vulkan).\n"]
338 #[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
339 #[repr(u32)]
340 pub enum PixelFormat {
341 Invalid = 0,
342 R8G8B8A8 = 1,
343 R8G8B8X8 = 119,
344 B8G8R8A8 = 101,
345 B8G8R8X8 = 120,
346 I420 = 102,
347 M420 = 103,
348 Nv12 = 104,
349 Yuy2 = 105,
350 Mjpeg = 106,
351 Yv12 = 107,
352 B8G8R8 = 108,
353 R5G6B5 = 109,
354 R3G3B2 = 110,
355 R2G2B2X2 = 111,
356 L8 = 112,
357 R8 = 113,
358 R8G8 = 114,
359 A2R10G10B10 = 115,
360 A2B10G10R10 = 116,
361 P010 = 117,
362 R8G8B8 = 118,
363 DoNotCare = 4294967294,
364 UnknownOrdinal_(u32) = 4294967295,
365 }
366 impl ::std::convert::From<u32> for PixelFormat {
367 fn from(value: u32) -> Self {
368 match value {
369 0 => Self::Invalid,
370 1 => Self::R8G8B8A8,
371 119 => Self::R8G8B8X8,
372 101 => Self::B8G8R8A8,
373 120 => Self::B8G8R8X8,
374 102 => Self::I420,
375 103 => Self::M420,
376 104 => Self::Nv12,
377 105 => Self::Yuy2,
378 106 => Self::Mjpeg,
379 107 => Self::Yv12,
380 108 => Self::B8G8R8,
381 109 => Self::R5G6B5,
382 110 => Self::R3G3B2,
383 111 => Self::R2G2B2X2,
384 112 => Self::L8,
385 113 => Self::R8,
386 114 => Self::R8G8,
387 115 => Self::A2R10G10B10,
388 116 => Self::A2B10G10R10,
389 117 => Self::P010,
390 118 => Self::R8G8B8,
391 4294967294 => Self::DoNotCare,
392
393 _ => Self::UnknownOrdinal_(value),
394 }
395 }
396 }
397
398 unsafe impl<___E> ::fidl_next::Encode<crate::wire::PixelFormat, ___E> for PixelFormat
399 where
400 ___E: ?Sized,
401 {
402 #[inline]
403 fn encode(
404 self,
405 encoder: &mut ___E,
406 out: &mut ::core::mem::MaybeUninit<crate::wire::PixelFormat>,
407 _: (),
408 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
409 ::fidl_next::Encode::encode(&self, encoder, out, ())
410 }
411 }
412
413 unsafe impl<'a, ___E> ::fidl_next::Encode<crate::wire::PixelFormat, ___E> for &'a PixelFormat
414 where
415 ___E: ?Sized,
416 {
417 #[inline]
418 fn encode(
419 self,
420 encoder: &mut ___E,
421 out: &mut ::core::mem::MaybeUninit<crate::wire::PixelFormat>,
422 _: (),
423 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
424 ::fidl_next::munge!(let crate::wire::PixelFormat { value } = out);
425 let _ = value.write(::fidl_next::wire::Uint32::from(match *self {
426 PixelFormat::Invalid => 0,
427
428 PixelFormat::R8G8B8A8 => 1,
429
430 PixelFormat::R8G8B8X8 => 119,
431
432 PixelFormat::B8G8R8A8 => 101,
433
434 PixelFormat::B8G8R8X8 => 120,
435
436 PixelFormat::I420 => 102,
437
438 PixelFormat::M420 => 103,
439
440 PixelFormat::Nv12 => 104,
441
442 PixelFormat::Yuy2 => 105,
443
444 PixelFormat::Mjpeg => 106,
445
446 PixelFormat::Yv12 => 107,
447
448 PixelFormat::B8G8R8 => 108,
449
450 PixelFormat::R5G6B5 => 109,
451
452 PixelFormat::R3G3B2 => 110,
453
454 PixelFormat::R2G2B2X2 => 111,
455
456 PixelFormat::L8 => 112,
457
458 PixelFormat::R8 => 113,
459
460 PixelFormat::R8G8 => 114,
461
462 PixelFormat::A2R10G10B10 => 115,
463
464 PixelFormat::A2B10G10R10 => 116,
465
466 PixelFormat::P010 => 117,
467
468 PixelFormat::R8G8B8 => 118,
469
470 PixelFormat::DoNotCare => 4294967294,
471
472 PixelFormat::UnknownOrdinal_(value) => value,
473 }));
474
475 Ok(())
476 }
477 }
478
479 impl ::core::convert::From<crate::wire::PixelFormat> for PixelFormat {
480 fn from(wire: crate::wire::PixelFormat) -> Self {
481 match u32::from(wire.value) {
482 0 => Self::Invalid,
483
484 1 => Self::R8G8B8A8,
485
486 119 => Self::R8G8B8X8,
487
488 101 => Self::B8G8R8A8,
489
490 120 => Self::B8G8R8X8,
491
492 102 => Self::I420,
493
494 103 => Self::M420,
495
496 104 => Self::Nv12,
497
498 105 => Self::Yuy2,
499
500 106 => Self::Mjpeg,
501
502 107 => Self::Yv12,
503
504 108 => Self::B8G8R8,
505
506 109 => Self::R5G6B5,
507
508 110 => Self::R3G3B2,
509
510 111 => Self::R2G2B2X2,
511
512 112 => Self::L8,
513
514 113 => Self::R8,
515
516 114 => Self::R8G8,
517
518 115 => Self::A2R10G10B10,
519
520 116 => Self::A2B10G10R10,
521
522 117 => Self::P010,
523
524 118 => Self::R8G8B8,
525
526 4294967294 => Self::DoNotCare,
527
528 value => Self::UnknownOrdinal_(value),
529 }
530 }
531 }
532
533 impl ::fidl_next::FromWire<crate::wire::PixelFormat> for PixelFormat {
534 #[inline]
535 fn from_wire(wire: crate::wire::PixelFormat) -> Self {
536 Self::from(wire)
537 }
538 }
539
540 impl ::fidl_next::FromWireRef<crate::wire::PixelFormat> for PixelFormat {
541 #[inline]
542 fn from_wire_ref(wire: &crate::wire::PixelFormat) -> Self {
543 Self::from(*wire)
544 }
545 }
546
547 #[doc = " Describes the format of images.\n"]
548 #[derive(Debug, Default, Clone, PartialEq)]
549 pub struct ImageFormat {
550 pub pixel_format: ::core::option::Option<crate::natural::PixelFormat>,
551
552 pub pixel_format_modifier: ::core::option::Option<crate::natural::PixelFormatModifier>,
553
554 pub color_space: ::core::option::Option<crate::natural::ColorSpace>,
555
556 pub size: ::core::option::Option<::fidl_next_common_fuchsia_math::natural::SizeU>,
557
558 pub bytes_per_row: ::core::option::Option<u32>,
559
560 pub display_rect: ::core::option::Option<::fidl_next_common_fuchsia_math::natural::RectU>,
561
562 pub valid_size: ::core::option::Option<::fidl_next_common_fuchsia_math::natural::SizeU>,
563
564 pub pixel_aspect_ratio:
565 ::core::option::Option<::fidl_next_common_fuchsia_math::natural::SizeU>,
566 }
567
568 impl ImageFormat {
569 fn __max_ordinal(&self) -> usize {
570 if self.pixel_aspect_ratio.is_some() {
571 return 8;
572 }
573
574 if self.valid_size.is_some() {
575 return 7;
576 }
577
578 if self.display_rect.is_some() {
579 return 6;
580 }
581
582 if self.bytes_per_row.is_some() {
583 return 5;
584 }
585
586 if self.size.is_some() {
587 return 4;
588 }
589
590 if self.color_space.is_some() {
591 return 3;
592 }
593
594 if self.pixel_format_modifier.is_some() {
595 return 2;
596 }
597
598 if self.pixel_format.is_some() {
599 return 1;
600 }
601
602 0
603 }
604 }
605
606 unsafe impl<___E> ::fidl_next::Encode<crate::wire::ImageFormat<'static>, ___E> for ImageFormat
607 where
608 ___E: ::fidl_next::Encoder + ?Sized,
609 {
610 #[inline]
611 fn encode(
612 mut self,
613 encoder: &mut ___E,
614 out: &mut ::core::mem::MaybeUninit<crate::wire::ImageFormat<'static>>,
615 _: (),
616 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
617 ::fidl_next::munge!(let crate::wire::ImageFormat { table } = out);
618
619 let max_ord = self.__max_ordinal();
620
621 let mut out = ::core::mem::MaybeUninit::<::fidl_next::wire::Envelope>::uninit();
622 ::fidl_next::Wire::zero_padding(&mut out);
623
624 let mut preallocated = ::fidl_next::EncoderExt::preallocate::<
625 ::fidl_next::wire::Envelope,
626 >(encoder, max_ord);
627
628 for i in 1..=max_ord {
629 match i {
630 8 => {
631 if let Some(value) = self.pixel_aspect_ratio.take() {
632 ::fidl_next::wire::Envelope::encode_value::<
633 ::fidl_next_common_fuchsia_math::wire::SizeU,
634 ___E,
635 >(
636 value, preallocated.encoder, &mut out, ()
637 )?;
638 } else {
639 ::fidl_next::wire::Envelope::encode_zero(&mut out)
640 }
641 }
642
643 7 => {
644 if let Some(value) = self.valid_size.take() {
645 ::fidl_next::wire::Envelope::encode_value::<
646 ::fidl_next_common_fuchsia_math::wire::SizeU,
647 ___E,
648 >(
649 value, preallocated.encoder, &mut out, ()
650 )?;
651 } else {
652 ::fidl_next::wire::Envelope::encode_zero(&mut out)
653 }
654 }
655
656 6 => {
657 if let Some(value) = self.display_rect.take() {
658 ::fidl_next::wire::Envelope::encode_value::<
659 ::fidl_next_common_fuchsia_math::wire::RectU,
660 ___E,
661 >(
662 value, preallocated.encoder, &mut out, ()
663 )?;
664 } else {
665 ::fidl_next::wire::Envelope::encode_zero(&mut out)
666 }
667 }
668
669 5 => {
670 if let Some(value) = self.bytes_per_row.take() {
671 ::fidl_next::wire::Envelope::encode_value::<
672 ::fidl_next::wire::Uint32,
673 ___E,
674 >(
675 value, preallocated.encoder, &mut out, ()
676 )?;
677 } else {
678 ::fidl_next::wire::Envelope::encode_zero(&mut out)
679 }
680 }
681
682 4 => {
683 if let Some(value) = self.size.take() {
684 ::fidl_next::wire::Envelope::encode_value::<
685 ::fidl_next_common_fuchsia_math::wire::SizeU,
686 ___E,
687 >(
688 value, preallocated.encoder, &mut out, ()
689 )?;
690 } else {
691 ::fidl_next::wire::Envelope::encode_zero(&mut out)
692 }
693 }
694
695 3 => {
696 if let Some(value) = self.color_space.take() {
697 ::fidl_next::wire::Envelope::encode_value::<
698 crate::wire::ColorSpace,
699 ___E,
700 >(
701 value, preallocated.encoder, &mut out, ()
702 )?;
703 } else {
704 ::fidl_next::wire::Envelope::encode_zero(&mut out)
705 }
706 }
707
708 2 => {
709 if let Some(value) = self.pixel_format_modifier.take() {
710 ::fidl_next::wire::Envelope::encode_value::<
711 crate::wire::PixelFormatModifier,
712 ___E,
713 >(
714 value, preallocated.encoder, &mut out, ()
715 )?;
716 } else {
717 ::fidl_next::wire::Envelope::encode_zero(&mut out)
718 }
719 }
720
721 1 => {
722 if let Some(value) = self.pixel_format.take() {
723 ::fidl_next::wire::Envelope::encode_value::<
724 crate::wire::PixelFormat,
725 ___E,
726 >(
727 value, preallocated.encoder, &mut out, ()
728 )?;
729 } else {
730 ::fidl_next::wire::Envelope::encode_zero(&mut out)
731 }
732 }
733
734 _ => ::fidl_next::wire::Envelope::encode_zero(&mut out),
735 }
736 unsafe {
737 preallocated.write_next(out.assume_init_ref());
738 }
739 }
740
741 ::fidl_next::wire::Table::encode_len(table, max_ord);
742
743 Ok(())
744 }
745 }
746
747 unsafe impl<'a, ___E> ::fidl_next::Encode<crate::wire::ImageFormat<'static>, ___E>
748 for &'a ImageFormat
749 where
750 ___E: ::fidl_next::Encoder + ?Sized,
751 {
752 #[inline]
753 fn encode(
754 self,
755 encoder: &mut ___E,
756 out: &mut ::core::mem::MaybeUninit<crate::wire::ImageFormat<'static>>,
757 _: (),
758 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
759 ::fidl_next::munge!(let crate::wire::ImageFormat { table } = out);
760
761 let max_ord = self.__max_ordinal();
762
763 let mut out = ::core::mem::MaybeUninit::<::fidl_next::wire::Envelope>::uninit();
764 ::fidl_next::Wire::zero_padding(&mut out);
765
766 let mut preallocated = ::fidl_next::EncoderExt::preallocate::<
767 ::fidl_next::wire::Envelope,
768 >(encoder, max_ord);
769
770 for i in 1..=max_ord {
771 match i {
772 8 => {
773 if let Some(value) = &self.pixel_aspect_ratio {
774 ::fidl_next::wire::Envelope::encode_value::<
775 ::fidl_next_common_fuchsia_math::wire::SizeU,
776 ___E,
777 >(
778 value, preallocated.encoder, &mut out, ()
779 )?;
780 } else {
781 ::fidl_next::wire::Envelope::encode_zero(&mut out)
782 }
783 }
784
785 7 => {
786 if let Some(value) = &self.valid_size {
787 ::fidl_next::wire::Envelope::encode_value::<
788 ::fidl_next_common_fuchsia_math::wire::SizeU,
789 ___E,
790 >(
791 value, preallocated.encoder, &mut out, ()
792 )?;
793 } else {
794 ::fidl_next::wire::Envelope::encode_zero(&mut out)
795 }
796 }
797
798 6 => {
799 if let Some(value) = &self.display_rect {
800 ::fidl_next::wire::Envelope::encode_value::<
801 ::fidl_next_common_fuchsia_math::wire::RectU,
802 ___E,
803 >(
804 value, preallocated.encoder, &mut out, ()
805 )?;
806 } else {
807 ::fidl_next::wire::Envelope::encode_zero(&mut out)
808 }
809 }
810
811 5 => {
812 if let Some(value) = &self.bytes_per_row {
813 ::fidl_next::wire::Envelope::encode_value::<
814 ::fidl_next::wire::Uint32,
815 ___E,
816 >(
817 value, preallocated.encoder, &mut out, ()
818 )?;
819 } else {
820 ::fidl_next::wire::Envelope::encode_zero(&mut out)
821 }
822 }
823
824 4 => {
825 if let Some(value) = &self.size {
826 ::fidl_next::wire::Envelope::encode_value::<
827 ::fidl_next_common_fuchsia_math::wire::SizeU,
828 ___E,
829 >(
830 value, preallocated.encoder, &mut out, ()
831 )?;
832 } else {
833 ::fidl_next::wire::Envelope::encode_zero(&mut out)
834 }
835 }
836
837 3 => {
838 if let Some(value) = &self.color_space {
839 ::fidl_next::wire::Envelope::encode_value::<
840 crate::wire::ColorSpace,
841 ___E,
842 >(
843 value, preallocated.encoder, &mut out, ()
844 )?;
845 } else {
846 ::fidl_next::wire::Envelope::encode_zero(&mut out)
847 }
848 }
849
850 2 => {
851 if let Some(value) = &self.pixel_format_modifier {
852 ::fidl_next::wire::Envelope::encode_value::<
853 crate::wire::PixelFormatModifier,
854 ___E,
855 >(
856 value, preallocated.encoder, &mut out, ()
857 )?;
858 } else {
859 ::fidl_next::wire::Envelope::encode_zero(&mut out)
860 }
861 }
862
863 1 => {
864 if let Some(value) = &self.pixel_format {
865 ::fidl_next::wire::Envelope::encode_value::<
866 crate::wire::PixelFormat,
867 ___E,
868 >(
869 value, preallocated.encoder, &mut out, ()
870 )?;
871 } else {
872 ::fidl_next::wire::Envelope::encode_zero(&mut out)
873 }
874 }
875
876 _ => ::fidl_next::wire::Envelope::encode_zero(&mut out),
877 }
878 unsafe {
879 preallocated.write_next(out.assume_init_ref());
880 }
881 }
882
883 ::fidl_next::wire::Table::encode_len(table, max_ord);
884
885 Ok(())
886 }
887 }
888
889 impl<'de> ::fidl_next::FromWire<crate::wire::ImageFormat<'de>> for ImageFormat {
890 #[inline]
891 fn from_wire(wire_: crate::wire::ImageFormat<'de>) -> Self {
892 let wire_ = ::core::mem::ManuallyDrop::new(wire_);
893
894 let pixel_format = wire_.table.get(1);
895
896 let pixel_format_modifier = wire_.table.get(2);
897
898 let color_space = wire_.table.get(3);
899
900 let size = wire_.table.get(4);
901
902 let bytes_per_row = wire_.table.get(5);
903
904 let display_rect = wire_.table.get(6);
905
906 let valid_size = wire_.table.get(7);
907
908 let pixel_aspect_ratio = wire_.table.get(8);
909
910 Self {
911 pixel_format: pixel_format.map(|envelope| {
912 ::fidl_next::FromWire::from_wire(unsafe {
913 envelope.read_unchecked::<crate::wire::PixelFormat>()
914 })
915 }),
916
917 pixel_format_modifier: pixel_format_modifier.map(|envelope| {
918 ::fidl_next::FromWire::from_wire(unsafe {
919 envelope.read_unchecked::<crate::wire::PixelFormatModifier>()
920 })
921 }),
922
923 color_space: color_space.map(|envelope| {
924 ::fidl_next::FromWire::from_wire(unsafe {
925 envelope.read_unchecked::<crate::wire::ColorSpace>()
926 })
927 }),
928
929 size: size.map(|envelope| {
930 ::fidl_next::FromWire::from_wire(unsafe {
931 envelope.read_unchecked::<::fidl_next_common_fuchsia_math::wire::SizeU>()
932 })
933 }),
934
935 bytes_per_row: bytes_per_row.map(|envelope| {
936 ::fidl_next::FromWire::from_wire(unsafe {
937 envelope.read_unchecked::<::fidl_next::wire::Uint32>()
938 })
939 }),
940
941 display_rect: display_rect.map(|envelope| {
942 ::fidl_next::FromWire::from_wire(unsafe {
943 envelope.read_unchecked::<::fidl_next_common_fuchsia_math::wire::RectU>()
944 })
945 }),
946
947 valid_size: valid_size.map(|envelope| {
948 ::fidl_next::FromWire::from_wire(unsafe {
949 envelope.read_unchecked::<::fidl_next_common_fuchsia_math::wire::SizeU>()
950 })
951 }),
952
953 pixel_aspect_ratio: pixel_aspect_ratio.map(|envelope| {
954 ::fidl_next::FromWire::from_wire(unsafe {
955 envelope.read_unchecked::<::fidl_next_common_fuchsia_math::wire::SizeU>()
956 })
957 }),
958 }
959 }
960 }
961
962 impl<'de> ::fidl_next::FromWireRef<crate::wire::ImageFormat<'de>> for ImageFormat {
963 #[inline]
964 fn from_wire_ref(wire: &crate::wire::ImageFormat<'de>) -> Self {
965 Self {
966 pixel_format: wire.table.get(1).map(|envelope| {
967 ::fidl_next::FromWireRef::from_wire_ref(unsafe {
968 envelope.deref_unchecked::<crate::wire::PixelFormat>()
969 })
970 }),
971
972 pixel_format_modifier: wire.table.get(2).map(|envelope| {
973 ::fidl_next::FromWireRef::from_wire_ref(unsafe {
974 envelope.deref_unchecked::<crate::wire::PixelFormatModifier>()
975 })
976 }),
977
978 color_space: wire.table.get(3).map(|envelope| {
979 ::fidl_next::FromWireRef::from_wire_ref(unsafe {
980 envelope.deref_unchecked::<crate::wire::ColorSpace>()
981 })
982 }),
983
984 size: wire.table.get(4).map(|envelope| {
985 ::fidl_next::FromWireRef::from_wire_ref(unsafe {
986 envelope.deref_unchecked::<::fidl_next_common_fuchsia_math::wire::SizeU>()
987 })
988 }),
989
990 bytes_per_row: wire.table.get(5).map(|envelope| {
991 ::fidl_next::FromWireRef::from_wire_ref(unsafe {
992 envelope.deref_unchecked::<::fidl_next::wire::Uint32>()
993 })
994 }),
995
996 display_rect: wire.table.get(6).map(|envelope| {
997 ::fidl_next::FromWireRef::from_wire_ref(unsafe {
998 envelope.deref_unchecked::<::fidl_next_common_fuchsia_math::wire::RectU>()
999 })
1000 }),
1001
1002 valid_size: wire.table.get(7).map(|envelope| {
1003 ::fidl_next::FromWireRef::from_wire_ref(unsafe {
1004 envelope.deref_unchecked::<::fidl_next_common_fuchsia_math::wire::SizeU>()
1005 })
1006 }),
1007
1008 pixel_aspect_ratio: wire.table.get(8).map(|envelope| {
1009 ::fidl_next::FromWireRef::from_wire_ref(unsafe {
1010 envelope.deref_unchecked::<::fidl_next_common_fuchsia_math::wire::SizeU>()
1011 })
1012 }),
1013 }
1014 }
1015 }
1016}
1017
1018pub mod wire {
1019
1020 #[derive(Clone, Copy, Debug, PartialEq, Eq)]
1022 #[repr(transparent)]
1023 pub struct ColorSpace {
1024 pub(crate) value: ::fidl_next::wire::Uint32,
1025 }
1026
1027 impl ::fidl_next::Constrained for ColorSpace {
1028 type Constraint = ();
1029
1030 fn validate(
1031 _: ::fidl_next::Slot<'_, Self>,
1032 _: Self::Constraint,
1033 ) -> Result<(), ::fidl_next::ValidationError> {
1034 Ok(())
1035 }
1036 }
1037
1038 unsafe impl ::fidl_next::Wire for ColorSpace {
1039 type Narrowed<'de> = Self;
1040
1041 #[inline]
1042 fn zero_padding(_: &mut ::core::mem::MaybeUninit<Self>) {
1043 }
1045 }
1046
1047 impl ColorSpace {
1048 pub const INVALID: ColorSpace = ColorSpace { value: ::fidl_next::wire::Uint32(0) };
1049
1050 pub const SRGB: ColorSpace = ColorSpace { value: ::fidl_next::wire::Uint32(1) };
1051
1052 pub const REC601_NTSC: ColorSpace = ColorSpace { value: ::fidl_next::wire::Uint32(2) };
1053
1054 pub const REC601_NTSC_FULL_RANGE: ColorSpace =
1055 ColorSpace { value: ::fidl_next::wire::Uint32(3) };
1056
1057 pub const REC601_PAL: ColorSpace = ColorSpace { value: ::fidl_next::wire::Uint32(4) };
1058
1059 pub const REC601_PAL_FULL_RANGE: ColorSpace =
1060 ColorSpace { value: ::fidl_next::wire::Uint32(5) };
1061
1062 pub const REC709: ColorSpace = ColorSpace { value: ::fidl_next::wire::Uint32(6) };
1063
1064 pub const REC2020: ColorSpace = ColorSpace { value: ::fidl_next::wire::Uint32(7) };
1065
1066 pub const REC2100: ColorSpace = ColorSpace { value: ::fidl_next::wire::Uint32(8) };
1067
1068 pub const PASSTHROUGH: ColorSpace = ColorSpace { value: ::fidl_next::wire::Uint32(9) };
1069
1070 pub const DO_NOT_CARE: ColorSpace =
1071 ColorSpace { value: ::fidl_next::wire::Uint32(4294967294) };
1072 }
1073
1074 unsafe impl<___D> ::fidl_next::Decode<___D> for ColorSpace
1075 where
1076 ___D: ?Sized,
1077 {
1078 fn decode(
1079 slot: ::fidl_next::Slot<'_, Self>,
1080 _: &mut ___D,
1081 _: (),
1082 ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
1083 Ok(())
1084 }
1085 }
1086
1087 impl ::core::convert::From<crate::natural::ColorSpace> for ColorSpace {
1088 fn from(natural: crate::natural::ColorSpace) -> Self {
1089 match natural {
1090 crate::natural::ColorSpace::Invalid => ColorSpace::INVALID,
1091
1092 crate::natural::ColorSpace::Srgb => ColorSpace::SRGB,
1093
1094 crate::natural::ColorSpace::Rec601Ntsc => ColorSpace::REC601_NTSC,
1095
1096 crate::natural::ColorSpace::Rec601NtscFullRange => {
1097 ColorSpace::REC601_NTSC_FULL_RANGE
1098 }
1099
1100 crate::natural::ColorSpace::Rec601Pal => ColorSpace::REC601_PAL,
1101
1102 crate::natural::ColorSpace::Rec601PalFullRange => ColorSpace::REC601_PAL_FULL_RANGE,
1103
1104 crate::natural::ColorSpace::Rec709 => ColorSpace::REC709,
1105
1106 crate::natural::ColorSpace::Rec2020 => ColorSpace::REC2020,
1107
1108 crate::natural::ColorSpace::Rec2100 => ColorSpace::REC2100,
1109
1110 crate::natural::ColorSpace::Passthrough => ColorSpace::PASSTHROUGH,
1111
1112 crate::natural::ColorSpace::DoNotCare => ColorSpace::DO_NOT_CARE,
1113
1114 crate::natural::ColorSpace::UnknownOrdinal_(value) => {
1115 ColorSpace { value: ::fidl_next::wire::Uint32::from(value) }
1116 }
1117 }
1118 }
1119 }
1120
1121 impl ::fidl_next::IntoNatural for ColorSpace {
1122 type Natural = crate::natural::ColorSpace;
1123 }
1124
1125 #[derive(Clone, Copy, Debug, PartialEq, Eq)]
1127 #[repr(transparent)]
1128 pub struct PixelFormatModifier {
1129 pub(crate) value: ::fidl_next::wire::Uint64,
1130 }
1131
1132 impl ::fidl_next::Constrained for PixelFormatModifier {
1133 type Constraint = ();
1134
1135 fn validate(
1136 _: ::fidl_next::Slot<'_, Self>,
1137 _: Self::Constraint,
1138 ) -> Result<(), ::fidl_next::ValidationError> {
1139 Ok(())
1140 }
1141 }
1142
1143 unsafe impl ::fidl_next::Wire for PixelFormatModifier {
1144 type Narrowed<'de> = Self;
1145
1146 #[inline]
1147 fn zero_padding(_: &mut ::core::mem::MaybeUninit<Self>) {
1148 }
1150 }
1151
1152 impl PixelFormatModifier {
1153 pub const DO_NOT_CARE: PixelFormatModifier =
1154 PixelFormatModifier { value: ::fidl_next::wire::Uint64(72057594037927934) };
1155
1156 pub const INVALID: PixelFormatModifier =
1157 PixelFormatModifier { value: ::fidl_next::wire::Uint64(72057594037927935) };
1158
1159 pub const LINEAR: PixelFormatModifier =
1160 PixelFormatModifier { value: ::fidl_next::wire::Uint64(0) };
1161
1162 pub const INTEL_I915_X_TILED: PixelFormatModifier =
1163 PixelFormatModifier { value: ::fidl_next::wire::Uint64(72057594037927937) };
1164
1165 pub const INTEL_I915_Y_TILED: PixelFormatModifier =
1166 PixelFormatModifier { value: ::fidl_next::wire::Uint64(72057594037927938) };
1167
1168 pub const INTEL_I915_YF_TILED: PixelFormatModifier =
1169 PixelFormatModifier { value: ::fidl_next::wire::Uint64(72057594037927939) };
1170
1171 pub const INTEL_I915_Y_TILED_CCS: PixelFormatModifier =
1172 PixelFormatModifier { value: ::fidl_next::wire::Uint64(72057594054705154) };
1173
1174 pub const INTEL_I915_YF_TILED_CCS: PixelFormatModifier =
1175 PixelFormatModifier { value: ::fidl_next::wire::Uint64(72057594054705155) };
1176
1177 pub const ARM_AFBC_16_X16: PixelFormatModifier =
1178 PixelFormatModifier { value: ::fidl_next::wire::Uint64(576460752303423489) };
1179
1180 pub const ARM_AFBC_32_X8: PixelFormatModifier =
1181 PixelFormatModifier { value: ::fidl_next::wire::Uint64(576460752303423490) };
1182
1183 pub const ARM_LINEAR_TE: PixelFormatModifier =
1184 PixelFormatModifier { value: ::fidl_next::wire::Uint64(576460752303427584) };
1185
1186 pub const ARM_AFBC_16_X16_TE: PixelFormatModifier =
1187 PixelFormatModifier { value: ::fidl_next::wire::Uint64(576460752303427585) };
1188
1189 pub const ARM_AFBC_32_X8_TE: PixelFormatModifier =
1190 PixelFormatModifier { value: ::fidl_next::wire::Uint64(576460752303427586) };
1191
1192 pub const ARM_AFBC_16_X16_YUV_TILED_HEADER: PixelFormatModifier =
1193 PixelFormatModifier { value: ::fidl_next::wire::Uint64(576460752303431697) };
1194
1195 pub const ARM_AFBC_16_X16_SPLIT_BLOCK_SPARSE_YUV: PixelFormatModifier =
1196 PixelFormatModifier { value: ::fidl_next::wire::Uint64(576460752303423601) };
1197
1198 pub const ARM_AFBC_16_X16_SPLIT_BLOCK_SPARSE_YUV_TE: PixelFormatModifier =
1199 PixelFormatModifier { value: ::fidl_next::wire::Uint64(576460752303427697) };
1200
1201 pub const ARM_AFBC_16_X16_SPLIT_BLOCK_SPARSE_YUV_TILED_HEADER: PixelFormatModifier =
1202 PixelFormatModifier { value: ::fidl_next::wire::Uint64(576460752303431793) };
1203
1204 pub const ARM_AFBC_16_X16_SPLIT_BLOCK_SPARSE_YUV_TE_TILED_HEADER: PixelFormatModifier =
1205 PixelFormatModifier { value: ::fidl_next::wire::Uint64(576460752303435889) };
1206
1207 pub const GOOGLE_GOLDFISH_OPTIMAL: PixelFormatModifier =
1208 PixelFormatModifier { value: ::fidl_next::wire::Uint64(7421932185906577409) };
1209 }
1210
1211 unsafe impl<___D> ::fidl_next::Decode<___D> for PixelFormatModifier
1212 where
1213 ___D: ?Sized,
1214 {
1215 fn decode(
1216 slot: ::fidl_next::Slot<'_, Self>,
1217 _: &mut ___D,
1218 _: (),
1219 ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
1220 Ok(())
1221 }
1222 }
1223
1224 impl ::core::convert::From<crate::natural::PixelFormatModifier> for PixelFormatModifier {
1225 fn from(natural: crate::natural::PixelFormatModifier) -> Self {
1226 match natural {
1227
1228 crate::natural::PixelFormatModifier::DoNotCare => PixelFormatModifier::DO_NOT_CARE,
1229
1230 crate::natural::PixelFormatModifier::Invalid => PixelFormatModifier::INVALID,
1231
1232 crate::natural::PixelFormatModifier::Linear => PixelFormatModifier::LINEAR,
1233
1234 crate::natural::PixelFormatModifier::IntelI915XTiled => PixelFormatModifier::INTEL_I915_X_TILED,
1235
1236 crate::natural::PixelFormatModifier::IntelI915YTiled => PixelFormatModifier::INTEL_I915_Y_TILED,
1237
1238 crate::natural::PixelFormatModifier::IntelI915YfTiled => PixelFormatModifier::INTEL_I915_YF_TILED,
1239
1240 crate::natural::PixelFormatModifier::IntelI915YTiledCcs => PixelFormatModifier::INTEL_I915_Y_TILED_CCS,
1241
1242 crate::natural::PixelFormatModifier::IntelI915YfTiledCcs => PixelFormatModifier::INTEL_I915_YF_TILED_CCS,
1243
1244 crate::natural::PixelFormatModifier::ArmAfbc16X16 => PixelFormatModifier::ARM_AFBC_16_X16,
1245
1246 crate::natural::PixelFormatModifier::ArmAfbc32X8 => PixelFormatModifier::ARM_AFBC_32_X8,
1247
1248 crate::natural::PixelFormatModifier::ArmLinearTe => PixelFormatModifier::ARM_LINEAR_TE,
1249
1250 crate::natural::PixelFormatModifier::ArmAfbc16X16Te => PixelFormatModifier::ARM_AFBC_16_X16_TE,
1251
1252 crate::natural::PixelFormatModifier::ArmAfbc32X8Te => PixelFormatModifier::ARM_AFBC_32_X8_TE,
1253
1254 crate::natural::PixelFormatModifier::ArmAfbc16X16YuvTiledHeader => PixelFormatModifier::ARM_AFBC_16_X16_YUV_TILED_HEADER,
1255
1256 crate::natural::PixelFormatModifier::ArmAfbc16X16SplitBlockSparseYuv => PixelFormatModifier::ARM_AFBC_16_X16_SPLIT_BLOCK_SPARSE_YUV,
1257
1258 crate::natural::PixelFormatModifier::ArmAfbc16X16SplitBlockSparseYuvTe => PixelFormatModifier::ARM_AFBC_16_X16_SPLIT_BLOCK_SPARSE_YUV_TE,
1259
1260 crate::natural::PixelFormatModifier::ArmAfbc16X16SplitBlockSparseYuvTiledHeader => PixelFormatModifier::ARM_AFBC_16_X16_SPLIT_BLOCK_SPARSE_YUV_TILED_HEADER,
1261
1262 crate::natural::PixelFormatModifier::ArmAfbc16X16SplitBlockSparseYuvTeTiledHeader => PixelFormatModifier::ARM_AFBC_16_X16_SPLIT_BLOCK_SPARSE_YUV_TE_TILED_HEADER,
1263
1264 crate::natural::PixelFormatModifier::GoogleGoldfishOptimal => PixelFormatModifier::GOOGLE_GOLDFISH_OPTIMAL,
1265
1266
1267 crate::natural::PixelFormatModifier::UnknownOrdinal_(value) => PixelFormatModifier {
1268 value: ::fidl_next::wire::Uint64::from(value),
1269 }
1270
1271 }
1272 }
1273 }
1274
1275 impl ::fidl_next::IntoNatural for PixelFormatModifier {
1276 type Natural = crate::natural::PixelFormatModifier;
1277 }
1278
1279 #[derive(Clone, Copy, Debug, PartialEq, Eq)]
1281 #[repr(transparent)]
1282 pub struct PixelFormat {
1283 pub(crate) value: ::fidl_next::wire::Uint32,
1284 }
1285
1286 impl ::fidl_next::Constrained for PixelFormat {
1287 type Constraint = ();
1288
1289 fn validate(
1290 _: ::fidl_next::Slot<'_, Self>,
1291 _: Self::Constraint,
1292 ) -> Result<(), ::fidl_next::ValidationError> {
1293 Ok(())
1294 }
1295 }
1296
1297 unsafe impl ::fidl_next::Wire for PixelFormat {
1298 type Narrowed<'de> = Self;
1299
1300 #[inline]
1301 fn zero_padding(_: &mut ::core::mem::MaybeUninit<Self>) {
1302 }
1304 }
1305
1306 impl PixelFormat {
1307 pub const INVALID: PixelFormat = PixelFormat { value: ::fidl_next::wire::Uint32(0) };
1308
1309 pub const R8_G8_B8_A8: PixelFormat = PixelFormat { value: ::fidl_next::wire::Uint32(1) };
1310
1311 pub const R8_G8_B8_X8: PixelFormat = PixelFormat { value: ::fidl_next::wire::Uint32(119) };
1312
1313 pub const B8_G8_R8_A8: PixelFormat = PixelFormat { value: ::fidl_next::wire::Uint32(101) };
1314
1315 pub const B8_G8_R8_X8: PixelFormat = PixelFormat { value: ::fidl_next::wire::Uint32(120) };
1316
1317 pub const I420: PixelFormat = PixelFormat { value: ::fidl_next::wire::Uint32(102) };
1318
1319 pub const M420: PixelFormat = PixelFormat { value: ::fidl_next::wire::Uint32(103) };
1320
1321 pub const NV12: PixelFormat = PixelFormat { value: ::fidl_next::wire::Uint32(104) };
1322
1323 pub const YUY2: PixelFormat = PixelFormat { value: ::fidl_next::wire::Uint32(105) };
1324
1325 pub const MJPEG: PixelFormat = PixelFormat { value: ::fidl_next::wire::Uint32(106) };
1326
1327 pub const YV12: PixelFormat = PixelFormat { value: ::fidl_next::wire::Uint32(107) };
1328
1329 pub const B8_G8_R8: PixelFormat = PixelFormat { value: ::fidl_next::wire::Uint32(108) };
1330
1331 pub const R5_G6_B5: PixelFormat = PixelFormat { value: ::fidl_next::wire::Uint32(109) };
1332
1333 pub const R3_G3_B2: PixelFormat = PixelFormat { value: ::fidl_next::wire::Uint32(110) };
1334
1335 pub const R2_G2_B2_X2: PixelFormat = PixelFormat { value: ::fidl_next::wire::Uint32(111) };
1336
1337 pub const L8: PixelFormat = PixelFormat { value: ::fidl_next::wire::Uint32(112) };
1338
1339 pub const R8: PixelFormat = PixelFormat { value: ::fidl_next::wire::Uint32(113) };
1340
1341 pub const R8_G8: PixelFormat = PixelFormat { value: ::fidl_next::wire::Uint32(114) };
1342
1343 pub const A2_R10_G10_B10: PixelFormat =
1344 PixelFormat { value: ::fidl_next::wire::Uint32(115) };
1345
1346 pub const A2_B10_G10_R10: PixelFormat =
1347 PixelFormat { value: ::fidl_next::wire::Uint32(116) };
1348
1349 pub const P010: PixelFormat = PixelFormat { value: ::fidl_next::wire::Uint32(117) };
1350
1351 pub const R8_G8_B8: PixelFormat = PixelFormat { value: ::fidl_next::wire::Uint32(118) };
1352
1353 pub const DO_NOT_CARE: PixelFormat =
1354 PixelFormat { value: ::fidl_next::wire::Uint32(4294967294) };
1355 }
1356
1357 unsafe impl<___D> ::fidl_next::Decode<___D> for PixelFormat
1358 where
1359 ___D: ?Sized,
1360 {
1361 fn decode(
1362 slot: ::fidl_next::Slot<'_, Self>,
1363 _: &mut ___D,
1364 _: (),
1365 ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
1366 Ok(())
1367 }
1368 }
1369
1370 impl ::core::convert::From<crate::natural::PixelFormat> for PixelFormat {
1371 fn from(natural: crate::natural::PixelFormat) -> Self {
1372 match natural {
1373 crate::natural::PixelFormat::Invalid => PixelFormat::INVALID,
1374
1375 crate::natural::PixelFormat::R8G8B8A8 => PixelFormat::R8_G8_B8_A8,
1376
1377 crate::natural::PixelFormat::R8G8B8X8 => PixelFormat::R8_G8_B8_X8,
1378
1379 crate::natural::PixelFormat::B8G8R8A8 => PixelFormat::B8_G8_R8_A8,
1380
1381 crate::natural::PixelFormat::B8G8R8X8 => PixelFormat::B8_G8_R8_X8,
1382
1383 crate::natural::PixelFormat::I420 => PixelFormat::I420,
1384
1385 crate::natural::PixelFormat::M420 => PixelFormat::M420,
1386
1387 crate::natural::PixelFormat::Nv12 => PixelFormat::NV12,
1388
1389 crate::natural::PixelFormat::Yuy2 => PixelFormat::YUY2,
1390
1391 crate::natural::PixelFormat::Mjpeg => PixelFormat::MJPEG,
1392
1393 crate::natural::PixelFormat::Yv12 => PixelFormat::YV12,
1394
1395 crate::natural::PixelFormat::B8G8R8 => PixelFormat::B8_G8_R8,
1396
1397 crate::natural::PixelFormat::R5G6B5 => PixelFormat::R5_G6_B5,
1398
1399 crate::natural::PixelFormat::R3G3B2 => PixelFormat::R3_G3_B2,
1400
1401 crate::natural::PixelFormat::R2G2B2X2 => PixelFormat::R2_G2_B2_X2,
1402
1403 crate::natural::PixelFormat::L8 => PixelFormat::L8,
1404
1405 crate::natural::PixelFormat::R8 => PixelFormat::R8,
1406
1407 crate::natural::PixelFormat::R8G8 => PixelFormat::R8_G8,
1408
1409 crate::natural::PixelFormat::A2R10G10B10 => PixelFormat::A2_R10_G10_B10,
1410
1411 crate::natural::PixelFormat::A2B10G10R10 => PixelFormat::A2_B10_G10_R10,
1412
1413 crate::natural::PixelFormat::P010 => PixelFormat::P010,
1414
1415 crate::natural::PixelFormat::R8G8B8 => PixelFormat::R8_G8_B8,
1416
1417 crate::natural::PixelFormat::DoNotCare => PixelFormat::DO_NOT_CARE,
1418
1419 crate::natural::PixelFormat::UnknownOrdinal_(value) => {
1420 PixelFormat { value: ::fidl_next::wire::Uint32::from(value) }
1421 }
1422 }
1423 }
1424 }
1425
1426 impl ::fidl_next::IntoNatural for PixelFormat {
1427 type Natural = crate::natural::PixelFormat;
1428 }
1429
1430 #[repr(C)]
1432 pub struct ImageFormat<'de> {
1433 pub(crate) table: ::fidl_next::wire::Table<'de>,
1434 }
1435
1436 impl<'de> Drop for ImageFormat<'de> {
1437 fn drop(&mut self) {
1438 let _ = self
1439 .table
1440 .get(1)
1441 .map(|envelope| unsafe { envelope.read_unchecked::<crate::wire::PixelFormat>() });
1442
1443 let _ = self.table.get(2).map(|envelope| unsafe {
1444 envelope.read_unchecked::<crate::wire::PixelFormatModifier>()
1445 });
1446
1447 let _ = self
1448 .table
1449 .get(3)
1450 .map(|envelope| unsafe { envelope.read_unchecked::<crate::wire::ColorSpace>() });
1451
1452 let _ = self.table.get(4).map(|envelope| unsafe {
1453 envelope.read_unchecked::<::fidl_next_common_fuchsia_math::wire::SizeU>()
1454 });
1455
1456 let _ = self
1457 .table
1458 .get(5)
1459 .map(|envelope| unsafe { envelope.read_unchecked::<::fidl_next::wire::Uint32>() });
1460
1461 let _ = self.table.get(6).map(|envelope| unsafe {
1462 envelope.read_unchecked::<::fidl_next_common_fuchsia_math::wire::RectU>()
1463 });
1464
1465 let _ = self.table.get(7).map(|envelope| unsafe {
1466 envelope.read_unchecked::<::fidl_next_common_fuchsia_math::wire::SizeU>()
1467 });
1468
1469 let _ = self.table.get(8).map(|envelope| unsafe {
1470 envelope.read_unchecked::<::fidl_next_common_fuchsia_math::wire::SizeU>()
1471 });
1472 }
1473 }
1474
1475 impl ::fidl_next::Constrained for ImageFormat<'_> {
1476 type Constraint = ();
1477
1478 fn validate(
1479 _: ::fidl_next::Slot<'_, Self>,
1480 _: Self::Constraint,
1481 ) -> Result<(), ::fidl_next::ValidationError> {
1482 Ok(())
1483 }
1484 }
1485
1486 unsafe impl ::fidl_next::Wire for ImageFormat<'static> {
1487 type Narrowed<'de> = ImageFormat<'de>;
1488
1489 #[inline]
1490 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
1491 ::fidl_next::munge!(let Self { table } = out);
1492 ::fidl_next::wire::Table::zero_padding(table);
1493 }
1494 }
1495
1496 unsafe impl<'de, ___D> ::fidl_next::Decode<___D> for ImageFormat<'de>
1497 where
1498 ___D: ::fidl_next::Decoder<'de> + ?Sized,
1499 {
1500 fn decode(
1501 slot: ::fidl_next::Slot<'_, Self>,
1502 decoder: &mut ___D,
1503 _: (),
1504 ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
1505 ::fidl_next::munge!(let Self { table } = slot);
1506
1507 ::fidl_next::wire::Table::decode_with(table, decoder, |ordinal, mut slot, decoder| {
1508 match ordinal {
1509 0 => unsafe { ::core::hint::unreachable_unchecked() },
1510
1511 1 => {
1512 ::fidl_next::wire::Envelope::decode_as::<___D, crate::wire::PixelFormat>(
1513 slot.as_mut(),
1514 decoder,
1515 (),
1516 )?;
1517
1518 Ok(())
1519 }
1520
1521 2 => {
1522 ::fidl_next::wire::Envelope::decode_as::<
1523 ___D,
1524 crate::wire::PixelFormatModifier,
1525 >(slot.as_mut(), decoder, ())?;
1526
1527 Ok(())
1528 }
1529
1530 3 => {
1531 ::fidl_next::wire::Envelope::decode_as::<___D, crate::wire::ColorSpace>(
1532 slot.as_mut(),
1533 decoder,
1534 (),
1535 )?;
1536
1537 Ok(())
1538 }
1539
1540 4 => {
1541 ::fidl_next::wire::Envelope::decode_as::<
1542 ___D,
1543 ::fidl_next_common_fuchsia_math::wire::SizeU,
1544 >(slot.as_mut(), decoder, ())?;
1545
1546 Ok(())
1547 }
1548
1549 5 => {
1550 ::fidl_next::wire::Envelope::decode_as::<___D, ::fidl_next::wire::Uint32>(
1551 slot.as_mut(),
1552 decoder,
1553 (),
1554 )?;
1555
1556 Ok(())
1557 }
1558
1559 6 => {
1560 ::fidl_next::wire::Envelope::decode_as::<
1561 ___D,
1562 ::fidl_next_common_fuchsia_math::wire::RectU,
1563 >(slot.as_mut(), decoder, ())?;
1564
1565 Ok(())
1566 }
1567
1568 7 => {
1569 ::fidl_next::wire::Envelope::decode_as::<
1570 ___D,
1571 ::fidl_next_common_fuchsia_math::wire::SizeU,
1572 >(slot.as_mut(), decoder, ())?;
1573
1574 Ok(())
1575 }
1576
1577 8 => {
1578 ::fidl_next::wire::Envelope::decode_as::<
1579 ___D,
1580 ::fidl_next_common_fuchsia_math::wire::SizeU,
1581 >(slot.as_mut(), decoder, ())?;
1582
1583 Ok(())
1584 }
1585
1586 _ => ::fidl_next::wire::Envelope::decode_unknown(slot, decoder),
1587 }
1588 })
1589 }
1590 }
1591
1592 impl<'de> ImageFormat<'de> {
1593 pub fn pixel_format(&self) -> ::core::option::Option<&crate::wire::PixelFormat> {
1594 unsafe { Some(self.table.get(1)?.deref_unchecked()) }
1595 }
1596
1597 pub fn pixel_format_modifier(
1598 &self,
1599 ) -> ::core::option::Option<&crate::wire::PixelFormatModifier> {
1600 unsafe { Some(self.table.get(2)?.deref_unchecked()) }
1601 }
1602
1603 pub fn color_space(&self) -> ::core::option::Option<&crate::wire::ColorSpace> {
1604 unsafe { Some(self.table.get(3)?.deref_unchecked()) }
1605 }
1606
1607 pub fn size(
1608 &self,
1609 ) -> ::core::option::Option<&::fidl_next_common_fuchsia_math::wire::SizeU> {
1610 unsafe { Some(self.table.get(4)?.deref_unchecked()) }
1611 }
1612
1613 pub fn bytes_per_row(&self) -> ::core::option::Option<&::fidl_next::wire::Uint32> {
1614 unsafe { Some(self.table.get(5)?.deref_unchecked()) }
1615 }
1616
1617 pub fn display_rect(
1618 &self,
1619 ) -> ::core::option::Option<&::fidl_next_common_fuchsia_math::wire::RectU> {
1620 unsafe { Some(self.table.get(6)?.deref_unchecked()) }
1621 }
1622
1623 pub fn valid_size(
1624 &self,
1625 ) -> ::core::option::Option<&::fidl_next_common_fuchsia_math::wire::SizeU> {
1626 unsafe { Some(self.table.get(7)?.deref_unchecked()) }
1627 }
1628
1629 pub fn pixel_aspect_ratio(
1630 &self,
1631 ) -> ::core::option::Option<&::fidl_next_common_fuchsia_math::wire::SizeU> {
1632 unsafe { Some(self.table.get(8)?.deref_unchecked()) }
1633 }
1634 }
1635
1636 impl<'de> ::core::fmt::Debug for ImageFormat<'de> {
1637 fn fmt(
1638 &self,
1639 f: &mut ::core::fmt::Formatter<'_>,
1640 ) -> ::core::result::Result<(), ::core::fmt::Error> {
1641 f.debug_struct("ImageFormat")
1642 .field("pixel_format", &self.pixel_format())
1643 .field("pixel_format_modifier", &self.pixel_format_modifier())
1644 .field("color_space", &self.color_space())
1645 .field("size", &self.size())
1646 .field("bytes_per_row", &self.bytes_per_row())
1647 .field("display_rect", &self.display_rect())
1648 .field("valid_size", &self.valid_size())
1649 .field("pixel_aspect_ratio", &self.pixel_aspect_ratio())
1650 .finish()
1651 }
1652 }
1653
1654 impl<'de> ::fidl_next::IntoNatural for ImageFormat<'de> {
1655 type Natural = crate::natural::ImageFormat;
1656 }
1657}
1658
1659pub mod wire_optional {}
1660
1661pub mod generic {}
1662
1663pub use self::natural::*;
1664
1665pub const FORMAT_MODIFIER_ARM_BCH_BIT: u64 = 2048 as u64;
1666
1667pub const FORMAT_MODIFIER_ARM_SPARSE_BIT: u64 = 64 as u64;
1668
1669pub const FORMAT_MODIFIER_ARM_SPLIT_BLOCK_BIT: u64 = 32 as u64;
1670
1671pub const FORMAT_MODIFIER_ARM_TE_BIT: u64 = 4096 as u64;
1672
1673pub const FORMAT_MODIFIER_ARM_TILED_HEADER_BIT: u64 = 8192 as u64;
1674
1675pub const FORMAT_MODIFIER_ARM_YUV_BIT: u64 = 16 as u64;
1676
1677#[doc = " Format has a color control surface after the tile data\n"]
1678pub const FORMAT_MODIFIER_INTEL_CCS_BIT: u64 = 16777216 as u64;
1679
1680pub const FORMAT_MODIFIER_VENDOR_ALLWINNER: u64 = 648518346341351424 as u64;
1681
1682pub const FORMAT_MODIFIER_VENDOR_AMD: u64 = 144115188075855872 as u64;
1683
1684pub const FORMAT_MODIFIER_VENDOR_AMLOGIC: u64 = 720575940379279360 as u64;
1685
1686pub const FORMAT_MODIFIER_VENDOR_ARM: u64 = 576460752303423488 as u64;
1687
1688pub const FORMAT_MODIFIER_VENDOR_BROADCOM: u64 = 504403158265495552 as u64;
1689
1690pub const FORMAT_MODIFIER_VENDOR_GOOGLE: u64 = 7421932185906577408 as u64;
1691
1692pub const FORMAT_MODIFIER_VENDOR_INTEL: u64 = 72057594037927936 as u64;
1693
1694pub const FORMAT_MODIFIER_VENDOR_NVIDIA: u64 = 216172782113783808 as u64;
1695
1696pub const FORMAT_MODIFIER_VENDOR_QCOM: u64 = 360287970189639680 as u64;
1697
1698pub const FORMAT_MODIFIER_VENDOR_SAMSUNG: u64 = 288230376151711744 as u64;
1699
1700pub const FORMAT_MODIFIER_VENDOR_VIVANTE: u64 = 432345564227567616 as u64;