[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20250314-aspiring-prehistoric-caracara-ba6435@houat>
Date: Fri, 14 Mar 2025 13:25:17 +0100
From: Maxime Ripard <mripard@...nel.org>
To: Lyude Paul <lyude@...hat.com>
Cc: dri-devel@...ts.freedesktop.org, rust-for-linux@...r.kernel.org,
Danilo Krummrich <dakr@...nel.org>, mcanal@...lia.com, Alice Ryhl <aliceryhl@...gle.com>,
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>,
open list <linux-kernel@...r.kernel.org>
Subject: Re: [RFC v3 27/33] rust: drm/kms: Add DriverCrtc::atomic_begin() and
atomic_flush()
On Wed, Mar 05, 2025 at 05:59:43PM -0500, Lyude Paul wrote:
> Optional trait methods for implementing the atomic_begin and atomic_flush
> callbacks for a CRTC.
>
> Signed-off-by: Lyude Paul <lyude@...hat.com>
> ---
> rust/kernel/drm/kms/crtc.rs | 90 ++++++++++++++++++++++++++++++++++++-
> 1 file changed, 88 insertions(+), 2 deletions(-)
>
> diff --git a/rust/kernel/drm/kms/crtc.rs b/rust/kernel/drm/kms/crtc.rs
> index aaa208b35c3c1..131d10505ba07 100644
> --- a/rust/kernel/drm/kms/crtc.rs
> +++ b/rust/kernel/drm/kms/crtc.rs
> @@ -90,8 +90,16 @@ pub trait DriverCrtc: Send + Sync + Sized {
> mode_set: None,
> mode_valid: None,
> mode_fixup: None,
> - atomic_begin: None,
> - atomic_flush: None,
> + atomic_begin: if Self::HAS_ATOMIC_BEGIN {
> + Some(atomic_begin_callback::<Self>)
> + } else {
> + None
> + },
> + atomic_flush: if Self::HAS_ATOMIC_FLUSH {
> + Some(atomic_flush_callback::<Self>)
> + } else {
> + None
> + },
> mode_set_nofb: None,
> mode_set_base: None,
> mode_set_base_atomic: None,
> @@ -132,6 +140,36 @@ fn atomic_check(
> ) -> Result {
> build_error::build_error("This should not be reachable")
> }
> +
> + /// The optional [`drm_crtc_helper_funcs.atomic_begin`] hook.
> + ///
> + /// This hook will be called before a set of [`Plane`] updates are performed for the given
> + /// [`Crtc`].
> + ///
> + /// [`drm_crtc_helper_funcs.atomic_begin`]: srctree/include/drm/drm_modeset_helper_vtables.h
> + fn atomic_begin(
> + _crtc: &Crtc<Self>,
> + _old_state: &CrtcState<Self::State>,
> + _new_state: CrtcStateMutator<'_, CrtcState<Self::State>>,
> + _state: &AtomicStateMutator<Self::Driver>,
> + ) {
> + build_error::build_error("This should not be reachable")
> + }
Another dumb question I guess. If it's optional, and the default
implementation of a trait errors out at build time, how can it not break
if we don't implement the method?
Maxime
Download attachment "signature.asc" of type "application/pgp-signature" (274 bytes)
Powered by blists - more mailing lists