diff options
| author | Nathan Reiner <nathan@nathanreiner.xyz> | 2025-02-01 16:19:47 +0100 |
|---|---|---|
| committer | Nathan Reiner <nathan@nathanreiner.xyz> | 2025-02-01 16:19:47 +0100 |
| commit | 88aa2940b27044794d4dcb49c924a5df17cc0055 (patch) | |
| tree | e454101aef7a008d7fe2854eea4329507b8beb60 /src/screen/drm/crtc/root.zig | |
| parent | 857261e9be33e862795ae6228ea05caf20c1a9d5 (diff) | |
screen: add crtc
Diffstat (limited to 'src/screen/drm/crtc/root.zig')
| -rw-r--r-- | src/screen/drm/crtc/root.zig | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/src/screen/drm/crtc/root.zig b/src/screen/drm/crtc/root.zig new file mode 100644 index 0000000..7601732 --- /dev/null +++ b/src/screen/drm/crtc/root.zig @@ -0,0 +1,45 @@ +const std = @import("std"); +const Card = @import("../card.zig").Card; +const Drm = @import("../request.zig").Drm; +const Connector = @import("../connector/root.zig").Connector; + +pub const RawCrtc = extern struct { + connectors: ?*Connector, + count_connectors: u32, + id: u32, + buffer_id: u32, + x: u32, + y: u32, + gamma_size: u32, + mode_valid: u32, +}; + +pub const Crtc = struct { + const Self = @This(); + + id: u32, + buffer_id: u32, + x: u32, + y: u32, + mode_valid: u32, + gamma_size: u32, + card: *Card, + + pub fn init(card: *Card, id: u32) !Self { + var raw = std.mem.zeroInit(RawCrtc, .{ .id = id }); + try Drm.get_crtc.request(card.file.handle, RawCrtc, &raw); + return .{ + .id = raw.id, + .buffer_id = raw.buffer_id, + .x = raw.x, + .y = raw.y, + .mode_valid = raw.mode_valid, + .gamma_size = raw.gamma_size, + .card = card, + }; + } + + pub fn deinit(self: *Self) void { + _ = self; + } +}; |