From 857261e9be33e862795ae6228ea05caf20c1a9d5 Mon Sep 17 00:00:00 2001 From: Nathan Reiner Date: Sat, 1 Feb 2025 15:25:05 +0100 Subject: screen: drm add encoder --- src/screen/drm/encoder/root.zig | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 src/screen/drm/encoder/root.zig (limited to 'src/screen/drm/encoder/root.zig') diff --git a/src/screen/drm/encoder/root.zig b/src/screen/drm/encoder/root.zig new file mode 100644 index 0000000..0712c76 --- /dev/null +++ b/src/screen/drm/encoder/root.zig @@ -0,0 +1,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; + } +}; -- cgit v1.2.3-70-g09d2