1# drm-fourcc 2 3[](https://crates.io/crates/drm-fourcc) 4 5 6Provides an enums representing every pixel format and format modifier supported 7by DRM (as of kernel version 5.10.0). 8 9A [fourcc][fourcc_wiki] is four bytes of ascii representing some data format. This enum contains 10every fourcc representing a pixel format supported by [DRM][drm_wiki], the Linux Direct 11Rendering Manager. 12 13To get the bytes of the fourcc representing the format, cast to `u32`. 14 15```rust 16assert_eq!(DrmFourcc::Xrgb8888 as u32, 875713112); 17``` 18 19To get the string form of the fourcc, use [`DrmFourcc::string_form`]. 20 21```rust 22assert_eq!(DrmFourcc::Xrgb8888.string_form(), "XR24"); 23``` 24 25We also provide a type for representing a fourcc/modifier pair 26 27```rust 28let format = DrmFormat { 29 code: DrmFourcc::Xrgb8888, 30 modifier: DrmModifier::Linear, 31}; 32``` 33 34The enums are autogenerated from the [canonical list][canonical] in the Linux source code. 35 36## Features 37 38- `std`: Enable functionality that requires the standard library. Enabled by default 39- `build_bindings`: Build the bindings based on the headers on your machine. Should not be necessary in most cases. 40 41## Contributors 42 43- [Daniel Franklin](https://github.com/danielzfranklin) 44- [Victor Brekenfeld](https://github.com/Drakulix) 45 46[fourcc_wiki]: https://en.wikipedia.org/wiki/FourCC 47[drm_wiki]: https://en.wikipedia.org/wiki/Direct_Rendering_Managerz 48[canonical]: https://github.com/torvalds/linux/blame/master/include/uapi/drm/drm_fourcc.h 49