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 Surface
s and Context
s 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.
Fields
handle: *mut c_void
Handle to interact with the underlying VADisplay
.
drm_file: File
DRM file that must be kept open while the display is in use.
Implementations
sourceimpl Display
impl Display
sourcepub fn open_drm_display<P: AsRef<Path>>(path: P) -> Result<Rc<Self>>
pub fn open_drm_display<P: AsRef<Path>>(path: P) -> Result<Rc<Self>>
Opens and initializes a specific DRM Display
.
path
is the path to a DRM device that supports VAAPI, e.g. /dev/dri/renderD128
.
sourcepub fn open() -> Option<Rc<Self>>
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.
sourcepub fn query_config_profiles(&self) -> Result<Vec<Type>>
pub fn query_config_profiles(&self) -> Result<Vec<Type>>
Queries supported profiles by this display.
sourcepub fn query_vendor_string(&self) -> Result<String, &'static str>
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.
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
.
sourcepub fn query_config_entrypoints(&self, profile: Type) -> Result<Vec<Type>>
pub fn query_config_entrypoints(&self, profile: Type) -> Result<Vec<Type>>
Query supported entrypoints for a given profile.
sourcepub fn get_config_attributes(
&self,
profile: Type,
entrypoint: Type,
attributes: &mut [VAConfigAttrib]
) -> Result<()>
pub fn get_config_attributes(
&self,
profile: Type,
entrypoint: Type,
attributes: &mut [VAConfigAttrib]
) -> Result<()>
Writes attributes for a given profile
/entrypoint
pair into attributes
.
Entries of attributes
must have their type_
member initialized to the desired attribute
to retrieve.
sourcepub fn create_surfaces(
self: &Rc<Self>,
rt_format: u32,
va_fourcc: Option<u32>,
width: u32,
height: u32,
usage_hint: Option<UsageHint>,
num_surfaces: u32
) -> Result<Vec<Surface>>
pub fn create_surfaces(
self: &Rc<Self>,
rt_format: u32,
va_fourcc: Option<u32>,
width: u32,
height: u32,
usage_hint: Option<UsageHint>,
num_surfaces: u32
) -> Result<Vec<Surface>>
Creates Surface
s by wrapping around a vaCreateSurfaces
call.
Arguments
rt_format
- The desired surface format. SeeVA_RT_FORMAT_*
va_fourcc
- The desired pixel format (optional). SeeVA_FOURCC_*
width
- Width for the create surfacesheight
- Height for the created surfacesusage_hint
- Optional hint of intended usage to optimize allocation (e.g. tiling)num_surfaces
- Number of surfaces to create
sourcepub fn create_context(
self: &Rc<Self>,
config: &Config,
coded_width: i32,
coded_height: i32,
surfaces: Option<&Vec<Surface>>,
progressive: bool
) -> Result<Rc<Context>>
pub fn create_context(
self: &Rc<Self>,
config: &Config,
coded_width: i32,
coded_height: i32,
surfaces: Option<&Vec<Surface>>,
progressive: bool
) -> Result<Rc<Context>>
Creates a Context
by wrapping around a vaCreateContext
call.
Arguments
config
- The configuration for the contextcoded_width
- The coded picture widthcoded_height
- The coded picture heightsurfaces
- Optional hint for the amount of surfaces tied to the contextprogressive
- Whether only progressive frame pictures are present in the sequence
sourcepub fn create_config(
self: &Rc<Self>,
attrs: Vec<VAConfigAttrib>,
profile: Type,
entrypoint: Type
) -> Result<Config>
pub fn create_config(
self: &Rc<Self>,
attrs: Vec<VAConfigAttrib>,
profile: Type,
entrypoint: Type
) -> Result<Config>
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.
sourcepub fn query_image_formats(self: &Rc<Self>) -> Result<Vec<VAImageFormat>>
pub fn query_image_formats(self: &Rc<Self>) -> Result<Vec<VAImageFormat>>
Returns available image formats for this display by wrapping around vaQueryImageFormats
.