Struct VaSurfacePool

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

Source

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

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>

Source§

type Descriptor = M

Type of descriptor for the memory backing the frames.
Source§

fn coded_resolution(&self) -> Resolution

Returns the coded resolution of the pool. Read more
Source§

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>

Add new frames to the pool, using descriptors as backing memory.
Source§

fn num_free_frames(&self) -> usize

Returns new number of frames currently available in this pool.
Source§

fn num_managed_frames(&self) -> usize

Returns the total number of managed frames in this pool.
Source§

fn clear(&mut self)

Remove all frames from 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> 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.