Skip to main content

SurfaceMemoryDescriptor

Trait SurfaceMemoryDescriptor 

Source
pub trait SurfaceMemoryDescriptor {
    // Required method
    fn add_attrs(
        &mut self,
        attrs: &mut Vec<VASurfaceAttrib>,
    ) -> Option<Box<dyn Any>>;
}
Expand description

Trait describing a memory backing for surfaces.

Using external memory for backing a VA surface is done in two steps:

  1. Build the descriptor specific to the memory type we want to use,
  2. Mention this descriptor as an attribute to be passed to vaDeriveImage.

This trait allows to do that in a as-safe-as-possible way, by adding the required attributes and returning a heap-allocated object containing the data pointed to by the attributes. That way, the caller can keep that object alive until vaCreateSurfaces has returned.

Required Methods§

Source

fn add_attrs( &mut self, attrs: &mut Vec<VASurfaceAttrib>, ) -> Option<Box<dyn Any>>

Add the required attributes to attr in order to attach the memory of this descriptor to the surface when it is created.

The returned object, if any, is the descriptor pointed to by the attributes. The caller must keep it around and unmoved until vaCreateSurfaces has returned.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl SurfaceMemoryDescriptor for ()

Used when we want the VA driver to allocate surface memory for us. In this case we don’t need to add any specific attribute for surface creation.

Source§

fn add_attrs(&mut self, _: &mut Vec<VASurfaceAttrib>) -> Option<Box<dyn Any>>

Implementors§