Struct cros_libva::Display

source ·
pub struct Display { /* private fields */ }
Expand description

A VADisplay opened over DRM.

A Display is the starting point to using libva. This struct is essentially a safe wrapper over VADisplay, from which Surfaces and Contexts can be allocated in order to perform actual work using Display::create_surfaces and Display::create_context, respectively.

Although libva offers several ways to create a display, this struct currently only supports opening through DRM. It may be extended to support other display types (X11, Wayland) in the future.

Implementations§

source§

impl Display

source

pub fn open_drm_display<P: AsRef<Path>>( path: P ) -> Result<Rc<Self>, OpenDrmDisplayError>

Opens and initializes a specific DRM Display.

path is the path to a DRM device that supports VAAPI, e.g. /dev/dri/renderD128.

source

pub fn open() -> Option<Rc<Self>>

Opens the first device that succeeds and returns its Display.

If an error occurs on a given device, it is ignored and the next one is tried until one succeeds or we reach the end of the iterator.

source

pub fn query_config_profiles(&self) -> Result<Vec<Type>, VaError>

Queries supported profiles by this display by wrapping vaQueryConfigProfiles.

source

pub fn query_vendor_string(&self) -> Result<String, &'static str>

Returns a string describing some aspects of the VA implemenation on the specific hardware accelerator used by this display. Wrapper over vaQueryVendorString.

The format of the returned string is vendor specific and at the discretion of the implementer. e.g. for the Intel GMA500 implementation, an example would be: Intel GMA500 - 2.0.0.32L.0005.

source

pub fn query_config_entrypoints( &self, profile: Type ) -> Result<Vec<Type>, VaError>

Query supported entrypoints for a given profile by wrapping vaQueryConfigEntrypoints.

source

pub fn get_config_attributes( &self, profile: Type, entrypoint: Type, attributes: &mut [VAConfigAttrib] ) -> Result<(), VaError>

Writes attributes for a given profile/entrypoint pair into attributes. Wrapper over vaGetConfigAttributes.

Entries of attributes must have their type_ member initialized to the desired attribute to retrieve.

source

pub fn create_surfaces<D: SurfaceMemoryDescriptor>( self: &Rc<Self>, rt_format: u32, va_fourcc: Option<u32>, width: u32, height: u32, usage_hint: Option<UsageHint>, descriptors: Vec<D> ) -> Result<Vec<Surface<D>>, VaError>

Creates Surfaces by wrapping around a vaCreateSurfaces call.

The number of surfaces created will be equal to the length of descriptors.

Arguments
  • rt_format - The desired surface format. See VA_RT_FORMAT_*
  • va_fourcc - The desired pixel format (optional). See VA_FOURCC_*
  • width - Width for the create surfaces
  • height - Height for the created surfaces
  • usage_hint - Optional hint of intended usage to optimize allocation (e.g. tiling)
  • num_surfaces - Number of surfaces to create
  • descriptors - Memory descriptors used as surface memory backing.
Return value

Returns as many surfaces as the length of descriptors.

Note that the descriptors’s ownership is irrevocably given to the surfaces, and that in case of error the descriptors will be destroyed. Make sure to duplicate the descriptors if you need something outside of libva to access them.

source

pub fn create_context<D: SurfaceMemoryDescriptor>( self: &Rc<Self>, config: &Config, coded_width: u32, coded_height: u32, surfaces: Option<&Vec<Surface<D>>>, progressive: bool ) -> Result<Rc<Context>, VaError>

Creates a Context by wrapping around a vaCreateContext call.

Arguments
  • config - The configuration for the context
  • coded_width - The coded picture width
  • coded_height - The coded picture height
  • surfaces - Optional hint for the amount of surfaces tied to the context
  • progressive - Whether only progressive frame pictures are present in the sequence
source

pub fn create_config( self: &Rc<Self>, attrs: Vec<VAConfigAttrib>, profile: Type, entrypoint: Type ) -> Result<Config, VaError>

Creates a Config by wrapping around the vaCreateConfig call.

attrs describe the attributes to set for this config. A list of the supported attributes for a given profile/entrypoint pair can be retrieved using Display::get_config_attributes. Other attributes will take their default values, and attrs can be empty in order to obtain a default configuration.

source

pub fn query_image_formats(&self) -> Result<Vec<VAImageFormat>, VaError>

Returns available image formats for this display by wrapping around vaQueryImageFormats.

Trait Implementations§

source§

impl Drop for Display

source§

fn drop(&mut self)

Executes the destructor for this type. Read more

Auto Trait Implementations§

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

§

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

§

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.