pub struct MemoryMappedFrameBuffer<T: AsFrameBuffer> { /* private fields */ }Expand description
FrameBuffer wrapper, which exposes internal file descriptors as memory mapped [&u8] plane slices.
Implementations§
Source§impl<T: AsFrameBuffer> MemoryMappedFrameBuffer<T>
impl<T: AsFrameBuffer> MemoryMappedFrameBuffer<T>
Sourcepub fn new(fb: T) -> Result<Self, MemoryMappedFrameBufferError>
pub fn new(fb: T) -> Result<Self, MemoryMappedFrameBufferError>
Memory map framebuffer, which implements AsFrameBuffer.
This might fail if framebuffer has invalid plane sizes/offsets or if [libc::mmap] fails itself.
Sourcepub fn new_writable(fb: T) -> Result<Self, MemoryMappedFrameBufferError>
pub fn new_writable(fb: T) -> Result<Self, MemoryMappedFrameBufferError>
Memory map framebuffer for read/write access. Mapping will be PROT_READ | PROT_WRITE.
Sourcepub fn data_mut(
&mut self,
) -> Result<Vec<&mut [u8]>, MemoryMappedFrameBufferError>
pub fn data_mut( &mut self, ) -> Result<Vec<&mut [u8]>, MemoryMappedFrameBufferError>
Returns mutable data slices for each plane within the framebuffer. Mapping must be writable.
Sourcepub fn is_writable(&self) -> bool
pub fn is_writable(&self) -> bool
Returns true if this mapping was created with write access.
Sourcepub fn mapped_len(&self, fd: i32) -> Option<usize>
pub fn mapped_len(&self, fd: i32) -> Option<usize>
Returns the mapped length for a given file descriptor, if present.
Trait Implementations§
Source§impl<T: AsFrameBuffer> AsFrameBuffer for MemoryMappedFrameBuffer<T>
impl<T: AsFrameBuffer> AsFrameBuffer for MemoryMappedFrameBuffer<T>
Source§unsafe fn ptr(&self) -> NonNull<libcamera_framebuffer_t>
unsafe fn ptr(&self) -> NonNull<libcamera_framebuffer_t>
Returns raw framebuffer used by libcamera. Read more
Source§fn metadata(&self) -> Option<Immutable<FrameMetadataRef<'_>>>
fn metadata(&self) -> Option<Immutable<FrameMetadataRef<'_>>>
Returns framebuffer metadata information. Read more
Source§fn planes(&self) -> Immutable<FrameBufferPlanesRef<'_>>
fn planes(&self) -> Immutable<FrameBufferPlanesRef<'_>>
Provides access to framebuffer data by exposing file descriptors, offsets and lengths of the planes.
User cookie associated with the buffer.
Set user cookie associated with the buffer.
Source§fn release_fence(&self) -> Option<Fence>
fn release_fence(&self) -> Option<Fence>
Releases the acquire fence associated with this framebuffer, if any. Read more
Source§fn request(&self) -> Option<RequestRef<'_>>
fn request(&self) -> Option<RequestRef<'_>>
Returns a non-owning view of the Request owning this framebuffer, if any.
Source§impl<T: AsFrameBuffer> Drop for MemoryMappedFrameBuffer<T>
impl<T: AsFrameBuffer> Drop for MemoryMappedFrameBuffer<T>
impl<T: AsFrameBuffer> Send for MemoryMappedFrameBuffer<T>
Auto Trait Implementations§
impl<T> Freeze for MemoryMappedFrameBuffer<T>where
T: Freeze,
impl<T> RefUnwindSafe for MemoryMappedFrameBuffer<T>where
T: RefUnwindSafe,
impl<T> !Sync for MemoryMappedFrameBuffer<T>
impl<T> Unpin for MemoryMappedFrameBuffer<T>where
T: Unpin,
impl<T> UnwindSafe for MemoryMappedFrameBuffer<T>where
T: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more