diff options
| author | Nathan Reiner <nathan@nathanreiner.xyz> | 2025-02-02 21:54:14 +0100 |
|---|---|---|
| committer | Nathan Reiner <nathan@nathanreiner.xyz> | 2025-02-02 21:54:14 +0100 |
| commit | 811a6bd572f4c6b26e99b4e746f5d710947ee934 (patch) | |
| tree | 3ff6375ce2d7ea13e0d49f7800757a1b42604884 /src/screen/drm/connector/root.zig | |
| parent | 3f4375a14218796cbd7bfff1c8cfff0f7bb1f6df (diff) | |
screen: drm change struct layout
Diffstat (limited to 'src/screen/drm/connector/root.zig')
| -rw-r--r-- | src/screen/drm/connector/root.zig | 49 |
1 files changed, 14 insertions, 35 deletions
diff --git a/src/screen/drm/connector/root.zig b/src/screen/drm/connector/root.zig index 6141899..64686b9 100644 --- a/src/screen/drm/connector/root.zig +++ b/src/screen/drm/connector/root.zig @@ -1,36 +1,15 @@ const std = @import("std"); const os = std.os.linux; -const Drm = @import("../request.zig").Drm; -const Card = @import("../card.zig").Card; -const FrameBuffer = @import("../frame-buffer/root.zig").FrameBuffer; - -pub const Connection = @import("connection.zig").Connection; -pub const Mode = @import("mode.zig").Mode; -pub const ConnectorType = @import("type.zig").Type; - -const RawConnector = extern struct { - encoder_ids: ?*u32, - modes: ?*Mode, - prop_ids: ?*u32, - prop_value_ids: ?*u64, - count_modes: u32, - count_props: u32, - count_encoders: u32, - encoder_id: u32, - id: u32, - type: ConnectorType, - type_id: u32, - connection: Connection, - mm_width: u32, - mm_height: u32, - subpixel: u32, - pad: u32, -}; +const drm = @import("../root.zig"); pub const Connector = struct { + pub const Status = @import("status.zig").Status; + pub const Mode = @import("mode.zig").Mode; + pub const Kind = @import("kind.zig").Kind; + const Self = @This(); - card: *Card, + card: *drm.Card, encoder_ids: []u32, modes: []Mode, @@ -38,24 +17,24 @@ pub const Connector = struct { prop_value_ids: []u64, encoder_id: u32, id: u32, - type: ConnectorType, + kind: Kind, type_id: u32, - connection: Connection, + connection: Status, mm_width: u32, mm_height: u32, subpixel: u32, pad: u32, - pub fn raw_without_ids(card: *Card, id: u32) !RawConnector { - var result = std.mem.zeroInit(RawConnector, .{ .id = id }); - try Drm.get_connector.request(card.file.handle, RawConnector, &result); + pub fn raw_without_ids(card: *drm.Card, id: u32) !drm.request.Connector { + var result = std.mem.zeroInit(drm.request.Connector, .{ .id = id }); + try card.request(.get_connector, &result); return result; } // NOTE: This function does not take in account // that there might be some hot-plugging going // on. This might have to change in the future. - pub fn init(card: *Card, id: u32) !Self { + pub fn init(card: *drm.Card, id: u32) !Self { var raw = try Self.raw_without_ids(card, id); const resources = .{ .encoder_ids = try card.allocator.alloc(u32, raw.count_encoders), @@ -64,7 +43,7 @@ pub const Connector = struct { .prop_value_ids = try card.allocator.alloc(u64, raw.count_props), .encoder_id = raw.encoder_id, .id = raw.id, - .type = raw.type, + .kind = raw.type, .type_id = raw.type_id, .connection = raw.connection, .mm_width = raw.mm_width, @@ -84,7 +63,7 @@ pub const Connector = struct { raw.prop_ids = @ptrCast(resources.prop_ids); raw.prop_value_ids = @ptrCast(resources.prop_value_ids); - try Drm.get_connector.request(card.file.handle, RawConnector, &raw); + try card.request(.get_connector, &raw); return resources; } |