pub struct VaapiSurface { /* private fields */ }Available on Linux only.
Expand description
VAAPI surface (VASurfaceID + VADisplay). Kept as a newtype so the
GpuResource enum can carry it uniformly with the rest.
Implementations§
Source§impl VaapiSurface
impl VaapiSurface
Sourcepub unsafe fn try_from_raw(
surface: u32,
display: *mut c_void,
keep_alive: Option<KeepAlive>,
) -> Result<Self, InvalidHandleError>
pub unsafe fn try_from_raw( surface: u32, display: *mut c_void, keep_alive: Option<KeepAlive>, ) -> Result<Self, InvalidHandleError>
Wrap a VASurfaceID together with its VADisplay. Borrowing: the
handle is stored non-owningly, this type has no Drop, and every
obligation below extends to each Clone.
§Safety
displaymust be a liveVADisplayon whichvaInitializesucceeded andvaTerminatehas not run. Null is rejected asInvalidHandleError::NullPointerand is not a caller obligation.surfacemust be aVASurfaceIDcurrently allocated on that display. It is a plainu32index, so nothing distinguishes a stale or fabricated id from a live one — including0, which is deliberately not rejected here because0is a legalVASurfaceID. Passing a destroyed surface makes the exporter’svaExportSurfaceHandleaddress a recycled slot.- Lifetime: nothing is retained and there is no
Drop. NeithervaDestroySurfacesnorvaTerminatemay run while this value or anyCloneof it is reachable, and the surface must not be recycled back into the decoder’s pool either — a reused id silently yields another frame’s pixels.keep_aliveexists to anchor the decoder context that owns both; withNonethe caller carries the obligation. - Thread affinity:
VaapiSurfaceisSend + Sync, but libva serialises on a per-VADisplaylock and most drivers require that a surface not be exported while the decoder is still writing it. The caller must have completedvaSyncSurface(or an equivalent fence) before handing the id over.
pub fn surface(&self) -> u32
pub fn display(&self) -> *mut c_void
pub fn keep_alive(&self) -> Option<&KeepAlive>
Trait Implementations§
Source§impl Clone for VaapiSurface
impl Clone for VaapiSurface
Source§impl Debug for VaapiSurface
impl Debug for VaapiSurface
impl Send for VaapiSurface
impl Sync for VaapiSurface
Auto Trait Implementations§
impl !RefUnwindSafe for VaapiSurface
impl !UnwindSafe for VaapiSurface
impl Freeze for VaapiSurface
impl Unpin for VaapiSurface
impl UnsafeUnpin for VaapiSurface
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
Mutably borrows from an owned value. Read more