const drm = @import("../root.zig"); pub const Buffer = struct { const Self = @This(); pub const Raw = @import("raw.zig").Raw; current: Raw, crtc: Raw, pub fn init(card: *drm.Card, width: u32, height: u32) !Self { return .{ .current = try Raw.init(card, width, height), .crtc = try Raw.init(card, width, height), }; } pub fn swap(self: *Self) void { const pixels = self.current.pixels; self.current.pixels = self.crtc.pixels; self.crtc.pixels = pixels; const bytes = self.current.bytes; self.current.bytes = self.crtc.bytes; self.crtc.bytes = bytes; const id = self.current.id; self.current.id = self.crtc.id; self.crtc.id = id; } pub fn deinit(self: *Self) void { self.current.deinit(); self.crtc.deinit(); } };