summaryrefslogtreecommitdiff
path: root/src/screen/drm/encoder.zig
blob: 2758ee8efffaf456044a5c74873d76aa3a6f9c0d (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
41
42
const std = @import("std");
const drm = @import("root.zig");

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

	pub const Kind = enum(u32) {
		none = 0,
		dac = 1,
		tmds = 2,
		lvds = 3,
		tvdac = 4,
		virtual = 5,
		dsi = 6,
		dpmst = 7,
		dpi = 8,
	};

	card: drm.Card,

	id: u32,
	type: Kind,
	possible_crtcs: u32,
	possible_clones: u32,

	pub fn init(card: drm.Card, id: u32) !Self {
		var raw = std.mem.zeroInit(drm.request.Encoder, .{ .id = id });
		try card.request(.get_encoder, &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;
	}
};