const std = @import("std"); const os = std.os.linux; const cerror = @import("../../cerror.zig"); pub const Resources = @import("resources.zig").Resources; pub const Encoder = @import("encoder.zig").Encoder; pub const Connector = @import("connector.zig").Connector; const crtc = @import("crtc.zig"); pub const Crtc = crtc.Crtc; pub const PageFlip = crtc.PageFlip; const frame_buffer = @import("frame-buffer.zig"); pub const CreateDumb = frame_buffer.CreateDumb; pub const FrameBufferCmd2 = frame_buffer.FrameBufferCmd2; pub const MapDumb = frame_buffer.MapDumb; pub const Kind = enum(u8) { const Self = @This(); get_resources = 0xa0, get_crtc = 0xa1, set_crtc = 0xa2, get_encoder = 0xa6, get_connector = 0xa7, remove_frame_buffer = 0xaf, page_flip = 0xb0, create_dumb = 0xb2, map_dumb = 0xb3, destroy_dumb = 0xb4, add_frame_buffer2 = 0xb8, pub fn payload(comptime self: *const Self) type { return comptime switch (self.*) { .get_resources => Resources, .get_crtc => Crtc, .set_crtc => Crtc, .get_encoder => Encoder, .get_connector => Connector, .remove_frame_buffer => u32, .page_flip => PageFlip, .create_dumb => CreateDumb, .map_dumb => MapDumb, .destroy_dumb => u32, .add_frame_buffer2 => FrameBufferCmd2, }; } pub fn id(comptime self: *const Self, comptime pointer_type: type) u32 { const payload_type = self.payload(); comptime std.debug.assert(*payload_type == pointer_type); return comptime os.IOCTL.IOWR('d', @intFromEnum(self.*), payload_type); } };