pub struct BackBuffer<'a> { /* private fields */ }Expand description
Mutable view of a framebuffer the renderer currently owns.
CPU writes happen through BackBuffer::cpu_slice. DMA submissions go
through BackBuffer::dma_dst, which reborrows the buffer and locks
out CPU access for the duration of the transfer.
Implementations§
Source§impl<'a> BackBuffer<'a>
impl<'a> BackBuffer<'a>
Sourcepub fn wrap(fb: &'a mut FrameBuffer) -> Self
pub fn wrap(fb: &'a mut FrameBuffer) -> Self
Wrap a mutable reference to a FrameBuffer.
Sourcepub fn framebuffer(&self) -> &FrameBuffer
pub fn framebuffer(&self) -> &FrameBuffer
Underlying FrameBuffer.
Sourcepub fn framebuffer_mut(&mut self) -> &mut FrameBuffer
pub fn framebuffer_mut(&mut self) -> &mut FrameBuffer
Underlying FrameBuffer (mutable metadata, not pixels).
Sourcepub fn stride_bytes(&self) -> u32
pub fn stride_bytes(&self) -> u32
Row stride in bytes.
Sourcepub fn dma_dst<'b>(&'b mut self) -> BorrowedForDma<'b, BackBuffer<'a>>
pub fn dma_dst<'b>(&'b mut self) -> BorrowedForDma<'b, BackBuffer<'a>>
Produce a reborrow suitable for DMA-engine submission.
The returned BorrowedForDma carries a mutable reborrow of this
back buffer for lifetime 'b. While it — or any InFlight
derived from it — is alive, self is borrowed and CPU access via
BackBuffer::cpu_slice is rejected by the borrow checker.
Sourcepub unsafe fn cpu_slice(&mut self) -> &mut [u8] ⓘ
pub unsafe fn cpu_slice(&mut self) -> &mut [u8] ⓘ
CPU byte access to the back buffer’s RAM.
§Safety
The caller must ensure:
- no DMA master is currently reading or writing the buffer (the
InFlightlifecycle already encodes this for DMA2D paths), - the RAM region is actually mapped and writable (established by
FrameBuffer::from_phys), - no other
&mut [u8]or&[u8]referencing overlapping bytes is alive for the returned slice’s lifetime.
Auto Trait Implementations§
impl<'a> !UnwindSafe for BackBuffer<'a>
impl<'a> Freeze for BackBuffer<'a>
impl<'a> RefUnwindSafe for BackBuffer<'a>
impl<'a> Send for BackBuffer<'a>
impl<'a> Sync for BackBuffer<'a>
impl<'a> Unpin for BackBuffer<'a>
impl<'a> UnsafeUnpin for BackBuffer<'a>
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