summaryrefslogtreecommitdiff
path: root/src/screen/drm/request/frame-buffer.zig
blob: c9077e8727f7c69bb2aef36d429c6be3a1a594f0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
const drm = @import("../root.zig");

pub const CreateDumb = extern struct {
	height: u32,
	width: u32,
	bpp: u32,
	flags: u32,
	handle: u32,
	pitch: u32,
	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: PixelFormat,
	flags: u32,
	handles: [4]u32,
	pitches: [4]u32,
	offsets: [4]u32,
	modifier: [4]u32,
};

pub const MapDumb = extern struct {
	handle: u32,
	__padding: u32,
	offset: i64,
};