Re: [WIP RFC v2 12/35] rust: drm/kms: Add ConnectorGuard::set_preferred_mode

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Lyude,

> On 30 Sep 2024, at 20:09, Lyude Paul <lyude@xxxxxxxxxx> wrote:
> 
> 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@xxxxxxxxxx>
> ---
> 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 7d0f67c3bdaf8..ec842ebc111ae 100644
> --- a/rust/kernel/drm/kms/connector.rs
> +++ b/rust/kernel/drm/kms/connector.rs
> @@ -387,6 +387,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.46.1
> 

LGTM

— Daniel



[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux