From 9fd81c0b38b2b843c24fb61bf8cb5b7873deaa72 Mon Sep 17 00:00:00 2001 From: Nathan Reiner Date: Wed, 12 Feb 2025 12:48:11 +0100 Subject: graphics: add line --- src/screen/drm/request/frame-buffer.zig | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'src/screen/drm/request/frame-buffer.zig') diff --git a/src/screen/drm/request/frame-buffer.zig b/src/screen/drm/request/frame-buffer.zig index 8f93862..c9077e8 100644 --- a/src/screen/drm/request/frame-buffer.zig +++ b/src/screen/drm/request/frame-buffer.zig @@ -10,11 +10,22 @@ pub const CreateDumb = extern struct { size: u32, }; +fn pixel_format_code(comptime a: u8, comptime b: u8, comptime c: u8, comptime d: u8) u32 { + return @as(u32, @intCast(a)) | + (@as(u32, @intCast(b)) << 8) | + (@as(u32, @intCast(c)) << 16) | + (@as(u32, @intCast(d)) << 24); +} + +pub const PixelFormat = enum(u32) { + xrgb8888 = pixel_format_code('X', 'R', '2', '4'), +}; + pub const FrameBufferCmd2 = extern struct { id: u32, width: u32, height: u32, - pixel_format: drm.Pixel.Format, + pixel_format: PixelFormat, flags: u32, handles: [4]u32, pitches: [4]u32, -- cgit v1.2.3-70-g09d2