Crate drm_fourcc[][src]

DrmFourcc is an enum representing every pixel format supported by DRM (as of kernel version 5.10.0).

A fourcc is four bytes of ascii representing some data format. This enum contains every fourcc representing a pixel format supported by DRM, the Linux Direct Rendering Manager.

To get the bytes of the fourcc representing the format, cast to u32.

assert_eq!(DrmFourcc::Xrgb8888 as u32, 875713112);

To get the string form of the fourcc, use DrmFourcc::string_form.

assert_eq!(DrmFourcc::Xrgb8888.string_form(), "XR24");

We also provide a type for representing a fourcc/modifier pair

let format = DrmFormat {
    code: DrmFourcc::Xrgb8888,
    modifier: DrmModifier::Linear,
};

The enums are autogenerated from the canonical list in the Linux source code.

Features

  • serde - Derive Serialize/Deserialize where it makes sense
  • build_bindings - Re-generate autogenerated code. Useful if you need varients added in a more recent kernel version.

Structs

DrmFormat
UnrecognizedFourcc

Wraps some u32 that isn’t a DRM fourcc we recognize

UnrecognizedModifier

Wraps some u64 that isn’t a DRM modifier we recognize

UnrecognizedVendor

Wraps some u8 that isn’t a DRM vendor we recognize

Enums

DrmFourcc
DrmModifier
DrmVendor