[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20250314-unselfish-manipulative-parrot-0f403f@houat>
Date: Fri, 14 Mar 2025 13:22:47 +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 21/33] rust: drm/kms: Add DriverPlane::atomic_check()
On Wed, Mar 05, 2025 at 05:59:37PM -0500, Lyude Paul wrote:
> Optional trait method for implementing a plane's atomic_check().
>
> Signed-off-by: Lyude Paul <lyude@...hat.com>
>
> ---
> V3:
> * Document ManuallyDrop uses better
>
> Signed-off-by: Lyude Paul <lyude@...hat.com>
> ---
> rust/kernel/drm/kms/plane.rs | 53 ++++++++++++++++++++++++++++++++++--
> 1 file changed, 50 insertions(+), 3 deletions(-)
>
> diff --git a/rust/kernel/drm/kms/plane.rs b/rust/kernel/drm/kms/plane.rs
> index b090aebc35649..f3adc30c17489 100644
> --- a/rust/kernel/drm/kms/plane.rs
> +++ b/rust/kernel/drm/kms/plane.rs
> @@ -11,7 +11,7 @@
> alloc::KBox,
> bindings,
> drm::{device::Device, fourcc::*},
> - error::{to_result, Error},
> + error::{from_result, to_result, Error},
> init::Zeroable,
> prelude::*,
> private::Sealed,
> @@ -20,7 +20,7 @@
> use core::{
> cell::Cell,
> marker::*,
> - mem,
> + mem::{self, ManuallyDrop},
> ops::*,
> pin::Pin,
> ptr::{addr_of_mut, null, null_mut, NonNull},
> @@ -69,7 +69,11 @@ pub trait DriverPlane: Send + Sync + Sized {
> cleanup_fb: None,
> begin_fb_access: None,
> end_fb_access: None,
> - atomic_check: None,
> + atomic_check: if Self::HAS_ATOMIC_CHECK {
> + Some(atomic_check_callback::<Self>)
> + } else {
> + None
> + },
> atomic_update: if Self::HAS_ATOMIC_UPDATE {
> Some(atomic_update_callback::<Self>)
> } else {
> @@ -117,6 +121,21 @@ fn atomic_update(
> ) {
> build_error::build_error("This should not be reachable")
> }
> +
> + /// The optional [`drm_plane_helper_funcs.atomic_check`] hook for this plane.
> + ///
> + /// Drivers may use this to customize the atomic check phase of their [`Plane`] objects. The
> + /// result of this function determines whether the atomic check passed or failed.
> + ///
> + /// [`drm_plane_helper_funcs.atomic_check`]: srctree/include/drm/drm_modeset_helper_vtables.h
> + fn atomic_check(
> + _plane: &Plane<Self>,
> + _new_state: PlaneStateMutator<'_, PlaneState<Self::State>>,
> + _old_state: &PlaneState<Self::State>,
> + _state: &AtomicStateComposer<Self::Driver>,
> + ) -> Result {
> + build_error::build_error("This should not be reachable")
> + }
I think it was the other way around for CRTCs between old_state and
new_state? I still believe we should get rid of both, but we need to be
consistent at least :)
Maxime
Download attachment "signature.asc" of type "application/pgp-signature" (274 bytes)
Powered by blists - more mailing lists