Skip to main content

Device

Struct Device 

Source
pub(crate) struct Device {
    api: VaApi,
    display: VADisplay,
    _fd: OwnedFd,
    vendor: String,
    vce: bool,
    whole_picture_vdenc: bool,
}
Expand description

A VA display opened on a render node, terminated with the device.

Fields§

§api: VaApi§display: VADisplay§_fd: OwnedFd§vendor: String§vce: bool

Whether the device encodes H.264 on AMD’s VCE (amd_vce).

§whole_picture_vdenc: bool

Whether the device’s low-power H.264 encoder codes a picture as one slice only (whole_picture_vdenc).

Implementations§

Source§

impl Device

Source

pub(crate) fn open(api: &VaApi, encode_node_index: i32) -> Result<Self, String>

Open the render node behind encode_node_index (renderD128 when none is named) and initialize the driver on it.

Source

pub(crate) fn on( api: &VaApi, fd: OwnedFd, render_node: &str, ) -> Result<Self, String>

Initialize the driver on the open render node fd, with its messages routed to the log; render_node names it in errors.

Source

fn rounds_linear_pitch(&self) -> bool

Whether the driver’s video processor, converting to 4:2:0, reads a linear surface at a pitch rounded up to 64 bytes rather than the one its import declares, as Intel’s does: such a surface converts sheared unless its pitch is already a multiple of 64.

Source

fn hardware(&self) -> Hardware

The quantizer curve the driver’s sessions read: Intel’s has its own where its encoders were measured apart from AMD’s.

Source

fn one_slice_h264(&self, entrypoint: VAEntrypoint) -> bool

Whether an H.264 picture of entrypoint is left as one slice (SLICES): on AMD’s VCE, and on a low-power encoder that codes no other cut.

Source

fn keeps_anchors(&self) -> bool

Whether a session keeps anchors (ReferenceWindow::with_anchors): the driver codes a picture from the reference it is named, as radeonsi’s VCE (H.264) and UVD (H.265) were measured to (vaapi_predicts_past_a_lost_frame, vaapi_predicts_from_an_anchor); others are not yet. H.264 keeps one, long-term; H.265 keeps two, listed as short-term pictures in every reference picture set, as NVENC’s are.

Source

fn starves_in_a_small_buffer(&self) -> bool

Whether the driver’s rate control stops coding in a buffer of a frame or two, as Intel’s iHD does (ConstantRate).

Source

fn h264_driver_level(&self) -> u32

The highest H.264 level_idc the driver’s sequence parameters may name (Negotiated::h264_driver_level). iHD’s level table ends at 5.2: above it its rate control is handed a maximum frame size of 0 (GetProfileLevelMaxFrameSize), and every constant-rate picture after the key frame comes out undecodable past its first rows a slice (29 of 30 at 2160p and 75 fps on an Arc A750, vaapi_h264_constant_rate_decodes_above_level_5_2), where a constant quantizer, which runs no rate control, decodes clean. Told 5.2, its frame cap stays above any frame.

Source

fn check(&self, status: VAStatus, what: &str) -> Result<(), String>

Source

fn profiles(&self) -> Result<Vec<VAProfile>, String>

The profiles the driver lists.

Source

fn encode_entrypoints(&self, profile: VAProfile) -> Vec<VAEntrypoint> ⓘ

The encode entry points of profile, the low-power one first, since recent Intel generations expose it as the only one for HEVC, VP9, and AV1 and it is the shorter path where both exist; a session the low-power one cannot serve, such as a constant-rate one where it runs constant quantizer only, takes the full one. Empty where the profile encodes on neither. H.264 on a part whose low-power encoder codes one slice a picture takes the full one first instead (on_device).

Source

fn attribute( &self, profile: VAProfile, entrypoint: VAEntrypoint, kind: VAConfigAttribType, ) -> Option<u32>

One configuration attribute of a profile and entry point, None where the driver does not report it.

Source

fn surface_attributes(&self, config: VAConfigID) -> Vec<VASurfaceAttrib> ⓘ

The surface attributes a configuration reports, asked for the way libva wants: once for the count, once for the values. Empty where the driver reports none.

Source

fn surface_fourccs(&self, config: VAConfigID) -> Vec<u32>

The surface formats a configuration renders into, empty where it constrains none.

Source

fn surface_alignment(&self, config: VAConfigID) -> (u32, u32)

The surface alignment a configuration asks for, as (width, height), one where it asks none.

Source

fn create_surfaces( &self, rt_format: u32, fourcc: u32, width: u32, height: u32, count: usize, ) -> Result<Vec<VASurfaceID>, String>

Surfaces of fourcc at width x height, count of them, on the driver’s own memory.

Source

fn destroy_surfaces(&self, surfaces: &mut [VASurfaceID])

Source

fn create_buffer( &self, context: VAContextID, kind: VABufferType, data: &[u8], ) -> Result<VABufferID, String>

Source

fn create_output_buffer( &self, context: VAContextID, kind: VABufferType, size: u32, ) -> Result<VABufferID, String>

A buffer the driver fills, created without initial data: iHD refuses a coded buffer handed any.

Source

fn create_buffer_raw( &self, context: VAContextID, kind: VABufferType, size: c_uint, data: *mut c_void, ) -> Result<VABufferID, String>

Trait Implementations§

Source§

impl Drop for Device

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. Read more
Source§

impl Send for Device

The display is used from the one thread that holds the session.

Source§

impl Sync for Device

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
§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<T> Downcast for T
where T: Any,

§

fn into_any(self: Box<T>) -> Box<dyn Any>

Convert Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.
§

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>

Convert Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait.
§

fn as_any(&self) -> &(dyn Any + 'static)

Convert &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s.
§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Convert &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
§

impl<T> DowncastSync for T
where T: Any + Send + Sync,

§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Send + Sync> ⓘ

Convert Arc<Trait> (where Trait: Downcast) to Arc<Any>. Arc<Any> can then be further downcast into Arc<ConcreteType> where ConcreteType implements Trait.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

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

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more