Re: [WIP RFC v2 28/35] rust: drm/kms: Add RawPlane::framebuffer()

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

 



Hi Lyude,

> On 30 Sep 2024, at 20:10, Lyude Paul <lyude@xxxxxxxxxx> wrote:
> 
> Returns the Framebuffer currently assigned in an atomic plane state.

A bit unrelated to this patch, but can you have more than one framebuffer active? 

i.e.: for things like overlays, etc

> 
> Signed-off-by: Lyude Paul <lyude@xxxxxxxxxx>
> ---
> rust/kernel/drm/kms/plane.rs | 8 ++++++++
> 1 file changed, 8 insertions(+)
> 
> diff --git a/rust/kernel/drm/kms/plane.rs b/rust/kernel/drm/kms/plane.rs
> index cd5167e6441f1..15efa53fda8d3 100644
> --- a/rust/kernel/drm/kms/plane.rs
> +++ b/rust/kernel/drm/kms/plane.rs
> @@ -31,6 +31,7 @@
>     StaticModeObject,
>     atomic::*,
>     crtc::*,
> +    framebuffer::*,
> };
> 
> /// The main trait for implementing the [`struct drm_plane`] API for [`Plane`]
> @@ -521,6 +522,13 @@ fn atomic_helper_check<S>(
>             )
>         })
>     }
> +
> +    /// Return the framebuffer currently set for this plane state
> +    #[inline]
> +    fn framebuffer(&self) -> Option<&Framebuffer<<Self::Plane as ModeObject>::Driver>> {
> +        // SAFETY: The layout of Framebuffer<T> is identical to `fb`
> +        unsafe { self.as_raw().fb.as_ref().map(|fb| Framebuffer::from_raw(fb)) }
> +    }
> }
> impl<T: AsRawPlaneState + ?Sized> RawPlaneState for T {}
> 
> -- 
> 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