@@ -53,3 +53,50 @@ pub const ModeFbCmd = extern struct {
5353 };
5454 }
5555};
56+
57+ pub const ModeFbCmd2 = extern struct {
58+ fbId : u32 = 0 ,
59+ width : u32 = 0 ,
60+ height : u32 = 0 ,
61+ pixelFormat : u32 = 0 ,
62+ flags : Flags = .{},
63+ handles : [4 ]u32 = undefined ,
64+ pitches : [4 ]u32 = undefined ,
65+ offsets : [4 ]u32 = undefined ,
66+ modifiers : [4 ]u64 = undefined ,
67+
68+ pub const reqAdd = os .IOCTL .IOWR (0xB8 , ModeFbCmd2 );
69+ pub const reqGet = os .IOCTL .IOWR (0xCE , ModeFbCmd2 );
70+
71+ pub fn get (self : * ModeFbCmd2 , fd : std.os.fd_t ) ! void {
72+ return switch (std .os .errno (os .ioctl (fd , reqGet , @intFromPtr (self )))) {
73+ .SUCCESS = > {},
74+ .BADF = > error .NotOpenForWriting ,
75+ .NOENT = > error .NotFound ,
76+ .FAULT = > unreachable ,
77+ .INVAL = > unreachable ,
78+ .NOTTY = > error .NotATerminal ,
79+ .OPNOTSUPP = > error .NotSupported ,
80+ else = > | e | std .os .unexpectedErrno (e ),
81+ };
82+ }
83+
84+ pub fn add (self : * ModeFbCmd2 , fd : std.os.fd_t ) ! void {
85+ return switch (std .os .errno (os .ioctl (fd , reqAdd , @intFromPtr (self )))) {
86+ .SUCCESS = > {},
87+ .BADF = > error .NotOpenForWriting ,
88+ .NOENT = > error .NotFound ,
89+ .FAULT = > unreachable ,
90+ .INVAL = > unreachable ,
91+ .NOTTY = > error .NotATerminal ,
92+ .OPNOTSUPP = > error .NotSupported ,
93+ else = > | e | std .os .unexpectedErrno (e ),
94+ };
95+ }
96+
97+ pub const Flags = packed struct (u32 ) {
98+ interlaced : u1 = 0 ,
99+ modifiers : u1 = 0 ,
100+ reserved : u30 = 0 ,
101+ };
102+ };
0 commit comments