Trait cros_libva::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.

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§