summaryrefslogtreecommitdiff
path: root/src/screen/drm/request.zig
blob: 9a70c7d7222b8a64878f6ee0aa56c042325b88d9 (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
const std = @import("std");
const os = std.os.linux;
const cerror = @import("../cerror.zig");

fn ioctl(fd: os.fd_t, request: u32, arg: usize) !void {
	try cerror.from_usize(os.ioctl(fd, request, arg));
}

pub const Drm = enum(u8) {
	const Self = @This();

	get_resources = 0xa0,
	get_crtc = 0xa1,
	set_crtc = 0xa2,
	get_encoder = 0xa6,
	get_connector = 0xa7,
	remove_frame_buffer = 0xaf,
	page_flip = 0xb0,
	dirty_frame_buffer = 0xb1,
	create_dumb = 0xb2,
	map_dumb = 0xb3,
	destroy_dumb = 0xb4,
	add_frame_buffer2 = 0xb8,

	pub fn request(self: Self, fd: os.fd_t, T: type, arg: *T) !void {
		const id = os.IOCTL.IOWR('d', @intFromEnum(self), T);
		try ioctl(fd, id, @intFromPtr(arg));
	}
};