Skip to main content

BackBuffer

Struct BackBuffer 

Source
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>

Source

pub fn wrap(fb: &'a mut FrameBuffer) -> Self

Wrap a mutable reference to a FrameBuffer.

Source

pub fn framebuffer(&self) -> &FrameBuffer

Underlying FrameBuffer.

Source

pub fn framebuffer_mut(&mut self) -> &mut FrameBuffer

Underlying FrameBuffer (mutable metadata, not pixels).

Source

pub fn addr(&self) -> PhysAddr

Physical base address.

Source

pub fn dma_addr(&self) -> DmaAddr

DMA bus address (for writing into DMA2D OMAR).

Source

pub fn width(&self) -> u32

Width in pixels.

Source

pub fn height(&self) -> u32

Height in pixels.

Source

pub fn stride_bytes(&self) -> u32

Row stride in bytes.

Source

pub fn format(&self) -> PixelFmt

Pixel format.

Source

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.

Source

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 InFlight lifecycle 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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.