1use {super::super::all_types::*, ::wl_client::builder::prelude::*};
14
15static INTERFACE: wl_interface = wl_interface {
16 name: c"wl_shm".as_ptr(),
17 version: 2,
18 method_count: 2,
19 methods: {
20 static MESSAGES: [wl_message; 2] = [
21 wl_message {
22 name: c"create_pool".as_ptr(),
23 signature: c"nhi".as_ptr(),
24 types: {
25 static TYPES: [Option<&'static wl_interface>; 3] =
26 [Some(WlShmPool::WL_INTERFACE), None, None];
27 TYPES.as_ptr().cast()
28 },
29 },
30 wl_message {
31 name: c"release".as_ptr(),
32 signature: c"".as_ptr(),
33 types: {
34 static TYPES: [Option<&'static wl_interface>; 0] = [];
35 TYPES.as_ptr().cast()
36 },
37 },
38 ];
39 MESSAGES.as_ptr()
40 },
41 event_count: 1,
42 events: {
43 static MESSAGES: [wl_message; 1] = [wl_message {
44 name: c"format".as_ptr(),
45 signature: c"u".as_ptr(),
46 types: {
47 static TYPES: [Option<&'static wl_interface>; 1] = [None];
48 TYPES.as_ptr().cast()
49 },
50 }];
51 MESSAGES.as_ptr()
52 },
53};
54
55#[derive(Clone, Eq, PartialEq)]
59#[repr(transparent)]
60pub struct WlShm {
61 proxy: UntypedOwnedProxy,
63}
64
65#[derive(Eq, PartialEq)]
69#[repr(transparent)]
70pub struct WlShmRef {
71 proxy: UntypedBorrowedProxy,
73}
74
75unsafe impl UntypedOwnedProxyWrapper for WlShm {}
77
78unsafe impl OwnedProxy for WlShm {
81 const INTERFACE: &'static str = "wl_shm";
82 const WL_INTERFACE: &'static wl_interface = &INTERFACE;
83 const NO_OP_EVENT_HANDLER: Self::NoOpEventHandler =
84 private::EventHandler(private::NoOpEventHandler);
85 const MAX_VERSION: u32 = 2;
86
87 type Borrowed = WlShmRef;
88 type Api = private::ProxyApi;
89 type NoOpEventHandler = private::EventHandler<private::NoOpEventHandler>;
90}
91
92unsafe impl UntypedBorrowedProxyWrapper for WlShmRef {}
94
95unsafe impl BorrowedProxy for WlShmRef {
97 type Owned = WlShm;
98}
99
100impl Deref for WlShm {
101 type Target = WlShmRef;
102
103 fn deref(&self) -> &Self::Target {
104 proxy::low_level::deref(self)
105 }
106}
107
108mod private {
109 pub struct ProxyApi;
110
111 #[allow(dead_code)]
112 pub struct EventHandler<H>(pub(super) H);
113
114 #[allow(dead_code)]
115 pub struct NoOpEventHandler;
116}
117
118impl Debug for WlShm {
119 fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
120 write!(f, "wl_shm#{}", self.proxy.id())
121 }
122}
123
124impl Debug for WlShmRef {
125 fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
126 write!(f, "wl_shm#{}", self.proxy.id())
127 }
128}
129
130impl PartialEq<WlShmRef> for WlShm {
131 fn eq(&self, other: &WlShmRef) -> bool {
132 self.proxy == other.proxy
133 }
134}
135
136impl PartialEq<WlShm> for WlShmRef {
137 fn eq(&self, other: &WlShm) -> bool {
138 self.proxy == other.proxy
139 }
140}
141
142#[allow(dead_code)]
143impl WlShm {
144 #[allow(dead_code)]
146 pub const REQ__CREATE_POOL__SINCE: u32 = 1;
147
148 #[inline]
161 pub fn create_pool(&self, fd: BorrowedFd<'_>, size: i32) -> WlShmPool {
162 let (arg1, arg2) = (fd, size);
163 let mut args = [
164 wl_argument { n: 0 },
165 wl_argument {
166 h: arg1.as_raw_fd(),
167 },
168 wl_argument { i: arg2 },
169 ];
170 let data = unsafe {
175 self.proxy
176 .send_constructor::<false>(0, &mut args, WlShmPool::WL_INTERFACE, None)
177 };
178 unsafe { proxy::low_level::from_untyped_owned(data) }
180 }
181
182 #[allow(dead_code)]
184 pub const REQ__RELEASE__SINCE: u32 = 2;
185
186 #[inline]
193 pub fn release(&self) {
194 let mut args = [];
195 unsafe {
199 self.proxy.send_destructor(1, &mut args);
200 }
201 }
202}
203
204#[allow(dead_code)]
205impl WlShmRef {
206 #[inline]
220 pub fn create_pool(&self, _queue: &Queue, fd: BorrowedFd<'_>, size: i32) -> WlShmPool {
221 let (arg1, arg2) = (fd, size);
222 let mut args = [
223 wl_argument { n: 0 },
224 wl_argument {
225 h: arg1.as_raw_fd(),
226 },
227 wl_argument { i: arg2 },
228 ];
229 let data = unsafe {
234 self.proxy
235 .send_constructor(_queue, 0, &mut args, WlShmPool::WL_INTERFACE, None)
236 };
237 unsafe { proxy::low_level::from_untyped_owned(data) }
239 }
240}
241
242impl WlShm {
243 #[allow(dead_code)]
245 pub const EVT__FORMAT__SINCE: u32 = 1;
246}
247
248#[allow(dead_code)]
250pub trait WlShmEventHandler {
251 #[inline]
261 fn format(&self, _slf: &WlShmRef, format: WlShmFormat) {
262 let _ = format;
263 }
264}
265
266impl WlShmEventHandler for private::NoOpEventHandler {}
267
268unsafe impl<H> EventHandler for private::EventHandler<H>
270where
271 H: WlShmEventHandler,
272{
273 const WL_INTERFACE: &'static wl_interface = &INTERFACE;
274
275 #[allow(unused_variables)]
276 unsafe fn handle_event(
277 &self,
278 queue: &Queue,
279 slf: &UntypedBorrowedProxy,
280 opcode: u32,
281 args: *mut wl_argument,
282 ) {
283 let slf = unsafe { proxy::low_level::from_untyped_borrowed::<WlShmRef>(slf) };
285 match opcode {
286 0 => {
287 let args = unsafe { &*args.cast::<[wl_argument; 1]>() };
289 let arg0 = unsafe { WlShmFormat(args[0].u) };
291 self.0.format(slf, arg0);
292 }
293 _ => {
294 invalid_opcode("wl_shm", opcode);
295 }
296 }
297 }
298}
299
300impl<H> CreateEventHandler<H> for private::ProxyApi
301where
302 H: WlShmEventHandler,
303{
304 type EventHandler = private::EventHandler<H>;
305
306 #[inline]
307 fn create_event_handler(handler: H) -> Self::EventHandler {
308 private::EventHandler(handler)
309 }
310}
311
312impl WlShm {
313 #[allow(dead_code)]
315 pub const ENM__ERROR_INVALID_FORMAT__SINCE: u32 = 1;
316 #[allow(dead_code)]
318 pub const ENM__ERROR_INVALID_STRIDE__SINCE: u32 = 1;
319 #[allow(dead_code)]
321 pub const ENM__ERROR_INVALID_FD__SINCE: u32 = 1;
322
323 #[allow(dead_code)]
325 pub const ENM__FORMAT_ARGB8888__SINCE: u32 = 1;
326 #[allow(dead_code)]
328 pub const ENM__FORMAT_XRGB8888__SINCE: u32 = 1;
329 #[allow(dead_code)]
331 pub const ENM__FORMAT_C8__SINCE: u32 = 1;
332 #[allow(dead_code)]
334 pub const ENM__FORMAT_RGB332__SINCE: u32 = 1;
335 #[allow(dead_code)]
337 pub const ENM__FORMAT_BGR233__SINCE: u32 = 1;
338 #[allow(dead_code)]
340 pub const ENM__FORMAT_XRGB4444__SINCE: u32 = 1;
341 #[allow(dead_code)]
343 pub const ENM__FORMAT_XBGR4444__SINCE: u32 = 1;
344 #[allow(dead_code)]
346 pub const ENM__FORMAT_RGBX4444__SINCE: u32 = 1;
347 #[allow(dead_code)]
349 pub const ENM__FORMAT_BGRX4444__SINCE: u32 = 1;
350 #[allow(dead_code)]
352 pub const ENM__FORMAT_ARGB4444__SINCE: u32 = 1;
353 #[allow(dead_code)]
355 pub const ENM__FORMAT_ABGR4444__SINCE: u32 = 1;
356 #[allow(dead_code)]
358 pub const ENM__FORMAT_RGBA4444__SINCE: u32 = 1;
359 #[allow(dead_code)]
361 pub const ENM__FORMAT_BGRA4444__SINCE: u32 = 1;
362 #[allow(dead_code)]
364 pub const ENM__FORMAT_XRGB1555__SINCE: u32 = 1;
365 #[allow(dead_code)]
367 pub const ENM__FORMAT_XBGR1555__SINCE: u32 = 1;
368 #[allow(dead_code)]
370 pub const ENM__FORMAT_RGBX5551__SINCE: u32 = 1;
371 #[allow(dead_code)]
373 pub const ENM__FORMAT_BGRX5551__SINCE: u32 = 1;
374 #[allow(dead_code)]
376 pub const ENM__FORMAT_ARGB1555__SINCE: u32 = 1;
377 #[allow(dead_code)]
379 pub const ENM__FORMAT_ABGR1555__SINCE: u32 = 1;
380 #[allow(dead_code)]
382 pub const ENM__FORMAT_RGBA5551__SINCE: u32 = 1;
383 #[allow(dead_code)]
385 pub const ENM__FORMAT_BGRA5551__SINCE: u32 = 1;
386 #[allow(dead_code)]
388 pub const ENM__FORMAT_RGB565__SINCE: u32 = 1;
389 #[allow(dead_code)]
391 pub const ENM__FORMAT_BGR565__SINCE: u32 = 1;
392 #[allow(dead_code)]
394 pub const ENM__FORMAT_RGB888__SINCE: u32 = 1;
395 #[allow(dead_code)]
397 pub const ENM__FORMAT_BGR888__SINCE: u32 = 1;
398 #[allow(dead_code)]
400 pub const ENM__FORMAT_XBGR8888__SINCE: u32 = 1;
401 #[allow(dead_code)]
403 pub const ENM__FORMAT_RGBX8888__SINCE: u32 = 1;
404 #[allow(dead_code)]
406 pub const ENM__FORMAT_BGRX8888__SINCE: u32 = 1;
407 #[allow(dead_code)]
409 pub const ENM__FORMAT_ABGR8888__SINCE: u32 = 1;
410 #[allow(dead_code)]
412 pub const ENM__FORMAT_RGBA8888__SINCE: u32 = 1;
413 #[allow(dead_code)]
415 pub const ENM__FORMAT_BGRA8888__SINCE: u32 = 1;
416 #[allow(dead_code)]
418 pub const ENM__FORMAT_XRGB2101010__SINCE: u32 = 1;
419 #[allow(dead_code)]
421 pub const ENM__FORMAT_XBGR2101010__SINCE: u32 = 1;
422 #[allow(dead_code)]
424 pub const ENM__FORMAT_RGBX1010102__SINCE: u32 = 1;
425 #[allow(dead_code)]
427 pub const ENM__FORMAT_BGRX1010102__SINCE: u32 = 1;
428 #[allow(dead_code)]
430 pub const ENM__FORMAT_ARGB2101010__SINCE: u32 = 1;
431 #[allow(dead_code)]
433 pub const ENM__FORMAT_ABGR2101010__SINCE: u32 = 1;
434 #[allow(dead_code)]
436 pub const ENM__FORMAT_RGBA1010102__SINCE: u32 = 1;
437 #[allow(dead_code)]
439 pub const ENM__FORMAT_BGRA1010102__SINCE: u32 = 1;
440 #[allow(dead_code)]
442 pub const ENM__FORMAT_YUYV__SINCE: u32 = 1;
443 #[allow(dead_code)]
445 pub const ENM__FORMAT_YVYU__SINCE: u32 = 1;
446 #[allow(dead_code)]
448 pub const ENM__FORMAT_UYVY__SINCE: u32 = 1;
449 #[allow(dead_code)]
451 pub const ENM__FORMAT_VYUY__SINCE: u32 = 1;
452 #[allow(dead_code)]
454 pub const ENM__FORMAT_AYUV__SINCE: u32 = 1;
455 #[allow(dead_code)]
457 pub const ENM__FORMAT_NV12__SINCE: u32 = 1;
458 #[allow(dead_code)]
460 pub const ENM__FORMAT_NV21__SINCE: u32 = 1;
461 #[allow(dead_code)]
463 pub const ENM__FORMAT_NV16__SINCE: u32 = 1;
464 #[allow(dead_code)]
466 pub const ENM__FORMAT_NV61__SINCE: u32 = 1;
467 #[allow(dead_code)]
469 pub const ENM__FORMAT_YUV410__SINCE: u32 = 1;
470 #[allow(dead_code)]
472 pub const ENM__FORMAT_YVU410__SINCE: u32 = 1;
473 #[allow(dead_code)]
475 pub const ENM__FORMAT_YUV411__SINCE: u32 = 1;
476 #[allow(dead_code)]
478 pub const ENM__FORMAT_YVU411__SINCE: u32 = 1;
479 #[allow(dead_code)]
481 pub const ENM__FORMAT_YUV420__SINCE: u32 = 1;
482 #[allow(dead_code)]
484 pub const ENM__FORMAT_YVU420__SINCE: u32 = 1;
485 #[allow(dead_code)]
487 pub const ENM__FORMAT_YUV422__SINCE: u32 = 1;
488 #[allow(dead_code)]
490 pub const ENM__FORMAT_YVU422__SINCE: u32 = 1;
491 #[allow(dead_code)]
493 pub const ENM__FORMAT_YUV444__SINCE: u32 = 1;
494 #[allow(dead_code)]
496 pub const ENM__FORMAT_YVU444__SINCE: u32 = 1;
497 #[allow(dead_code)]
499 pub const ENM__FORMAT_R8__SINCE: u32 = 1;
500 #[allow(dead_code)]
502 pub const ENM__FORMAT_R16__SINCE: u32 = 1;
503 #[allow(dead_code)]
505 pub const ENM__FORMAT_RG88__SINCE: u32 = 1;
506 #[allow(dead_code)]
508 pub const ENM__FORMAT_GR88__SINCE: u32 = 1;
509 #[allow(dead_code)]
511 pub const ENM__FORMAT_RG1616__SINCE: u32 = 1;
512 #[allow(dead_code)]
514 pub const ENM__FORMAT_GR1616__SINCE: u32 = 1;
515 #[allow(dead_code)]
517 pub const ENM__FORMAT_XRGB16161616F__SINCE: u32 = 1;
518 #[allow(dead_code)]
520 pub const ENM__FORMAT_XBGR16161616F__SINCE: u32 = 1;
521 #[allow(dead_code)]
523 pub const ENM__FORMAT_ARGB16161616F__SINCE: u32 = 1;
524 #[allow(dead_code)]
526 pub const ENM__FORMAT_ABGR16161616F__SINCE: u32 = 1;
527 #[allow(dead_code)]
529 pub const ENM__FORMAT_XYUV8888__SINCE: u32 = 1;
530 #[allow(dead_code)]
532 pub const ENM__FORMAT_VUY888__SINCE: u32 = 1;
533 #[allow(dead_code)]
535 pub const ENM__FORMAT_VUY101010__SINCE: u32 = 1;
536 #[allow(dead_code)]
538 pub const ENM__FORMAT_Y210__SINCE: u32 = 1;
539 #[allow(dead_code)]
541 pub const ENM__FORMAT_Y212__SINCE: u32 = 1;
542 #[allow(dead_code)]
544 pub const ENM__FORMAT_Y216__SINCE: u32 = 1;
545 #[allow(dead_code)]
547 pub const ENM__FORMAT_Y410__SINCE: u32 = 1;
548 #[allow(dead_code)]
550 pub const ENM__FORMAT_Y412__SINCE: u32 = 1;
551 #[allow(dead_code)]
553 pub const ENM__FORMAT_Y416__SINCE: u32 = 1;
554 #[allow(dead_code)]
556 pub const ENM__FORMAT_XVYU2101010__SINCE: u32 = 1;
557 #[allow(dead_code)]
559 pub const ENM__FORMAT_XVYU12_16161616__SINCE: u32 = 1;
560 #[allow(dead_code)]
562 pub const ENM__FORMAT_XVYU16161616__SINCE: u32 = 1;
563 #[allow(dead_code)]
565 pub const ENM__FORMAT_Y0L0__SINCE: u32 = 1;
566 #[allow(dead_code)]
568 pub const ENM__FORMAT_X0L0__SINCE: u32 = 1;
569 #[allow(dead_code)]
571 pub const ENM__FORMAT_Y0L2__SINCE: u32 = 1;
572 #[allow(dead_code)]
574 pub const ENM__FORMAT_X0L2__SINCE: u32 = 1;
575 #[allow(dead_code)]
577 pub const ENM__FORMAT_YUV420_8BIT__SINCE: u32 = 1;
578 #[allow(dead_code)]
580 pub const ENM__FORMAT_YUV420_10BIT__SINCE: u32 = 1;
581 #[allow(dead_code)]
583 pub const ENM__FORMAT_XRGB8888_A8__SINCE: u32 = 1;
584 #[allow(dead_code)]
586 pub const ENM__FORMAT_XBGR8888_A8__SINCE: u32 = 1;
587 #[allow(dead_code)]
589 pub const ENM__FORMAT_RGBX8888_A8__SINCE: u32 = 1;
590 #[allow(dead_code)]
592 pub const ENM__FORMAT_BGRX8888_A8__SINCE: u32 = 1;
593 #[allow(dead_code)]
595 pub const ENM__FORMAT_RGB888_A8__SINCE: u32 = 1;
596 #[allow(dead_code)]
598 pub const ENM__FORMAT_BGR888_A8__SINCE: u32 = 1;
599 #[allow(dead_code)]
601 pub const ENM__FORMAT_RGB565_A8__SINCE: u32 = 1;
602 #[allow(dead_code)]
604 pub const ENM__FORMAT_BGR565_A8__SINCE: u32 = 1;
605 #[allow(dead_code)]
607 pub const ENM__FORMAT_NV24__SINCE: u32 = 1;
608 #[allow(dead_code)]
610 pub const ENM__FORMAT_NV42__SINCE: u32 = 1;
611 #[allow(dead_code)]
613 pub const ENM__FORMAT_P210__SINCE: u32 = 1;
614 #[allow(dead_code)]
616 pub const ENM__FORMAT_P010__SINCE: u32 = 1;
617 #[allow(dead_code)]
619 pub const ENM__FORMAT_P012__SINCE: u32 = 1;
620 #[allow(dead_code)]
622 pub const ENM__FORMAT_P016__SINCE: u32 = 1;
623 #[allow(dead_code)]
625 pub const ENM__FORMAT_AXBXGXRX106106106106__SINCE: u32 = 1;
626 #[allow(dead_code)]
628 pub const ENM__FORMAT_NV15__SINCE: u32 = 1;
629 #[allow(dead_code)]
631 pub const ENM__FORMAT_Q410__SINCE: u32 = 1;
632 #[allow(dead_code)]
634 pub const ENM__FORMAT_Q401__SINCE: u32 = 1;
635 #[allow(dead_code)]
637 pub const ENM__FORMAT_XRGB16161616__SINCE: u32 = 1;
638 #[allow(dead_code)]
640 pub const ENM__FORMAT_XBGR16161616__SINCE: u32 = 1;
641 #[allow(dead_code)]
643 pub const ENM__FORMAT_ARGB16161616__SINCE: u32 = 1;
644 #[allow(dead_code)]
646 pub const ENM__FORMAT_ABGR16161616__SINCE: u32 = 1;
647 #[allow(dead_code)]
649 pub const ENM__FORMAT_C1__SINCE: u32 = 1;
650 #[allow(dead_code)]
652 pub const ENM__FORMAT_C2__SINCE: u32 = 1;
653 #[allow(dead_code)]
655 pub const ENM__FORMAT_C4__SINCE: u32 = 1;
656 #[allow(dead_code)]
658 pub const ENM__FORMAT_D1__SINCE: u32 = 1;
659 #[allow(dead_code)]
661 pub const ENM__FORMAT_D2__SINCE: u32 = 1;
662 #[allow(dead_code)]
664 pub const ENM__FORMAT_D4__SINCE: u32 = 1;
665 #[allow(dead_code)]
667 pub const ENM__FORMAT_D8__SINCE: u32 = 1;
668 #[allow(dead_code)]
670 pub const ENM__FORMAT_R1__SINCE: u32 = 1;
671 #[allow(dead_code)]
673 pub const ENM__FORMAT_R2__SINCE: u32 = 1;
674 #[allow(dead_code)]
676 pub const ENM__FORMAT_R4__SINCE: u32 = 1;
677 #[allow(dead_code)]
679 pub const ENM__FORMAT_R10__SINCE: u32 = 1;
680 #[allow(dead_code)]
682 pub const ENM__FORMAT_R12__SINCE: u32 = 1;
683 #[allow(dead_code)]
685 pub const ENM__FORMAT_AVUY8888__SINCE: u32 = 1;
686 #[allow(dead_code)]
688 pub const ENM__FORMAT_XVUY8888__SINCE: u32 = 1;
689 #[allow(dead_code)]
691 pub const ENM__FORMAT_P030__SINCE: u32 = 1;
692}
693
694#[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
698#[allow(dead_code)]
699pub struct WlShmError(pub u32);
700
701impl WlShmError {
702 #[allow(dead_code)]
704 pub const INVALID_FORMAT: Self = Self(0);
705
706 #[allow(dead_code)]
708 pub const INVALID_STRIDE: Self = Self(1);
709
710 #[allow(dead_code)]
712 pub const INVALID_FD: Self = Self(2);
713}
714
715impl Debug for WlShmError {
716 fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
717 let name = match *self {
718 Self::INVALID_FORMAT => "INVALID_FORMAT",
719 Self::INVALID_STRIDE => "INVALID_STRIDE",
720 Self::INVALID_FD => "INVALID_FD",
721 _ => return Debug::fmt(&self.0, f),
722 };
723 f.write_str(name)
724 }
725}
726
727#[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
742#[allow(dead_code)]
743pub struct WlShmFormat(pub u32);
744
745impl WlShmFormat {
746 #[allow(dead_code)]
748 pub const ARGB8888: Self = Self(0);
749
750 #[allow(dead_code)]
752 pub const XRGB8888: Self = Self(1);
753
754 #[allow(dead_code)]
756 pub const C8: Self = Self(0x20203843);
757
758 #[allow(dead_code)]
760 pub const RGB332: Self = Self(0x38424752);
761
762 #[allow(dead_code)]
764 pub const BGR233: Self = Self(0x38524742);
765
766 #[allow(dead_code)]
768 pub const XRGB4444: Self = Self(0x32315258);
769
770 #[allow(dead_code)]
772 pub const XBGR4444: Self = Self(0x32314258);
773
774 #[allow(dead_code)]
776 pub const RGBX4444: Self = Self(0x32315852);
777
778 #[allow(dead_code)]
780 pub const BGRX4444: Self = Self(0x32315842);
781
782 #[allow(dead_code)]
784 pub const ARGB4444: Self = Self(0x32315241);
785
786 #[allow(dead_code)]
788 pub const ABGR4444: Self = Self(0x32314241);
789
790 #[allow(dead_code)]
792 pub const RGBA4444: Self = Self(0x32314152);
793
794 #[allow(dead_code)]
796 pub const BGRA4444: Self = Self(0x32314142);
797
798 #[allow(dead_code)]
800 pub const XRGB1555: Self = Self(0x35315258);
801
802 #[allow(dead_code)]
804 pub const XBGR1555: Self = Self(0x35314258);
805
806 #[allow(dead_code)]
808 pub const RGBX5551: Self = Self(0x35315852);
809
810 #[allow(dead_code)]
812 pub const BGRX5551: Self = Self(0x35315842);
813
814 #[allow(dead_code)]
816 pub const ARGB1555: Self = Self(0x35315241);
817
818 #[allow(dead_code)]
820 pub const ABGR1555: Self = Self(0x35314241);
821
822 #[allow(dead_code)]
824 pub const RGBA5551: Self = Self(0x35314152);
825
826 #[allow(dead_code)]
828 pub const BGRA5551: Self = Self(0x35314142);
829
830 #[allow(dead_code)]
832 pub const RGB565: Self = Self(0x36314752);
833
834 #[allow(dead_code)]
836 pub const BGR565: Self = Self(0x36314742);
837
838 #[allow(dead_code)]
840 pub const RGB888: Self = Self(0x34324752);
841
842 #[allow(dead_code)]
844 pub const BGR888: Self = Self(0x34324742);
845
846 #[allow(dead_code)]
848 pub const XBGR8888: Self = Self(0x34324258);
849
850 #[allow(dead_code)]
852 pub const RGBX8888: Self = Self(0x34325852);
853
854 #[allow(dead_code)]
856 pub const BGRX8888: Self = Self(0x34325842);
857
858 #[allow(dead_code)]
860 pub const ABGR8888: Self = Self(0x34324241);
861
862 #[allow(dead_code)]
864 pub const RGBA8888: Self = Self(0x34324152);
865
866 #[allow(dead_code)]
868 pub const BGRA8888: Self = Self(0x34324142);
869
870 #[allow(dead_code)]
872 pub const XRGB2101010: Self = Self(0x30335258);
873
874 #[allow(dead_code)]
876 pub const XBGR2101010: Self = Self(0x30334258);
877
878 #[allow(dead_code)]
880 pub const RGBX1010102: Self = Self(0x30335852);
881
882 #[allow(dead_code)]
884 pub const BGRX1010102: Self = Self(0x30335842);
885
886 #[allow(dead_code)]
888 pub const ARGB2101010: Self = Self(0x30335241);
889
890 #[allow(dead_code)]
892 pub const ABGR2101010: Self = Self(0x30334241);
893
894 #[allow(dead_code)]
896 pub const RGBA1010102: Self = Self(0x30334152);
897
898 #[allow(dead_code)]
900 pub const BGRA1010102: Self = Self(0x30334142);
901
902 #[allow(dead_code)]
904 pub const YUYV: Self = Self(0x56595559);
905
906 #[allow(dead_code)]
908 pub const YVYU: Self = Self(0x55595659);
909
910 #[allow(dead_code)]
912 pub const UYVY: Self = Self(0x59565955);
913
914 #[allow(dead_code)]
916 pub const VYUY: Self = Self(0x59555956);
917
918 #[allow(dead_code)]
920 pub const AYUV: Self = Self(0x56555941);
921
922 #[allow(dead_code)]
924 pub const NV12: Self = Self(0x3231564e);
925
926 #[allow(dead_code)]
928 pub const NV21: Self = Self(0x3132564e);
929
930 #[allow(dead_code)]
932 pub const NV16: Self = Self(0x3631564e);
933
934 #[allow(dead_code)]
936 pub const NV61: Self = Self(0x3136564e);
937
938 #[allow(dead_code)]
940 pub const YUV410: Self = Self(0x39565559);
941
942 #[allow(dead_code)]
944 pub const YVU410: Self = Self(0x39555659);
945
946 #[allow(dead_code)]
948 pub const YUV411: Self = Self(0x31315559);
949
950 #[allow(dead_code)]
952 pub const YVU411: Self = Self(0x31315659);
953
954 #[allow(dead_code)]
956 pub const YUV420: Self = Self(0x32315559);
957
958 #[allow(dead_code)]
960 pub const YVU420: Self = Self(0x32315659);
961
962 #[allow(dead_code)]
964 pub const YUV422: Self = Self(0x36315559);
965
966 #[allow(dead_code)]
968 pub const YVU422: Self = Self(0x36315659);
969
970 #[allow(dead_code)]
972 pub const YUV444: Self = Self(0x34325559);
973
974 #[allow(dead_code)]
976 pub const YVU444: Self = Self(0x34325659);
977
978 #[allow(dead_code)]
980 pub const R8: Self = Self(0x20203852);
981
982 #[allow(dead_code)]
984 pub const R16: Self = Self(0x20363152);
985
986 #[allow(dead_code)]
988 pub const RG88: Self = Self(0x38384752);
989
990 #[allow(dead_code)]
992 pub const GR88: Self = Self(0x38385247);
993
994 #[allow(dead_code)]
996 pub const RG1616: Self = Self(0x32334752);
997
998 #[allow(dead_code)]
1000 pub const GR1616: Self = Self(0x32335247);
1001
1002 #[allow(dead_code)]
1004 pub const XRGB16161616F: Self = Self(0x48345258);
1005
1006 #[allow(dead_code)]
1008 pub const XBGR16161616F: Self = Self(0x48344258);
1009
1010 #[allow(dead_code)]
1012 pub const ARGB16161616F: Self = Self(0x48345241);
1013
1014 #[allow(dead_code)]
1016 pub const ABGR16161616F: Self = Self(0x48344241);
1017
1018 #[allow(dead_code)]
1020 pub const XYUV8888: Self = Self(0x56555958);
1021
1022 #[allow(dead_code)]
1024 pub const VUY888: Self = Self(0x34325556);
1025
1026 #[allow(dead_code)]
1028 pub const VUY101010: Self = Self(0x30335556);
1029
1030 #[allow(dead_code)]
1032 pub const Y210: Self = Self(0x30313259);
1033
1034 #[allow(dead_code)]
1036 pub const Y212: Self = Self(0x32313259);
1037
1038 #[allow(dead_code)]
1040 pub const Y216: Self = Self(0x36313259);
1041
1042 #[allow(dead_code)]
1044 pub const Y410: Self = Self(0x30313459);
1045
1046 #[allow(dead_code)]
1048 pub const Y412: Self = Self(0x32313459);
1049
1050 #[allow(dead_code)]
1052 pub const Y416: Self = Self(0x36313459);
1053
1054 #[allow(dead_code)]
1056 pub const XVYU2101010: Self = Self(0x30335658);
1057
1058 #[allow(dead_code)]
1060 pub const XVYU12_16161616: Self = Self(0x36335658);
1061
1062 #[allow(dead_code)]
1064 pub const XVYU16161616: Self = Self(0x38345658);
1065
1066 #[allow(dead_code)]
1068 pub const Y0L0: Self = Self(0x304c3059);
1069
1070 #[allow(dead_code)]
1072 pub const X0L0: Self = Self(0x304c3058);
1073
1074 #[allow(dead_code)]
1076 pub const Y0L2: Self = Self(0x324c3059);
1077
1078 #[allow(dead_code)]
1080 pub const X0L2: Self = Self(0x324c3058);
1081
1082 #[allow(dead_code)]
1083 pub const YUV420_8BIT: Self = Self(0x38305559);
1084
1085 #[allow(dead_code)]
1086 pub const YUV420_10BIT: Self = Self(0x30315559);
1087
1088 #[allow(dead_code)]
1089 pub const XRGB8888_A8: Self = Self(0x38415258);
1090
1091 #[allow(dead_code)]
1092 pub const XBGR8888_A8: Self = Self(0x38414258);
1093
1094 #[allow(dead_code)]
1095 pub const RGBX8888_A8: Self = Self(0x38415852);
1096
1097 #[allow(dead_code)]
1098 pub const BGRX8888_A8: Self = Self(0x38415842);
1099
1100 #[allow(dead_code)]
1101 pub const RGB888_A8: Self = Self(0x38413852);
1102
1103 #[allow(dead_code)]
1104 pub const BGR888_A8: Self = Self(0x38413842);
1105
1106 #[allow(dead_code)]
1107 pub const RGB565_A8: Self = Self(0x38413552);
1108
1109 #[allow(dead_code)]
1110 pub const BGR565_A8: Self = Self(0x38413542);
1111
1112 #[allow(dead_code)]
1114 pub const NV24: Self = Self(0x3432564e);
1115
1116 #[allow(dead_code)]
1118 pub const NV42: Self = Self(0x3234564e);
1119
1120 #[allow(dead_code)]
1122 pub const P210: Self = Self(0x30313250);
1123
1124 #[allow(dead_code)]
1126 pub const P010: Self = Self(0x30313050);
1127
1128 #[allow(dead_code)]
1130 pub const P012: Self = Self(0x32313050);
1131
1132 #[allow(dead_code)]
1134 pub const P016: Self = Self(0x36313050);
1135
1136 #[allow(dead_code)]
1138 pub const AXBXGXRX106106106106: Self = Self(0x30314241);
1139
1140 #[allow(dead_code)]
1142 pub const NV15: Self = Self(0x3531564e);
1143
1144 #[allow(dead_code)]
1145 pub const Q410: Self = Self(0x30313451);
1146
1147 #[allow(dead_code)]
1148 pub const Q401: Self = Self(0x31303451);
1149
1150 #[allow(dead_code)]
1152 pub const XRGB16161616: Self = Self(0x38345258);
1153
1154 #[allow(dead_code)]
1156 pub const XBGR16161616: Self = Self(0x38344258);
1157
1158 #[allow(dead_code)]
1160 pub const ARGB16161616: Self = Self(0x38345241);
1161
1162 #[allow(dead_code)]
1164 pub const ABGR16161616: Self = Self(0x38344241);
1165
1166 #[allow(dead_code)]
1168 pub const C1: Self = Self(0x20203143);
1169
1170 #[allow(dead_code)]
1172 pub const C2: Self = Self(0x20203243);
1173
1174 #[allow(dead_code)]
1176 pub const C4: Self = Self(0x20203443);
1177
1178 #[allow(dead_code)]
1180 pub const D1: Self = Self(0x20203144);
1181
1182 #[allow(dead_code)]
1184 pub const D2: Self = Self(0x20203244);
1185
1186 #[allow(dead_code)]
1188 pub const D4: Self = Self(0x20203444);
1189
1190 #[allow(dead_code)]
1192 pub const D8: Self = Self(0x20203844);
1193
1194 #[allow(dead_code)]
1196 pub const R1: Self = Self(0x20203152);
1197
1198 #[allow(dead_code)]
1200 pub const R2: Self = Self(0x20203252);
1201
1202 #[allow(dead_code)]
1204 pub const R4: Self = Self(0x20203452);
1205
1206 #[allow(dead_code)]
1208 pub const R10: Self = Self(0x20303152);
1209
1210 #[allow(dead_code)]
1212 pub const R12: Self = Self(0x20323152);
1213
1214 #[allow(dead_code)]
1216 pub const AVUY8888: Self = Self(0x59555641);
1217
1218 #[allow(dead_code)]
1220 pub const XVUY8888: Self = Self(0x59555658);
1221
1222 #[allow(dead_code)]
1224 pub const P030: Self = Self(0x30333050);
1225}
1226
1227impl Debug for WlShmFormat {
1228 fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
1229 let name = match *self {
1230 Self::ARGB8888 => "ARGB8888",
1231 Self::XRGB8888 => "XRGB8888",
1232 Self::C8 => "C8",
1233 Self::RGB332 => "RGB332",
1234 Self::BGR233 => "BGR233",
1235 Self::XRGB4444 => "XRGB4444",
1236 Self::XBGR4444 => "XBGR4444",
1237 Self::RGBX4444 => "RGBX4444",
1238 Self::BGRX4444 => "BGRX4444",
1239 Self::ARGB4444 => "ARGB4444",
1240 Self::ABGR4444 => "ABGR4444",
1241 Self::RGBA4444 => "RGBA4444",
1242 Self::BGRA4444 => "BGRA4444",
1243 Self::XRGB1555 => "XRGB1555",
1244 Self::XBGR1555 => "XBGR1555",
1245 Self::RGBX5551 => "RGBX5551",
1246 Self::BGRX5551 => "BGRX5551",
1247 Self::ARGB1555 => "ARGB1555",
1248 Self::ABGR1555 => "ABGR1555",
1249 Self::RGBA5551 => "RGBA5551",
1250 Self::BGRA5551 => "BGRA5551",
1251 Self::RGB565 => "RGB565",
1252 Self::BGR565 => "BGR565",
1253 Self::RGB888 => "RGB888",
1254 Self::BGR888 => "BGR888",
1255 Self::XBGR8888 => "XBGR8888",
1256 Self::RGBX8888 => "RGBX8888",
1257 Self::BGRX8888 => "BGRX8888",
1258 Self::ABGR8888 => "ABGR8888",
1259 Self::RGBA8888 => "RGBA8888",
1260 Self::BGRA8888 => "BGRA8888",
1261 Self::XRGB2101010 => "XRGB2101010",
1262 Self::XBGR2101010 => "XBGR2101010",
1263 Self::RGBX1010102 => "RGBX1010102",
1264 Self::BGRX1010102 => "BGRX1010102",
1265 Self::ARGB2101010 => "ARGB2101010",
1266 Self::ABGR2101010 => "ABGR2101010",
1267 Self::RGBA1010102 => "RGBA1010102",
1268 Self::BGRA1010102 => "BGRA1010102",
1269 Self::YUYV => "YUYV",
1270 Self::YVYU => "YVYU",
1271 Self::UYVY => "UYVY",
1272 Self::VYUY => "VYUY",
1273 Self::AYUV => "AYUV",
1274 Self::NV12 => "NV12",
1275 Self::NV21 => "NV21",
1276 Self::NV16 => "NV16",
1277 Self::NV61 => "NV61",
1278 Self::YUV410 => "YUV410",
1279 Self::YVU410 => "YVU410",
1280 Self::YUV411 => "YUV411",
1281 Self::YVU411 => "YVU411",
1282 Self::YUV420 => "YUV420",
1283 Self::YVU420 => "YVU420",
1284 Self::YUV422 => "YUV422",
1285 Self::YVU422 => "YVU422",
1286 Self::YUV444 => "YUV444",
1287 Self::YVU444 => "YVU444",
1288 Self::R8 => "R8",
1289 Self::R16 => "R16",
1290 Self::RG88 => "RG88",
1291 Self::GR88 => "GR88",
1292 Self::RG1616 => "RG1616",
1293 Self::GR1616 => "GR1616",
1294 Self::XRGB16161616F => "XRGB16161616F",
1295 Self::XBGR16161616F => "XBGR16161616F",
1296 Self::ARGB16161616F => "ARGB16161616F",
1297 Self::ABGR16161616F => "ABGR16161616F",
1298 Self::XYUV8888 => "XYUV8888",
1299 Self::VUY888 => "VUY888",
1300 Self::VUY101010 => "VUY101010",
1301 Self::Y210 => "Y210",
1302 Self::Y212 => "Y212",
1303 Self::Y216 => "Y216",
1304 Self::Y410 => "Y410",
1305 Self::Y412 => "Y412",
1306 Self::Y416 => "Y416",
1307 Self::XVYU2101010 => "XVYU2101010",
1308 Self::XVYU12_16161616 => "XVYU12_16161616",
1309 Self::XVYU16161616 => "XVYU16161616",
1310 Self::Y0L0 => "Y0L0",
1311 Self::X0L0 => "X0L0",
1312 Self::Y0L2 => "Y0L2",
1313 Self::X0L2 => "X0L2",
1314 Self::YUV420_8BIT => "YUV420_8BIT",
1315 Self::YUV420_10BIT => "YUV420_10BIT",
1316 Self::XRGB8888_A8 => "XRGB8888_A8",
1317 Self::XBGR8888_A8 => "XBGR8888_A8",
1318 Self::RGBX8888_A8 => "RGBX8888_A8",
1319 Self::BGRX8888_A8 => "BGRX8888_A8",
1320 Self::RGB888_A8 => "RGB888_A8",
1321 Self::BGR888_A8 => "BGR888_A8",
1322 Self::RGB565_A8 => "RGB565_A8",
1323 Self::BGR565_A8 => "BGR565_A8",
1324 Self::NV24 => "NV24",
1325 Self::NV42 => "NV42",
1326 Self::P210 => "P210",
1327 Self::P010 => "P010",
1328 Self::P012 => "P012",
1329 Self::P016 => "P016",
1330 Self::AXBXGXRX106106106106 => "AXBXGXRX106106106106",
1331 Self::NV15 => "NV15",
1332 Self::Q410 => "Q410",
1333 Self::Q401 => "Q401",
1334 Self::XRGB16161616 => "XRGB16161616",
1335 Self::XBGR16161616 => "XBGR16161616",
1336 Self::ARGB16161616 => "ARGB16161616",
1337 Self::ABGR16161616 => "ABGR16161616",
1338 Self::C1 => "C1",
1339 Self::C2 => "C2",
1340 Self::C4 => "C4",
1341 Self::D1 => "D1",
1342 Self::D2 => "D2",
1343 Self::D4 => "D4",
1344 Self::D8 => "D8",
1345 Self::R1 => "R1",
1346 Self::R2 => "R2",
1347 Self::R4 => "R4",
1348 Self::R10 => "R10",
1349 Self::R12 => "R12",
1350 Self::AVUY8888 => "AVUY8888",
1351 Self::XVUY8888 => "XVUY8888",
1352 Self::P030 => "P030",
1353 _ => return Debug::fmt(&self.0, f),
1354 };
1355 f.write_str(name)
1356 }
1357}
1358
1359pub mod event_handlers {
1361 use super::*;
1362
1363 pub struct Format<F>(F);
1365 impl<F> WlShmEventHandler for Format<F>
1366 where
1367 F: Fn(&WlShmRef, WlShmFormat),
1368 {
1369 #[inline]
1370 fn format(&self, _slf: &WlShmRef, format: WlShmFormat) {
1371 self.0(_slf, format)
1372 }
1373 }
1374
1375 impl WlShm {
1376 #[allow(dead_code)]
1380 pub fn on_format<F>(f: F) -> Format<F>
1381 where
1382 F: Fn(&WlShmRef, WlShmFormat),
1383 {
1384 Format(f)
1385 }
1386 }
1387}