feat: gbm_format_get_name analog.

This commit is contained in:
Jackson Netherwood-Imig
2026-03-11 11:01:44 -07:00
parent b5eae2ee63
commit c7b2094479
+11
View File
@@ -131,6 +131,17 @@ pub const Format = enum(u32) {
_, // Some formats involved with dmabuf aren't defined here
pub fn getName(self: Format) [4]u8 {
const int = @intFromEnum(self);
return [_]u8{
@as(u8, (int >> 0) & 0xff),
@as(u8, (int >> 8) & 0xff),
@as(u8, (int >> 16) & 0xff),
@as(u8, (int >> 24) & 0xff),
};
}
fn fourccCode(a: u8, b: u8, c: u8, d: u8) u32 {
return @as(u32, a) | (@as(u32, b) << 8) | (@as(u32, c) << 16) | (@as(u32, d) << 24);
}