Struct HB

Source
pub struct HB { /* private fields */ }
Expand description

Singleton that holds the loaded libandroid functions and provides wrappers.

Methods from Deref<Target = HBHolder>§

Source

pub unsafe fn acquire(&self, buffer: NonNull<AHardwareBuffer>)

Acquire a reference on the given AHardwareBuffer object.
This prevents the object from being deleted until the last reference is removed.
Available since API level 26.

Source

pub unsafe fn release(&self, buffer: NonNull<AHardwareBuffer>)

Remove a reference that was previously acquired with AHardwareBuffer_acquire() or AHardwareBuffer_allocate().
Available since API level 26.

Source

pub fn allocate(&self, desc: AHardwareBufferDesc) -> Option<HBRef>

Allocates a buffer that matches the passed AHardwareBuffer_Desc.
If allocation succeeds, the buffer can be used according to the usage flags specified in its description. If a buffer is used in ways not compatible with its usage flags, the results are undefined and may include program termination.
Available since API level 26.

Source

pub fn describe(&self, buffer: &HBRef) -> Option<AHardwareBufferDesc>

Return a description of the AHardwareBuffer.
Available since API level 26.

Source

pub fn get_id(&self, buffer: &HBRef) -> Option<u64>

Get the system wide unique id for an AHardwareBuffer.
Available since API level 31.

Source

pub fn is_supported(&self, desc: &AHardwareBufferDesc) -> bool

Test whether the given format and usage flag combination is allocatable.
If this function returns true, it means that a buffer with the given description can be allocated on this implementation, unless resource exhaustion occurs. If this function returns false, it means that the allocation of the given description will never succeed.
The return value of this function may depend on all fields in the description, except stride, which is always ignored. For example, some implementations have implementation-defined limits on texture size and layer count.
Available since API level 29.

Source

pub fn recv(&self, socket: &UnixStream) -> Option<HBRef>

Receive an AHardwareBuffer from an AF_UNIX socket. Available since API level 26.

Source

pub fn send(&self, socket: &UnixStream, buffer: &HBRef) -> bool

Send the AHardwareBuffer to an AF_UNIX socket. Available since API level 26.

Source

pub fn lock( &self, buffer: &HBRef, usage: u64, fence: Option<BorrowedFd<'_>>, rect: Option<&ARect>, ) -> *mut c_void

Lock the AHardwareBuffer for direct CPU access. Available since API level 26.

Source

pub fn lock_info( &self, buffer: &HBRef, usage: u64, fence: Option<BorrowedFd<'_>>, rect: Option<&ARect>, ) -> Option<LockInfo>

Lock an AHardwareBuffer for direct CPU access. Available since API level 29.

Source

pub fn lock_planes( &self, buffer: &HBRef, usage: u64, fence: Option<BorrowedFd<'_>>, rect: Option<&ARect>, ) -> Option<AHardwareBufferPlanes>

Lock an AHardwareBuffer for direct CPU access. Available since API level 29.

Source

pub fn unlock(&self, buffer: &HBRef) -> bool

Unlock the AHardwareBuffer from direct CPU access. Available since API level 26.

Trait Implementations§

Source§

impl Deref for HB

Source§

type Target = HBHolder

The resulting type after dereferencing.
Source§

fn deref(&self) -> &HBHolder

Dereferences the value.
Source§

impl LazyStatic for HB

Auto Trait Implementations§

§

impl Freeze for HB

§

impl RefUnwindSafe for HB

§

impl Send for HB

§

impl Sync for HB

§

impl Unpin for HB

§

impl UnwindSafe for HB

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<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
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.