1use super::super::all_types::*;
14use ::wl_client::builder::prelude::*;
15
16static INTERFACE: wl_interface = wl_interface {
17 name: c"wl_shm".as_ptr(),
18 version: 2,
19 method_count: 2,
20 methods: {
21 static MESSAGES: [wl_message; 2] = [
22 wl_message {
23 name: c"create_pool".as_ptr(),
24 signature: c"nhi".as_ptr(),
25 types: {
26 static TYPES: [Option<&'static wl_interface>; 3] =
27 [Some(WlShmPool::WL_INTERFACE), None, None];
28 TYPES.as_ptr().cast()
29 },
30 },
31 wl_message {
32 name: c"release".as_ptr(),
33 signature: c"".as_ptr(),
34 types: {
35 static TYPES: [Option<&'static wl_interface>; 0] = [];
36 TYPES.as_ptr().cast()
37 },
38 },
39 ];
40 MESSAGES.as_ptr()
41 },
42 event_count: 1,
43 events: {
44 static MESSAGES: [wl_message; 1] = [wl_message {
45 name: c"format".as_ptr(),
46 signature: c"u".as_ptr(),
47 types: {
48 static TYPES: [Option<&'static wl_interface>; 1] = [None];
49 TYPES.as_ptr().cast()
50 },
51 }];
52 MESSAGES.as_ptr()
53 },
54};
55
56#[derive(Clone, Eq, PartialEq)]
60#[repr(transparent)]
61pub struct WlShm {
62 proxy: UntypedOwnedProxy,
64}
65
66#[derive(Eq, PartialEq)]
70#[repr(transparent)]
71pub struct WlShmRef {
72 proxy: UntypedBorrowedProxy,
74}
75
76unsafe impl UntypedOwnedProxyWrapper for WlShm {}
78
79unsafe impl OwnedProxy for WlShm {
82 const INTERFACE: &'static str = "wl_shm";
83 const WL_INTERFACE: &'static wl_interface = &INTERFACE;
84 const NO_OP_EVENT_HANDLER: Self::NoOpEventHandler =
85 private::EventHandler(private::NoOpEventHandler);
86 const MAX_VERSION: u32 = 2;
87
88 type Borrowed = WlShmRef;
89 type Api = private::ProxyApi;
90 type NoOpEventHandler = private::EventHandler<private::NoOpEventHandler>;
91}
92
93unsafe impl UntypedBorrowedProxyWrapper for WlShmRef {}
95
96unsafe impl BorrowedProxy for WlShmRef {
98 type Owned = WlShm;
99}
100
101impl Deref for WlShm {
102 type Target = WlShmRef;
103
104 fn deref(&self) -> &Self::Target {
105 proxy::low_level::deref(self)
106 }
107}
108
109mod private {
110 pub struct ProxyApi;
111
112 #[allow(dead_code)]
113 pub struct EventHandler<H>(pub(super) H);
114
115 #[allow(dead_code)]
116 pub struct NoOpEventHandler;
117}
118
119impl Debug for WlShm {
120 fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
121 write!(f, "wl_shm#{}", self.proxy.id())
122 }
123}
124
125impl Debug for WlShmRef {
126 fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
127 write!(f, "wl_shm#{}", self.proxy.id())
128 }
129}
130
131impl PartialEq<WlShmRef> for WlShm {
132 fn eq(&self, other: &WlShmRef) -> bool {
133 self.proxy == other.proxy
134 }
135}
136
137impl PartialEq<WlShm> for WlShmRef {
138 fn eq(&self, other: &WlShm) -> bool {
139 self.proxy == other.proxy
140 }
141}
142
143#[allow(dead_code)]
144impl WlShm {
145 #[allow(dead_code)]
147 pub const REQ__CREATE_POOL__SINCE: u32 = 1;
148
149 #[allow(dead_code)]
151 pub const REQ__RELEASE__SINCE: u32 = 2;
152}
153
154#[allow(dead_code)]
155impl WlShm {
156 #[inline]
169 pub fn create_pool(&self, fd: BorrowedFd<'_>, size: i32) -> WlShmPool {
170 let (arg1, arg2) = (fd, size);
171 let mut args = [
172 wl_argument { n: 0 },
173 wl_argument {
174 h: arg1.as_raw_fd(),
175 },
176 wl_argument { i: arg2 },
177 ];
178 let data = unsafe {
183 self.proxy
184 .send_constructor::<false>(0, &mut args, WlShmPool::WL_INTERFACE, None)
185 };
186 unsafe { proxy::low_level::from_untyped_owned(data) }
188 }
189
190 #[inline]
197 pub fn release(&self) {
198 let mut args = [];
199 unsafe {
203 self.proxy.send_destructor(1, &mut args);
204 }
205 }
206}
207
208#[allow(dead_code)]
209impl WlShmRef {
210 #[inline]
224 pub fn create_pool(&self, _queue: &Queue, fd: BorrowedFd<'_>, size: i32) -> WlShmPool {
225 let (arg1, arg2) = (fd, size);
226 let mut args = [
227 wl_argument { n: 0 },
228 wl_argument {
229 h: arg1.as_raw_fd(),
230 },
231 wl_argument { i: arg2 },
232 ];
233 let data = unsafe {
238 self.proxy
239 .send_constructor(_queue, 0, &mut args, WlShmPool::WL_INTERFACE, None)
240 };
241 unsafe { proxy::low_level::from_untyped_owned(data) }
243 }
244}
245
246impl WlShm {
247 #[allow(dead_code)]
249 pub const EVT__FORMAT__SINCE: u32 = 1;
250}
251
252#[allow(dead_code)]
254pub trait WlShmEventHandler {
255 type Data: 'static;
256
257 #[inline]
267 fn format(&self, _data: &mut Self::Data, _slf: &WlShmRef, format: WlShmFormat) {
268 let _ = format;
269 }
270}
271
272impl WlShmEventHandler for private::NoOpEventHandler {
273 type Data = ();
274}
275
276unsafe impl<H> EventHandler for private::EventHandler<H>
279where
280 H: WlShmEventHandler,
281{
282 const WL_INTERFACE: &'static wl_interface = &INTERFACE;
283
284 #[inline]
285 fn mutable_type() -> Option<(TypeId, &'static str)> {
286 let id = TypeId::of::<H::Data>();
287 let name = std::any::type_name::<H::Data>();
288 Some((id, name))
289 }
290
291 #[allow(unused_variables)]
292 unsafe fn handle_event(
293 &self,
294 queue: &Queue,
295 data: *mut u8,
296 slf: &UntypedBorrowedProxy,
297 opcode: u32,
298 args: *mut wl_argument,
299 ) {
300 let slf = unsafe { proxy::low_level::from_untyped_borrowed::<WlShmRef>(slf) };
302 let data: &mut H::Data = unsafe { &mut *data.cast() };
306 match opcode {
307 0 => {
308 let args = unsafe { &*args.cast::<[wl_argument; 1]>() };
310 let arg0 = unsafe { WlShmFormat(args[0].u) };
312 self.0.format(data, slf, arg0);
313 }
314 _ => {
315 invalid_opcode("wl_shm", opcode);
316 }
317 }
318 }
319}
320
321impl<H> CreateEventHandler<H> for private::ProxyApi
322where
323 H: WlShmEventHandler,
324{
325 type EventHandler = private::EventHandler<H>;
326
327 #[inline]
328 fn create_event_handler(handler: H) -> Self::EventHandler {
329 private::EventHandler(handler)
330 }
331}
332
333impl WlShm {
334 #[allow(dead_code)]
336 pub const ENM__ERROR_INVALID_FORMAT__SINCE: u32 = 1;
337 #[allow(dead_code)]
339 pub const ENM__ERROR_INVALID_STRIDE__SINCE: u32 = 1;
340 #[allow(dead_code)]
342 pub const ENM__ERROR_INVALID_FD__SINCE: u32 = 1;
343
344 #[allow(dead_code)]
346 pub const ENM__FORMAT_ARGB8888__SINCE: u32 = 1;
347 #[allow(dead_code)]
349 pub const ENM__FORMAT_XRGB8888__SINCE: u32 = 1;
350 #[allow(dead_code)]
352 pub const ENM__FORMAT_C8__SINCE: u32 = 1;
353 #[allow(dead_code)]
355 pub const ENM__FORMAT_RGB332__SINCE: u32 = 1;
356 #[allow(dead_code)]
358 pub const ENM__FORMAT_BGR233__SINCE: u32 = 1;
359 #[allow(dead_code)]
361 pub const ENM__FORMAT_XRGB4444__SINCE: u32 = 1;
362 #[allow(dead_code)]
364 pub const ENM__FORMAT_XBGR4444__SINCE: u32 = 1;
365 #[allow(dead_code)]
367 pub const ENM__FORMAT_RGBX4444__SINCE: u32 = 1;
368 #[allow(dead_code)]
370 pub const ENM__FORMAT_BGRX4444__SINCE: u32 = 1;
371 #[allow(dead_code)]
373 pub const ENM__FORMAT_ARGB4444__SINCE: u32 = 1;
374 #[allow(dead_code)]
376 pub const ENM__FORMAT_ABGR4444__SINCE: u32 = 1;
377 #[allow(dead_code)]
379 pub const ENM__FORMAT_RGBA4444__SINCE: u32 = 1;
380 #[allow(dead_code)]
382 pub const ENM__FORMAT_BGRA4444__SINCE: u32 = 1;
383 #[allow(dead_code)]
385 pub const ENM__FORMAT_XRGB1555__SINCE: u32 = 1;
386 #[allow(dead_code)]
388 pub const ENM__FORMAT_XBGR1555__SINCE: u32 = 1;
389 #[allow(dead_code)]
391 pub const ENM__FORMAT_RGBX5551__SINCE: u32 = 1;
392 #[allow(dead_code)]
394 pub const ENM__FORMAT_BGRX5551__SINCE: u32 = 1;
395 #[allow(dead_code)]
397 pub const ENM__FORMAT_ARGB1555__SINCE: u32 = 1;
398 #[allow(dead_code)]
400 pub const ENM__FORMAT_ABGR1555__SINCE: u32 = 1;
401 #[allow(dead_code)]
403 pub const ENM__FORMAT_RGBA5551__SINCE: u32 = 1;
404 #[allow(dead_code)]
406 pub const ENM__FORMAT_BGRA5551__SINCE: u32 = 1;
407 #[allow(dead_code)]
409 pub const ENM__FORMAT_RGB565__SINCE: u32 = 1;
410 #[allow(dead_code)]
412 pub const ENM__FORMAT_BGR565__SINCE: u32 = 1;
413 #[allow(dead_code)]
415 pub const ENM__FORMAT_RGB888__SINCE: u32 = 1;
416 #[allow(dead_code)]
418 pub const ENM__FORMAT_BGR888__SINCE: u32 = 1;
419 #[allow(dead_code)]
421 pub const ENM__FORMAT_XBGR8888__SINCE: u32 = 1;
422 #[allow(dead_code)]
424 pub const ENM__FORMAT_RGBX8888__SINCE: u32 = 1;
425 #[allow(dead_code)]
427 pub const ENM__FORMAT_BGRX8888__SINCE: u32 = 1;
428 #[allow(dead_code)]
430 pub const ENM__FORMAT_ABGR8888__SINCE: u32 = 1;
431 #[allow(dead_code)]
433 pub const ENM__FORMAT_RGBA8888__SINCE: u32 = 1;
434 #[allow(dead_code)]
436 pub const ENM__FORMAT_BGRA8888__SINCE: u32 = 1;
437 #[allow(dead_code)]
439 pub const ENM__FORMAT_XRGB2101010__SINCE: u32 = 1;
440 #[allow(dead_code)]
442 pub const ENM__FORMAT_XBGR2101010__SINCE: u32 = 1;
443 #[allow(dead_code)]
445 pub const ENM__FORMAT_RGBX1010102__SINCE: u32 = 1;
446 #[allow(dead_code)]
448 pub const ENM__FORMAT_BGRX1010102__SINCE: u32 = 1;
449 #[allow(dead_code)]
451 pub const ENM__FORMAT_ARGB2101010__SINCE: u32 = 1;
452 #[allow(dead_code)]
454 pub const ENM__FORMAT_ABGR2101010__SINCE: u32 = 1;
455 #[allow(dead_code)]
457 pub const ENM__FORMAT_RGBA1010102__SINCE: u32 = 1;
458 #[allow(dead_code)]
460 pub const ENM__FORMAT_BGRA1010102__SINCE: u32 = 1;
461 #[allow(dead_code)]
463 pub const ENM__FORMAT_YUYV__SINCE: u32 = 1;
464 #[allow(dead_code)]
466 pub const ENM__FORMAT_YVYU__SINCE: u32 = 1;
467 #[allow(dead_code)]
469 pub const ENM__FORMAT_UYVY__SINCE: u32 = 1;
470 #[allow(dead_code)]
472 pub const ENM__FORMAT_VYUY__SINCE: u32 = 1;
473 #[allow(dead_code)]
475 pub const ENM__FORMAT_AYUV__SINCE: u32 = 1;
476 #[allow(dead_code)]
478 pub const ENM__FORMAT_NV12__SINCE: u32 = 1;
479 #[allow(dead_code)]
481 pub const ENM__FORMAT_NV21__SINCE: u32 = 1;
482 #[allow(dead_code)]
484 pub const ENM__FORMAT_NV16__SINCE: u32 = 1;
485 #[allow(dead_code)]
487 pub const ENM__FORMAT_NV61__SINCE: u32 = 1;
488 #[allow(dead_code)]
490 pub const ENM__FORMAT_YUV410__SINCE: u32 = 1;
491 #[allow(dead_code)]
493 pub const ENM__FORMAT_YVU410__SINCE: u32 = 1;
494 #[allow(dead_code)]
496 pub const ENM__FORMAT_YUV411__SINCE: u32 = 1;
497 #[allow(dead_code)]
499 pub const ENM__FORMAT_YVU411__SINCE: u32 = 1;
500 #[allow(dead_code)]
502 pub const ENM__FORMAT_YUV420__SINCE: u32 = 1;
503 #[allow(dead_code)]
505 pub const ENM__FORMAT_YVU420__SINCE: u32 = 1;
506 #[allow(dead_code)]
508 pub const ENM__FORMAT_YUV422__SINCE: u32 = 1;
509 #[allow(dead_code)]
511 pub const ENM__FORMAT_YVU422__SINCE: u32 = 1;
512 #[allow(dead_code)]
514 pub const ENM__FORMAT_YUV444__SINCE: u32 = 1;
515 #[allow(dead_code)]
517 pub const ENM__FORMAT_YVU444__SINCE: u32 = 1;
518 #[allow(dead_code)]
520 pub const ENM__FORMAT_R8__SINCE: u32 = 1;
521 #[allow(dead_code)]
523 pub const ENM__FORMAT_R16__SINCE: u32 = 1;
524 #[allow(dead_code)]
526 pub const ENM__FORMAT_RG88__SINCE: u32 = 1;
527 #[allow(dead_code)]
529 pub const ENM__FORMAT_GR88__SINCE: u32 = 1;
530 #[allow(dead_code)]
532 pub const ENM__FORMAT_RG1616__SINCE: u32 = 1;
533 #[allow(dead_code)]
535 pub const ENM__FORMAT_GR1616__SINCE: u32 = 1;
536 #[allow(dead_code)]
538 pub const ENM__FORMAT_XRGB16161616F__SINCE: u32 = 1;
539 #[allow(dead_code)]
541 pub const ENM__FORMAT_XBGR16161616F__SINCE: u32 = 1;
542 #[allow(dead_code)]
544 pub const ENM__FORMAT_ARGB16161616F__SINCE: u32 = 1;
545 #[allow(dead_code)]
547 pub const ENM__FORMAT_ABGR16161616F__SINCE: u32 = 1;
548 #[allow(dead_code)]
550 pub const ENM__FORMAT_XYUV8888__SINCE: u32 = 1;
551 #[allow(dead_code)]
553 pub const ENM__FORMAT_VUY888__SINCE: u32 = 1;
554 #[allow(dead_code)]
556 pub const ENM__FORMAT_VUY101010__SINCE: u32 = 1;
557 #[allow(dead_code)]
559 pub const ENM__FORMAT_Y210__SINCE: u32 = 1;
560 #[allow(dead_code)]
562 pub const ENM__FORMAT_Y212__SINCE: u32 = 1;
563 #[allow(dead_code)]
565 pub const ENM__FORMAT_Y216__SINCE: u32 = 1;
566 #[allow(dead_code)]
568 pub const ENM__FORMAT_Y410__SINCE: u32 = 1;
569 #[allow(dead_code)]
571 pub const ENM__FORMAT_Y412__SINCE: u32 = 1;
572 #[allow(dead_code)]
574 pub const ENM__FORMAT_Y416__SINCE: u32 = 1;
575 #[allow(dead_code)]
577 pub const ENM__FORMAT_XVYU2101010__SINCE: u32 = 1;
578 #[allow(dead_code)]
580 pub const ENM__FORMAT_XVYU12_16161616__SINCE: u32 = 1;
581 #[allow(dead_code)]
583 pub const ENM__FORMAT_XVYU16161616__SINCE: u32 = 1;
584 #[allow(dead_code)]
586 pub const ENM__FORMAT_Y0L0__SINCE: u32 = 1;
587 #[allow(dead_code)]
589 pub const ENM__FORMAT_X0L0__SINCE: u32 = 1;
590 #[allow(dead_code)]
592 pub const ENM__FORMAT_Y0L2__SINCE: u32 = 1;
593 #[allow(dead_code)]
595 pub const ENM__FORMAT_X0L2__SINCE: u32 = 1;
596 #[allow(dead_code)]
598 pub const ENM__FORMAT_YUV420_8BIT__SINCE: u32 = 1;
599 #[allow(dead_code)]
601 pub const ENM__FORMAT_YUV420_10BIT__SINCE: u32 = 1;
602 #[allow(dead_code)]
604 pub const ENM__FORMAT_XRGB8888_A8__SINCE: u32 = 1;
605 #[allow(dead_code)]
607 pub const ENM__FORMAT_XBGR8888_A8__SINCE: u32 = 1;
608 #[allow(dead_code)]
610 pub const ENM__FORMAT_RGBX8888_A8__SINCE: u32 = 1;
611 #[allow(dead_code)]
613 pub const ENM__FORMAT_BGRX8888_A8__SINCE: u32 = 1;
614 #[allow(dead_code)]
616 pub const ENM__FORMAT_RGB888_A8__SINCE: u32 = 1;
617 #[allow(dead_code)]
619 pub const ENM__FORMAT_BGR888_A8__SINCE: u32 = 1;
620 #[allow(dead_code)]
622 pub const ENM__FORMAT_RGB565_A8__SINCE: u32 = 1;
623 #[allow(dead_code)]
625 pub const ENM__FORMAT_BGR565_A8__SINCE: u32 = 1;
626 #[allow(dead_code)]
628 pub const ENM__FORMAT_NV24__SINCE: u32 = 1;
629 #[allow(dead_code)]
631 pub const ENM__FORMAT_NV42__SINCE: u32 = 1;
632 #[allow(dead_code)]
634 pub const ENM__FORMAT_P210__SINCE: u32 = 1;
635 #[allow(dead_code)]
637 pub const ENM__FORMAT_P010__SINCE: u32 = 1;
638 #[allow(dead_code)]
640 pub const ENM__FORMAT_P012__SINCE: u32 = 1;
641 #[allow(dead_code)]
643 pub const ENM__FORMAT_P016__SINCE: u32 = 1;
644 #[allow(dead_code)]
646 pub const ENM__FORMAT_AXBXGXRX106106106106__SINCE: u32 = 1;
647 #[allow(dead_code)]
649 pub const ENM__FORMAT_NV15__SINCE: u32 = 1;
650 #[allow(dead_code)]
652 pub const ENM__FORMAT_Q410__SINCE: u32 = 1;
653 #[allow(dead_code)]
655 pub const ENM__FORMAT_Q401__SINCE: u32 = 1;
656 #[allow(dead_code)]
658 pub const ENM__FORMAT_XRGB16161616__SINCE: u32 = 1;
659 #[allow(dead_code)]
661 pub const ENM__FORMAT_XBGR16161616__SINCE: u32 = 1;
662 #[allow(dead_code)]
664 pub const ENM__FORMAT_ARGB16161616__SINCE: u32 = 1;
665 #[allow(dead_code)]
667 pub const ENM__FORMAT_ABGR16161616__SINCE: u32 = 1;
668 #[allow(dead_code)]
670 pub const ENM__FORMAT_C1__SINCE: u32 = 1;
671 #[allow(dead_code)]
673 pub const ENM__FORMAT_C2__SINCE: u32 = 1;
674 #[allow(dead_code)]
676 pub const ENM__FORMAT_C4__SINCE: u32 = 1;
677 #[allow(dead_code)]
679 pub const ENM__FORMAT_D1__SINCE: u32 = 1;
680 #[allow(dead_code)]
682 pub const ENM__FORMAT_D2__SINCE: u32 = 1;
683 #[allow(dead_code)]
685 pub const ENM__FORMAT_D4__SINCE: u32 = 1;
686 #[allow(dead_code)]
688 pub const ENM__FORMAT_D8__SINCE: u32 = 1;
689 #[allow(dead_code)]
691 pub const ENM__FORMAT_R1__SINCE: u32 = 1;
692 #[allow(dead_code)]
694 pub const ENM__FORMAT_R2__SINCE: u32 = 1;
695 #[allow(dead_code)]
697 pub const ENM__FORMAT_R4__SINCE: u32 = 1;
698 #[allow(dead_code)]
700 pub const ENM__FORMAT_R10__SINCE: u32 = 1;
701 #[allow(dead_code)]
703 pub const ENM__FORMAT_R12__SINCE: u32 = 1;
704 #[allow(dead_code)]
706 pub const ENM__FORMAT_AVUY8888__SINCE: u32 = 1;
707 #[allow(dead_code)]
709 pub const ENM__FORMAT_XVUY8888__SINCE: u32 = 1;
710 #[allow(dead_code)]
712 pub const ENM__FORMAT_P030__SINCE: u32 = 1;
713}
714
715#[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
719#[allow(dead_code)]
720pub struct WlShmError(pub u32);
721
722impl WlShmError {
723 #[allow(dead_code)]
725 pub const INVALID_FORMAT: Self = Self(0);
726
727 #[allow(dead_code)]
729 pub const INVALID_STRIDE: Self = Self(1);
730
731 #[allow(dead_code)]
733 pub const INVALID_FD: Self = Self(2);
734}
735
736impl Debug for WlShmError {
737 fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
738 let name = match *self {
739 Self::INVALID_FORMAT => "INVALID_FORMAT",
740 Self::INVALID_STRIDE => "INVALID_STRIDE",
741 Self::INVALID_FD => "INVALID_FD",
742 _ => return Debug::fmt(&self.0, f),
743 };
744 f.write_str(name)
745 }
746}
747
748#[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
763#[allow(dead_code)]
764pub struct WlShmFormat(pub u32);
765
766impl WlShmFormat {
767 #[allow(dead_code)]
769 pub const ARGB8888: Self = Self(0);
770
771 #[allow(dead_code)]
773 pub const XRGB8888: Self = Self(1);
774
775 #[allow(dead_code)]
777 pub const C8: Self = Self(0x20203843);
778
779 #[allow(dead_code)]
781 pub const RGB332: Self = Self(0x38424752);
782
783 #[allow(dead_code)]
785 pub const BGR233: Self = Self(0x38524742);
786
787 #[allow(dead_code)]
789 pub const XRGB4444: Self = Self(0x32315258);
790
791 #[allow(dead_code)]
793 pub const XBGR4444: Self = Self(0x32314258);
794
795 #[allow(dead_code)]
797 pub const RGBX4444: Self = Self(0x32315852);
798
799 #[allow(dead_code)]
801 pub const BGRX4444: Self = Self(0x32315842);
802
803 #[allow(dead_code)]
805 pub const ARGB4444: Self = Self(0x32315241);
806
807 #[allow(dead_code)]
809 pub const ABGR4444: Self = Self(0x32314241);
810
811 #[allow(dead_code)]
813 pub const RGBA4444: Self = Self(0x32314152);
814
815 #[allow(dead_code)]
817 pub const BGRA4444: Self = Self(0x32314142);
818
819 #[allow(dead_code)]
821 pub const XRGB1555: Self = Self(0x35315258);
822
823 #[allow(dead_code)]
825 pub const XBGR1555: Self = Self(0x35314258);
826
827 #[allow(dead_code)]
829 pub const RGBX5551: Self = Self(0x35315852);
830
831 #[allow(dead_code)]
833 pub const BGRX5551: Self = Self(0x35315842);
834
835 #[allow(dead_code)]
837 pub const ARGB1555: Self = Self(0x35315241);
838
839 #[allow(dead_code)]
841 pub const ABGR1555: Self = Self(0x35314241);
842
843 #[allow(dead_code)]
845 pub const RGBA5551: Self = Self(0x35314152);
846
847 #[allow(dead_code)]
849 pub const BGRA5551: Self = Self(0x35314142);
850
851 #[allow(dead_code)]
853 pub const RGB565: Self = Self(0x36314752);
854
855 #[allow(dead_code)]
857 pub const BGR565: Self = Self(0x36314742);
858
859 #[allow(dead_code)]
861 pub const RGB888: Self = Self(0x34324752);
862
863 #[allow(dead_code)]
865 pub const BGR888: Self = Self(0x34324742);
866
867 #[allow(dead_code)]
869 pub const XBGR8888: Self = Self(0x34324258);
870
871 #[allow(dead_code)]
873 pub const RGBX8888: Self = Self(0x34325852);
874
875 #[allow(dead_code)]
877 pub const BGRX8888: Self = Self(0x34325842);
878
879 #[allow(dead_code)]
881 pub const ABGR8888: Self = Self(0x34324241);
882
883 #[allow(dead_code)]
885 pub const RGBA8888: Self = Self(0x34324152);
886
887 #[allow(dead_code)]
889 pub const BGRA8888: Self = Self(0x34324142);
890
891 #[allow(dead_code)]
893 pub const XRGB2101010: Self = Self(0x30335258);
894
895 #[allow(dead_code)]
897 pub const XBGR2101010: Self = Self(0x30334258);
898
899 #[allow(dead_code)]
901 pub const RGBX1010102: Self = Self(0x30335852);
902
903 #[allow(dead_code)]
905 pub const BGRX1010102: Self = Self(0x30335842);
906
907 #[allow(dead_code)]
909 pub const ARGB2101010: Self = Self(0x30335241);
910
911 #[allow(dead_code)]
913 pub const ABGR2101010: Self = Self(0x30334241);
914
915 #[allow(dead_code)]
917 pub const RGBA1010102: Self = Self(0x30334152);
918
919 #[allow(dead_code)]
921 pub const BGRA1010102: Self = Self(0x30334142);
922
923 #[allow(dead_code)]
925 pub const YUYV: Self = Self(0x56595559);
926
927 #[allow(dead_code)]
929 pub const YVYU: Self = Self(0x55595659);
930
931 #[allow(dead_code)]
933 pub const UYVY: Self = Self(0x59565955);
934
935 #[allow(dead_code)]
937 pub const VYUY: Self = Self(0x59555956);
938
939 #[allow(dead_code)]
941 pub const AYUV: Self = Self(0x56555941);
942
943 #[allow(dead_code)]
945 pub const NV12: Self = Self(0x3231564e);
946
947 #[allow(dead_code)]
949 pub const NV21: Self = Self(0x3132564e);
950
951 #[allow(dead_code)]
953 pub const NV16: Self = Self(0x3631564e);
954
955 #[allow(dead_code)]
957 pub const NV61: Self = Self(0x3136564e);
958
959 #[allow(dead_code)]
961 pub const YUV410: Self = Self(0x39565559);
962
963 #[allow(dead_code)]
965 pub const YVU410: Self = Self(0x39555659);
966
967 #[allow(dead_code)]
969 pub const YUV411: Self = Self(0x31315559);
970
971 #[allow(dead_code)]
973 pub const YVU411: Self = Self(0x31315659);
974
975 #[allow(dead_code)]
977 pub const YUV420: Self = Self(0x32315559);
978
979 #[allow(dead_code)]
981 pub const YVU420: Self = Self(0x32315659);
982
983 #[allow(dead_code)]
985 pub const YUV422: Self = Self(0x36315559);
986
987 #[allow(dead_code)]
989 pub const YVU422: Self = Self(0x36315659);
990
991 #[allow(dead_code)]
993 pub const YUV444: Self = Self(0x34325559);
994
995 #[allow(dead_code)]
997 pub const YVU444: Self = Self(0x34325659);
998
999 #[allow(dead_code)]
1001 pub const R8: Self = Self(0x20203852);
1002
1003 #[allow(dead_code)]
1005 pub const R16: Self = Self(0x20363152);
1006
1007 #[allow(dead_code)]
1009 pub const RG88: Self = Self(0x38384752);
1010
1011 #[allow(dead_code)]
1013 pub const GR88: Self = Self(0x38385247);
1014
1015 #[allow(dead_code)]
1017 pub const RG1616: Self = Self(0x32334752);
1018
1019 #[allow(dead_code)]
1021 pub const GR1616: Self = Self(0x32335247);
1022
1023 #[allow(dead_code)]
1025 pub const XRGB16161616F: Self = Self(0x48345258);
1026
1027 #[allow(dead_code)]
1029 pub const XBGR16161616F: Self = Self(0x48344258);
1030
1031 #[allow(dead_code)]
1033 pub const ARGB16161616F: Self = Self(0x48345241);
1034
1035 #[allow(dead_code)]
1037 pub const ABGR16161616F: Self = Self(0x48344241);
1038
1039 #[allow(dead_code)]
1041 pub const XYUV8888: Self = Self(0x56555958);
1042
1043 #[allow(dead_code)]
1045 pub const VUY888: Self = Self(0x34325556);
1046
1047 #[allow(dead_code)]
1049 pub const VUY101010: Self = Self(0x30335556);
1050
1051 #[allow(dead_code)]
1053 pub const Y210: Self = Self(0x30313259);
1054
1055 #[allow(dead_code)]
1057 pub const Y212: Self = Self(0x32313259);
1058
1059 #[allow(dead_code)]
1061 pub const Y216: Self = Self(0x36313259);
1062
1063 #[allow(dead_code)]
1065 pub const Y410: Self = Self(0x30313459);
1066
1067 #[allow(dead_code)]
1069 pub const Y412: Self = Self(0x32313459);
1070
1071 #[allow(dead_code)]
1073 pub const Y416: Self = Self(0x36313459);
1074
1075 #[allow(dead_code)]
1077 pub const XVYU2101010: Self = Self(0x30335658);
1078
1079 #[allow(dead_code)]
1081 pub const XVYU12_16161616: Self = Self(0x36335658);
1082
1083 #[allow(dead_code)]
1085 pub const XVYU16161616: Self = Self(0x38345658);
1086
1087 #[allow(dead_code)]
1089 pub const Y0L0: Self = Self(0x304c3059);
1090
1091 #[allow(dead_code)]
1093 pub const X0L0: Self = Self(0x304c3058);
1094
1095 #[allow(dead_code)]
1097 pub const Y0L2: Self = Self(0x324c3059);
1098
1099 #[allow(dead_code)]
1101 pub const X0L2: Self = Self(0x324c3058);
1102
1103 #[allow(dead_code)]
1104 pub const YUV420_8BIT: Self = Self(0x38305559);
1105
1106 #[allow(dead_code)]
1107 pub const YUV420_10BIT: Self = Self(0x30315559);
1108
1109 #[allow(dead_code)]
1110 pub const XRGB8888_A8: Self = Self(0x38415258);
1111
1112 #[allow(dead_code)]
1113 pub const XBGR8888_A8: Self = Self(0x38414258);
1114
1115 #[allow(dead_code)]
1116 pub const RGBX8888_A8: Self = Self(0x38415852);
1117
1118 #[allow(dead_code)]
1119 pub const BGRX8888_A8: Self = Self(0x38415842);
1120
1121 #[allow(dead_code)]
1122 pub const RGB888_A8: Self = Self(0x38413852);
1123
1124 #[allow(dead_code)]
1125 pub const BGR888_A8: Self = Self(0x38413842);
1126
1127 #[allow(dead_code)]
1128 pub const RGB565_A8: Self = Self(0x38413552);
1129
1130 #[allow(dead_code)]
1131 pub const BGR565_A8: Self = Self(0x38413542);
1132
1133 #[allow(dead_code)]
1135 pub const NV24: Self = Self(0x3432564e);
1136
1137 #[allow(dead_code)]
1139 pub const NV42: Self = Self(0x3234564e);
1140
1141 #[allow(dead_code)]
1143 pub const P210: Self = Self(0x30313250);
1144
1145 #[allow(dead_code)]
1147 pub const P010: Self = Self(0x30313050);
1148
1149 #[allow(dead_code)]
1151 pub const P012: Self = Self(0x32313050);
1152
1153 #[allow(dead_code)]
1155 pub const P016: Self = Self(0x36313050);
1156
1157 #[allow(dead_code)]
1159 pub const AXBXGXRX106106106106: Self = Self(0x30314241);
1160
1161 #[allow(dead_code)]
1163 pub const NV15: Self = Self(0x3531564e);
1164
1165 #[allow(dead_code)]
1166 pub const Q410: Self = Self(0x30313451);
1167
1168 #[allow(dead_code)]
1169 pub const Q401: Self = Self(0x31303451);
1170
1171 #[allow(dead_code)]
1173 pub const XRGB16161616: Self = Self(0x38345258);
1174
1175 #[allow(dead_code)]
1177 pub const XBGR16161616: Self = Self(0x38344258);
1178
1179 #[allow(dead_code)]
1181 pub const ARGB16161616: Self = Self(0x38345241);
1182
1183 #[allow(dead_code)]
1185 pub const ABGR16161616: Self = Self(0x38344241);
1186
1187 #[allow(dead_code)]
1189 pub const C1: Self = Self(0x20203143);
1190
1191 #[allow(dead_code)]
1193 pub const C2: Self = Self(0x20203243);
1194
1195 #[allow(dead_code)]
1197 pub const C4: Self = Self(0x20203443);
1198
1199 #[allow(dead_code)]
1201 pub const D1: Self = Self(0x20203144);
1202
1203 #[allow(dead_code)]
1205 pub const D2: Self = Self(0x20203244);
1206
1207 #[allow(dead_code)]
1209 pub const D4: Self = Self(0x20203444);
1210
1211 #[allow(dead_code)]
1213 pub const D8: Self = Self(0x20203844);
1214
1215 #[allow(dead_code)]
1217 pub const R1: Self = Self(0x20203152);
1218
1219 #[allow(dead_code)]
1221 pub const R2: Self = Self(0x20203252);
1222
1223 #[allow(dead_code)]
1225 pub const R4: Self = Self(0x20203452);
1226
1227 #[allow(dead_code)]
1229 pub const R10: Self = Self(0x20303152);
1230
1231 #[allow(dead_code)]
1233 pub const R12: Self = Self(0x20323152);
1234
1235 #[allow(dead_code)]
1237 pub const AVUY8888: Self = Self(0x59555641);
1238
1239 #[allow(dead_code)]
1241 pub const XVUY8888: Self = Self(0x59555658);
1242
1243 #[allow(dead_code)]
1245 pub const P030: Self = Self(0x30333050);
1246}
1247
1248impl Debug for WlShmFormat {
1249 fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
1250 let name = match *self {
1251 Self::ARGB8888 => "ARGB8888",
1252 Self::XRGB8888 => "XRGB8888",
1253 Self::C8 => "C8",
1254 Self::RGB332 => "RGB332",
1255 Self::BGR233 => "BGR233",
1256 Self::XRGB4444 => "XRGB4444",
1257 Self::XBGR4444 => "XBGR4444",
1258 Self::RGBX4444 => "RGBX4444",
1259 Self::BGRX4444 => "BGRX4444",
1260 Self::ARGB4444 => "ARGB4444",
1261 Self::ABGR4444 => "ABGR4444",
1262 Self::RGBA4444 => "RGBA4444",
1263 Self::BGRA4444 => "BGRA4444",
1264 Self::XRGB1555 => "XRGB1555",
1265 Self::XBGR1555 => "XBGR1555",
1266 Self::RGBX5551 => "RGBX5551",
1267 Self::BGRX5551 => "BGRX5551",
1268 Self::ARGB1555 => "ARGB1555",
1269 Self::ABGR1555 => "ABGR1555",
1270 Self::RGBA5551 => "RGBA5551",
1271 Self::BGRA5551 => "BGRA5551",
1272 Self::RGB565 => "RGB565",
1273 Self::BGR565 => "BGR565",
1274 Self::RGB888 => "RGB888",
1275 Self::BGR888 => "BGR888",
1276 Self::XBGR8888 => "XBGR8888",
1277 Self::RGBX8888 => "RGBX8888",
1278 Self::BGRX8888 => "BGRX8888",
1279 Self::ABGR8888 => "ABGR8888",
1280 Self::RGBA8888 => "RGBA8888",
1281 Self::BGRA8888 => "BGRA8888",
1282 Self::XRGB2101010 => "XRGB2101010",
1283 Self::XBGR2101010 => "XBGR2101010",
1284 Self::RGBX1010102 => "RGBX1010102",
1285 Self::BGRX1010102 => "BGRX1010102",
1286 Self::ARGB2101010 => "ARGB2101010",
1287 Self::ABGR2101010 => "ABGR2101010",
1288 Self::RGBA1010102 => "RGBA1010102",
1289 Self::BGRA1010102 => "BGRA1010102",
1290 Self::YUYV => "YUYV",
1291 Self::YVYU => "YVYU",
1292 Self::UYVY => "UYVY",
1293 Self::VYUY => "VYUY",
1294 Self::AYUV => "AYUV",
1295 Self::NV12 => "NV12",
1296 Self::NV21 => "NV21",
1297 Self::NV16 => "NV16",
1298 Self::NV61 => "NV61",
1299 Self::YUV410 => "YUV410",
1300 Self::YVU410 => "YVU410",
1301 Self::YUV411 => "YUV411",
1302 Self::YVU411 => "YVU411",
1303 Self::YUV420 => "YUV420",
1304 Self::YVU420 => "YVU420",
1305 Self::YUV422 => "YUV422",
1306 Self::YVU422 => "YVU422",
1307 Self::YUV444 => "YUV444",
1308 Self::YVU444 => "YVU444",
1309 Self::R8 => "R8",
1310 Self::R16 => "R16",
1311 Self::RG88 => "RG88",
1312 Self::GR88 => "GR88",
1313 Self::RG1616 => "RG1616",
1314 Self::GR1616 => "GR1616",
1315 Self::XRGB16161616F => "XRGB16161616F",
1316 Self::XBGR16161616F => "XBGR16161616F",
1317 Self::ARGB16161616F => "ARGB16161616F",
1318 Self::ABGR16161616F => "ABGR16161616F",
1319 Self::XYUV8888 => "XYUV8888",
1320 Self::VUY888 => "VUY888",
1321 Self::VUY101010 => "VUY101010",
1322 Self::Y210 => "Y210",
1323 Self::Y212 => "Y212",
1324 Self::Y216 => "Y216",
1325 Self::Y410 => "Y410",
1326 Self::Y412 => "Y412",
1327 Self::Y416 => "Y416",
1328 Self::XVYU2101010 => "XVYU2101010",
1329 Self::XVYU12_16161616 => "XVYU12_16161616",
1330 Self::XVYU16161616 => "XVYU16161616",
1331 Self::Y0L0 => "Y0L0",
1332 Self::X0L0 => "X0L0",
1333 Self::Y0L2 => "Y0L2",
1334 Self::X0L2 => "X0L2",
1335 Self::YUV420_8BIT => "YUV420_8BIT",
1336 Self::YUV420_10BIT => "YUV420_10BIT",
1337 Self::XRGB8888_A8 => "XRGB8888_A8",
1338 Self::XBGR8888_A8 => "XBGR8888_A8",
1339 Self::RGBX8888_A8 => "RGBX8888_A8",
1340 Self::BGRX8888_A8 => "BGRX8888_A8",
1341 Self::RGB888_A8 => "RGB888_A8",
1342 Self::BGR888_A8 => "BGR888_A8",
1343 Self::RGB565_A8 => "RGB565_A8",
1344 Self::BGR565_A8 => "BGR565_A8",
1345 Self::NV24 => "NV24",
1346 Self::NV42 => "NV42",
1347 Self::P210 => "P210",
1348 Self::P010 => "P010",
1349 Self::P012 => "P012",
1350 Self::P016 => "P016",
1351 Self::AXBXGXRX106106106106 => "AXBXGXRX106106106106",
1352 Self::NV15 => "NV15",
1353 Self::Q410 => "Q410",
1354 Self::Q401 => "Q401",
1355 Self::XRGB16161616 => "XRGB16161616",
1356 Self::XBGR16161616 => "XBGR16161616",
1357 Self::ARGB16161616 => "ARGB16161616",
1358 Self::ABGR16161616 => "ABGR16161616",
1359 Self::C1 => "C1",
1360 Self::C2 => "C2",
1361 Self::C4 => "C4",
1362 Self::D1 => "D1",
1363 Self::D2 => "D2",
1364 Self::D4 => "D4",
1365 Self::D8 => "D8",
1366 Self::R1 => "R1",
1367 Self::R2 => "R2",
1368 Self::R4 => "R4",
1369 Self::R10 => "R10",
1370 Self::R12 => "R12",
1371 Self::AVUY8888 => "AVUY8888",
1372 Self::XVUY8888 => "XVUY8888",
1373 Self::P030 => "P030",
1374 _ => return Debug::fmt(&self.0, f),
1375 };
1376 f.write_str(name)
1377 }
1378}
1379
1380pub mod event_handlers {
1382 use super::*;
1383
1384 pub struct Format<T, F>(F, PhantomData<fn(&mut T)>);
1386 impl<T, F> WlShmEventHandler for Format<T, F>
1387 where
1388 T: 'static,
1389 F: Fn(&mut T, &WlShmRef, WlShmFormat),
1390 {
1391 type Data = T;
1392
1393 #[inline]
1394 fn format(&self, _data: &mut T, _slf: &WlShmRef, format: WlShmFormat) {
1395 self.0(_data, _slf, format)
1396 }
1397 }
1398
1399 impl WlShm {
1400 #[allow(dead_code)]
1404 pub fn on_format<T, F>(f: F) -> Format<T, F>
1405 where
1406 T: 'static,
1407 F: Fn(&mut T, &WlShmRef, WlShmFormat),
1408 {
1409 Format(f, PhantomData)
1410 }
1411 }
1412}