@@ -13,6 +13,7 @@
#include <drm/drm_crtc.h>
#include <drm/drm_device.h>
#include <drm/drm_drv.h>
+#include <drm/drm_edid.h>
#include <drm/drm_encoder.h>
#include <drm/drm_file.h>
#include <drm/drm_fbdev_dma.h>
@@ -446,6 +446,17 @@ fn deref(&self) -> &Self::Target {
}
}
+impl<'a, T: DriverConnector> ConnectorGuard<'a, T> {
+ /// Add modes for a [`ConnectorGuard`] without an EDID.
+ ///
+ /// Add the specified modes to the connector's mode list up to the given maximum resultion.
+ /// Returns how many modes were added.
+ pub fn add_modes_noedid(&self, (max_h, max_v): (i32, i32)) -> i32 {
+ // SAFETY: We hold the locks required to call this via our type invariants.
+ unsafe { bindings::drm_add_modes_noedid(self.as_raw(), max_h, max_v) }
+ }
+}
+
// SAFETY: DRM expects this struct to be zero-initialized
unsafe impl Zeroable for bindings::drm_connector_state {}
A simple binding for drm_add_modes_noedid() using the ConnectorGuard type we just added. Signed-off-by: Lyude Paul <lyude@redhat.com> --- rust/bindings/bindings_helper.h | 1 + rust/kernel/drm/kms/connector.rs | 11 +++++++++++ 2 files changed, 12 insertions(+)