@@ -109,7 +109,60 @@ pub struct DrmModeCardRes {
109109 pub max_height : u32 ,
110110}
111111
112+ const DRM_DISPLAY_MODE_LEN : usize = 32 ;
113+
114+ #[ repr( C ) ]
115+ pub struct DrmModeInfo {
116+ pub clock : u32 , // pixel clock in kHz
117+ pub hdisplay : u16 , // horizontal display size
118+ pub hsync_start : u16 , // horizontal sync start
119+ pub hsync_end : u16 , // horizontal sync end
120+ pub htotal : u16 , // horizontal total size
121+ pub hskew : u16 , // horizontal skew
122+ pub vdisplay : u16 , // vertical display size
123+ pub vsync_start : u16 , // vertical sync start
124+ pub vsync_end : u16 , // vertical sync end
125+ pub vtotal : u16 , // vertical total size
126+ pub vscan : u16 , // vertical scan
127+ pub vrefresh : u32 , // approximate vertical refresh rate in Hz
128+ pub flags : u32 , // bitmask of misc flags
129+ pub typ : u32 , // bitmask of type flags
130+ pub name : [ ffi:: c_char ; DRM_DISPLAY_MODE_LEN ] , // string describing the mode resolution
131+ }
132+
133+ #[ repr( C ) ]
134+ pub struct DrmModeGetConnector {
135+ pub encoders_ptr : u64 , // pointer to `u32` array of object IDs
136+ pub modes_ptr : u64 , // pointer to `DrmModeInfo` array
137+ pub props_ptr : u64 , // pointer to `u32` array of property IDs
138+ pub prop_values_ptr : u64 , // pointer to `u64` array of property values
139+
140+ pub count_modes : u32 , // number of modes
141+ pub count_props : u32 , // number of properties
142+ pub count_encoders : u32 , // number of encoders
143+
144+ pub encoder_id : u32 , // object id of the current encoder
145+ pub connector_id : u32 , // object id of the connector
146+ pub connector_type : u32 , // type of the connector
147+
148+ /// Type-specific connector number.
149+ ///
150+ /// This is not an object ID. This is a per-type connector number. Each
151+ /// (`type`, `type_id`) combination is unique across all connectors of a DRM
152+ /// device.
153+ pub connector_type_id : u32 ,
154+
155+ pub connection : u32 , // status of the connector
156+ pub mm_width : u32 , // width of the connected sink in millimeters
157+ pub mm_height : u32 , // height of the connected sink in millimeters
158+
159+ pub subpixel : u32 , // subpixel order of the connected sink
160+
161+ pub pad : u32 , // padding; must be zero
162+ }
163+
112164// DRM IOCTL constants:
113165pub const DRM_IOCTL_VERSION : usize = drm_iowr :: < DrmVersion > ( 0x00 ) ;
114166pub const DRM_IOCTL_GET_CAP : usize = drm_iowr :: < DrmGetCap > ( 0x0c ) ;
115167pub const DRM_IOCTL_MODE_GETRESOURCES : usize = drm_iowr :: < DrmModeCardRes > ( 0xa0 ) ;
168+ pub const DRM_IOCTL_GET_CONNECTOR : usize = drm_iowr :: < DrmModeGetConnector > ( 0xa7 ) ;
0 commit comments