pub struct HB { /* private fields */ }
Expand description
Singleton that holds the loaded libandroid functions and provides wrappers.
Methods from Deref<Target = HBHolder>§
Sourcepub unsafe fn acquire(&self, buffer: NonNull<AHardwareBuffer>)
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.
Sourcepub unsafe fn release(&self, buffer: NonNull<AHardwareBuffer>)
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.
Sourcepub fn allocate(&self, desc: AHardwareBufferDesc) -> Option<HBRef>
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.
Sourcepub fn describe(&self, buffer: &HBRef) -> Option<AHardwareBufferDesc>
pub fn describe(&self, buffer: &HBRef) -> Option<AHardwareBufferDesc>
Return a description of the AHardwareBuffer.
Available since API level 26.
Sourcepub fn get_id(&self, buffer: &HBRef) -> Option<u64>
pub fn get_id(&self, buffer: &HBRef) -> Option<u64>
Get the system wide unique id for an AHardwareBuffer.
Available since API level 31.
Sourcepub fn is_supported(&self, desc: &AHardwareBufferDesc) -> bool
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.
Sourcepub fn recv(&self, socket: &UnixStream) -> Option<HBRef>
pub fn recv(&self, socket: &UnixStream) -> Option<HBRef>
Receive an AHardwareBuffer from an AF_UNIX socket. Available since API level 26.
Sourcepub fn send(&self, socket: &UnixStream, buffer: &HBRef) -> bool
pub fn send(&self, socket: &UnixStream, buffer: &HBRef) -> bool
Send the AHardwareBuffer to an AF_UNIX socket. Available since API level 26.
Sourcepub fn lock(
&self,
buffer: &HBRef,
usage: u64,
fence: Option<BorrowedFd<'_>>,
rect: Option<&ARect>,
) -> *mut c_void
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.
Sourcepub fn lock_info(
&self,
buffer: &HBRef,
usage: u64,
fence: Option<BorrowedFd<'_>>,
rect: Option<&ARect>,
) -> Option<LockInfo>
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.
Sourcepub fn lock_planes(
&self,
buffer: &HBRef,
usage: u64,
fence: Option<BorrowedFd<'_>>,
rect: Option<&ARect>,
) -> Option<AHardwareBufferPlanes>
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.