#pixel-format #drm #linux #linux-kernel #fourcc

no-std drm-fourcc

Provides an enum with every valid Direct Rendering Manager (DRM) format fourcc

10 stable releases

2.2.0 Sep 5, 2021
2.1.1 May 10, 2021
2.1.0 Apr 8, 2021
2.0.0 Mar 30, 2021
1.3.3 Mar 28, 2021

#199 in Unix APIs

Download history 29196/week @ 2024-06-11 26664/week @ 2024-06-18 26735/week @ 2024-06-25 19803/week @ 2024-07-02 21982/week @ 2024-07-09 22128/week @ 2024-07-16 22606/week @ 2024-07-23 19279/week @ 2024-07-30 22174/week @ 2024-08-06 20376/week @ 2024-08-13 20817/week @ 2024-08-20 20932/week @ 2024-08-27 23205/week @ 2024-09-03 20780/week @ 2024-09-10 22933/week @ 2024-09-17 21315/week @ 2024-09-24

90,935 downloads per month
Used in 63 crates (11 directly)

MIT license

53KB
959 lines

drm-fourcc

Crates.io MIT Licensed

Provides an enums representing every pixel format and format modifier 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

  • std: Enable functionality that requires the standard library. Enabled by default
  • build_bindings: Build the bindings based on the headers on your machine. Should not be necessary in most cases.

Contributors

Dependencies

~0–300KB