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: boolWhether the device encodes H.264 on AMD’s VCE (amd_vce).
whole_picture_vdenc: boolWhether the device’s low-power H.264 encoder codes a picture as one slice only
(whole_picture_vdenc).
Implementations§
Source§impl Device
impl Device
Sourcepub(crate) fn open(api: &VaApi, encode_node_index: i32) -> Result<Self, String>
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.
Sourcepub(crate) fn on(
api: &VaApi,
fd: OwnedFd,
render_node: &str,
) -> Result<Self, String>
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.
Sourcefn rounds_linear_pitch(&self) -> bool
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.
Sourcefn hardware(&self) -> Hardware
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.
Sourcefn one_slice_h264(&self, entrypoint: VAEntrypoint) -> bool
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.
Sourcefn keeps_anchors(&self) -> bool
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.
Sourcefn starves_in_a_small_buffer(&self) -> bool
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).
Sourcefn h264_driver_level(&self) -> u32
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.
fn check(&self, status: VAStatus, what: &str) -> Result<(), String>
Sourcefn encode_entrypoints(&self, profile: VAProfile) -> Vec<VAEntrypoint> ⓘ
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).
Sourcefn attribute(
&self,
profile: VAProfile,
entrypoint: VAEntrypoint,
kind: VAConfigAttribType,
) -> Option<u32>
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.
Sourcefn surface_attributes(&self, config: VAConfigID) -> Vec<VASurfaceAttrib> ⓘ
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.
Sourcefn surface_fourccs(&self, config: VAConfigID) -> Vec<u32>
fn surface_fourccs(&self, config: VAConfigID) -> Vec<u32>
The surface formats a configuration renders into, empty where it constrains none.
Sourcefn surface_alignment(&self, config: VAConfigID) -> (u32, u32)
fn surface_alignment(&self, config: VAConfigID) -> (u32, u32)
The surface alignment a configuration asks for, as (width, height), one where it
asks none.
Sourcefn create_surfaces(
&self,
rt_format: u32,
fourcc: u32,
width: u32,
height: u32,
count: usize,
) -> Result<Vec<VASurfaceID>, String>
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.
fn destroy_surfaces(&self, surfaces: &mut [VASurfaceID])
fn create_buffer( &self, context: VAContextID, kind: VABufferType, data: &[u8], ) -> Result<VABufferID, String>
Sourcefn create_output_buffer(
&self,
context: VAContextID,
kind: VABufferType,
size: u32,
) -> Result<VABufferID, String>
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.
fn create_buffer_raw( &self, context: VAContextID, kind: VABufferType, size: c_uint, data: *mut c_void, ) -> Result<VABufferID, String>
Trait Implementations§
impl Send for Device
The display is used from the one thread that holds the session.
impl Sync for Device
Auto Trait Implementations§
impl Freeze for Device
impl RefUnwindSafe for Device
impl Unpin for Device
impl UnsafeUnpin for Device
impl UnwindSafe for Device
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
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>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
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)
fn as_any(&self) -> &(dyn Any + 'static)
&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)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&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
impl<T> DowncastSync for T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
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