[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20250305230406.567126-12-lyude@redhat.com>
Date: Wed, 5 Mar 2025 17:59:27 -0500
From: Lyude Paul <lyude@...hat.com>
To: dri-devel@...ts.freedesktop.org,
rust-for-linux@...r.kernel.org
Cc: Danilo Krummrich <dakr@...nel.org>,
mcanal@...lia.com,
Alice Ryhl <aliceryhl@...gle.com>,
Maxime Ripard <mripard@...nel.org>,
Simona Vetter <sima@...ll.ch>,
Daniel Almeida <daniel.almeida@...labora.com>,
Miguel Ojeda <ojeda@...nel.org>,
Alex Gaynor <alex.gaynor@...il.com>,
Boqun Feng <boqun.feng@...il.com>,
Gary Guo <gary@...yguo.net>,
Björn Roy Baron <bjorn3_gh@...tonmail.com>,
Benno Lossin <benno.lossin@...ton.me>,
Andreas Hindborg <a.hindborg@...nel.org>,
Trevor Gross <tmgross@...ch.edu>,
linux-kernel@...r.kernel.org (open list)
Subject: [RFC v3 11/33] rust: drm/kms: Add ConnectorGuard::set_preferred_mode
Add a wrapper for `drm_set_preferred_mode()` for our new
`ConnectorGuard` type so we can set the preferred mode for RVKMS
connectors.
Signed-off-by: Lyude Paul <lyude@...hat.com>
---
rust/kernel/drm/kms/connector.rs | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/rust/kernel/drm/kms/connector.rs b/rust/kernel/drm/kms/connector.rs
index 855a47b189a91..244db1cfdc552 100644
--- a/rust/kernel/drm/kms/connector.rs
+++ b/rust/kernel/drm/kms/connector.rs
@@ -455,6 +455,12 @@ 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) }
}
+
+ /// Set the preferred display mode for the underlying [`Connector`].
+ pub fn set_preferred_mode(&self, (h_pref, w_pref): (i32, i32)) {
+ // SAFETY: We hold the locks required to call this via our type invariants.
+ unsafe { bindings::drm_set_preferred_mode(self.as_raw(), h_pref, w_pref) }
+ }
}
// SAFETY: DRM expects this struct to be zero-initialized
--
2.48.1
Powered by blists - more mailing lists