pub struct VaSurfacePool<M: SurfaceMemoryDescriptor> { /* private fields */ }
Expand description
A surface pool to reduce the number of costly Surface allocations.
The pool only houses Surfaces that fits the pool’s coded resolution. Stale surfaces are dropped when either the pool resolution changes, or when stale surfaces are retrieved.
This means that this pool is suitable for inter-frame DRC, as the stale surfaces will gracefully be dropped, which is arguably better than the alternative of having more than one pool active at a time.
Implementations§
Source§impl<M: SurfaceMemoryDescriptor> VaSurfacePool<M>
impl<M: SurfaceMemoryDescriptor> VaSurfacePool<M>
Sourcepub fn new(
display: Rc<Display>,
rt_format: u32,
usage_hint: Option<UsageHint>,
coded_resolution: Resolution,
) -> Self
pub fn new( display: Rc<Display>, rt_format: u32, usage_hint: Option<UsageHint>, coded_resolution: Resolution, ) -> Self
Create a new pool.
display
- the VA display to create the surfaces from.rt_format
- the VA RT format to use for the surfaces.usage_hint
- hint about how the surfaces from this pool will be used.coded_resolution
- resolution of the surfaces.
Sourcepub fn get_surface(&mut self) -> Option<PooledVaSurface<M>>
pub fn get_surface(&mut self) -> Option<PooledVaSurface<M>>
Gets a free surface from the pool.
Trait Implementations§
Source§impl<M: SurfaceMemoryDescriptor> FramePool for VaSurfacePool<M>
impl<M: SurfaceMemoryDescriptor> FramePool for VaSurfacePool<M>
Source§type Descriptor = M
type Descriptor = M
Type of descriptor for the memory backing the frames.
Source§fn coded_resolution(&self) -> Resolution
fn coded_resolution(&self) -> Resolution
Returns the coded resolution of the pool. Read more
Source§fn set_coded_resolution(&mut self, resolution: Resolution)
fn set_coded_resolution(&mut self, resolution: Resolution)
Update the coded resolution of the pool. Read more
Source§fn add_frames(
&mut self,
descriptors: Vec<Self::Descriptor>,
) -> Result<(), Error>
fn add_frames( &mut self, descriptors: Vec<Self::Descriptor>, ) -> Result<(), Error>
Add new frames to the pool, using
descriptors
as backing memory.Source§fn num_free_frames(&self) -> usize
fn num_free_frames(&self) -> usize
Returns new number of frames currently available in this pool.
Source§fn num_managed_frames(&self) -> usize
fn num_managed_frames(&self) -> usize
Returns the total number of managed frames in this pool.
Auto Trait Implementations§
impl<M> Freeze for VaSurfacePool<M>
impl<M> !RefUnwindSafe for VaSurfacePool<M>
impl<M> !Send for VaSurfacePool<M>
impl<M> !Sync for VaSurfacePool<M>
impl<M> Unpin for VaSurfacePool<M>
impl<M> !UnwindSafe for VaSurfacePool<M>
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