#drm #pixel-format #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

#233 in Unix APIs

Download history 5892/week @ 2023-11-28 5809/week @ 2023-12-05 6594/week @ 2023-12-12 5552/week @ 2023-12-19 4172/week @ 2023-12-26 5924/week @ 2024-01-02 6703/week @ 2024-01-09 6812/week @ 2024-01-16 7867/week @ 2024-01-23 8767/week @ 2024-01-30 9463/week @ 2024-02-06 11084/week @ 2024-02-13 11952/week @ 2024-02-20 10658/week @ 2024-02-27 10886/week @ 2024-03-05 4238/week @ 2024-03-12

39,912 downloads per month
Used in 57 crates (10 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–290KB