commit | 45d1e16e5b94a2867281ec40a33a2a5c271ed920 | [log] [tgz] |
---|---|---|
author | Marcin Radomski <dextero@google.com> | Wed Mar 13 16:03:42 2024 +0000 |
committer | Marcin Radomski <dextero@google.com> | Wed Mar 13 18:04:21 2024 +0000 |
tree | b86b60172a4402713932852a07cd94f3f88de2fc | |
parent | 517a652a90b8c8dea12267c9769604bbe99e9ae6 [diff] |
Import 'drm-fourcc' crate Request Document: go/android-rust-importing-crates For CL Reviewers: go/android3p#cl-review For Build Team: go/ab-third-party-imports Bug: http://b/328180685 Test: m libdrm_fourcc Test: atest drm-fourcc_test_src_lib Note: the latest version on crates.io does *not* contain the LICENSE file, even though it's marked as MIT-licensed in Cargo.toml. The main branch on github [1] has the LICENSE file (which I included here). Please let me know if that's OK. [1] https://github.com/dzfranklin/drm-fourcc-rs Change-Id: I680512cebe07a1314aadd359646e489b9524e58b
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.
std
: Enable functionality that requires the standard library. Enabled by defaultbuild_bindings
: Build the bindings based on the headers on your machine. Should not be necessary in most cases.