summaryrefslogtreecommitdiff
path: root/src/screen/drm/connector
diff options
context:
space:
mode:
authorNathan Reiner <nathan@nathanreiner.xyz>2025-02-01 15:25:05 +0100
committerNathan Reiner <nathan@nathanreiner.xyz>2025-02-01 15:25:05 +0100
commit857261e9be33e862795ae6228ea05caf20c1a9d5 (patch)
tree2ee5ed900bd2b8f757400cc2f3aae6c6fde39460 /src/screen/drm/connector
parent740281072f9e53e5ce62590a352f35d8cc02770a (diff)
screen: drm add encoder
Diffstat (limited to 'src/screen/drm/connector')
-rw-r--r--src/screen/drm/connector/root.zig21
-rw-r--r--src/screen/drm/connector/type.zig23
2 files changed, 34 insertions, 10 deletions
diff --git a/src/screen/drm/connector/root.zig b/src/screen/drm/connector/root.zig
index 8883d29..5766851 100644
--- a/src/screen/drm/connector/root.zig
+++ b/src/screen/drm/connector/root.zig
@@ -5,6 +5,7 @@ const Card = @import("../card.zig").Card;
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,
@@ -15,9 +16,9 @@ const RawConnector = extern struct {
count_props: u32,
count_encoders: u32,
encoder_id: u32,
- connector_id: u32,
- connector_type: u32,
- connector_type_id: u32,
+ id: u32,
+ type: ConnectorType,
+ type_id: u32,
connection: Connection,
mm_width: u32,
mm_height: u32,
@@ -35,9 +36,9 @@ pub const Connector = struct {
prop_ids: []u32,
prop_value_ids: []u64,
encoder_id: u32,
- connector_id: u32,
- connector_type: u32,
- connector_type_id: u32,
+ id: u32,
+ type: ConnectorType,
+ type_id: u32,
connection: Connection,
mm_width: u32,
mm_height: u32,
@@ -45,7 +46,7 @@ pub const Connector = struct {
pad: u32,
pub fn raw_without_ids(card: *Card, id: u32) !RawConnector {
- var result = std.mem.zeroInit(RawConnector, .{ .connector_id = id });
+ var result = std.mem.zeroInit(RawConnector, .{ .id = id });
try Drm.get_connector.request(card.file.handle, RawConnector, &result);
return result;
}
@@ -61,9 +62,9 @@ pub const Connector = struct {
.prop_ids = try card.allocator.alloc(u32, raw.count_props),
.prop_value_ids = try card.allocator.alloc(u64, raw.count_props),
.encoder_id = raw.encoder_id,
- .connector_id = raw.connector_id,
- .connector_type = raw.connector_type,
- .connector_type_id = raw.connector_type_id,
+ .id = raw.id,
+ .type = raw.type,
+ .type_id = raw.type_id,
.connection = raw.connection,
.mm_width = raw.mm_width,
.mm_height = raw.mm_height,
diff --git a/src/screen/drm/connector/type.zig b/src/screen/drm/connector/type.zig
new file mode 100644
index 0000000..15db753
--- /dev/null
+++ b/src/screen/drm/connector/type.zig
@@ -0,0 +1,23 @@
+pub const Type = enum(u32) {
+ unknown = 0,
+ vga = 1,
+ dvi_i = 2,
+ dvi_d = 3,
+ dvi_a = 4,
+ composite = 5,
+ s_video = 6,
+ lvds = 7,
+ component = 8,
+ nine_pin_din = 9,
+ display_port = 10,
+ hdmi_a = 11,
+ hdmi_b = 12,
+ tv = 13,
+ edp = 14,
+ virtual = 15,
+ dsi = 16,
+ dpi = 17,
+ writeback = 18,
+ spi = 19,
+ usb = 20,
+};