summaryrefslogtreecommitdiff
path: root/src/screen/drm/encoder/root.zig
blob: 7b8932ace39e8d71f866a8312d2f8bae99e5a979 (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 std = @import("std");
const Drm = @import("../request.zig").Drm;
const Card = @import("../card.zig").Card;

const Type = @import("type.zig").Type;

pub const RawEncoder = extern struct {
	id: u32,
	type: Type,
	crtc_id: u32,
	possible_crtcs: u32,
	possible_clones: u32,
};

pub const Encoder = struct {
	const Self = @This();

	id: u32,
	type: Type,
	possible_crtcs: u32,
	possible_clones: u32,
	card: *Card,

	pub fn init(card: *Card, id: u32) !Self {
		var raw = std.mem.zeroInit(RawEncoder, .{ .id = id });
		try Drm.get_encoder.request(card.file.handle, RawEncoder, &raw);

		return .{
			.id = raw.id,
			.type = raw.type,
			.possible_crtcs = raw.possible_crtcs,
			.possible_clones = raw.possible_clones,
			.card = card
	};
	}

	pub fn deinit(self: *Self) void {
		_ = self;
	}
};