A wrapper for AHardwareBuffer https://developer.android.com/ndk/reference/group/a-hardware-buffer. More...
#include <hardware_buffer.h>
Public Types | |
enum class | CPUAccessType { kRead , kWrite } |
Public Member Functions | |
HardwareBuffer (HardwareBufferDescriptor descriptor) | |
~HardwareBuffer () | |
HardwareBuffer (const HardwareBuffer &)=delete | |
HardwareBuffer & | operator= (const HardwareBuffer &)=delete |
bool | IsValid () const |
AHardwareBuffer * | GetHandle () const |
const HardwareBufferDescriptor & | GetDescriptor () const |
const AHardwareBuffer_Desc & | GetAndroidDescriptor () const |
std::optional< uint64_t > | GetSystemUniqueID () const |
Get the system wide unique ID of the hardware buffer if possible. This is only available on Android API 31 and above. Within the process, the handle are unique. More... | |
void * | Lock (CPUAccessType type) const |
Lock the buffer for CPU access. This call may fail if the buffer was not created with one the usages that allow for CPU access. More... | |
bool | Unlock () const |
Unlock a mapping previously locked for CPU access. More... | |
Static Public Member Functions | |
static bool | IsAvailableOnPlatform () |
static std::optional< AHardwareBuffer_Desc > | Describe (AHardwareBuffer *buffer) |
static std::optional< uint64_t > | GetSystemUniqueID (AHardwareBuffer *buffer) |
Get the system wide unique ID of the hardware buffer if possible. This is only available on Android API 31 and above. Within the process, the handle are unique. More... | |
A wrapper for AHardwareBuffer https://developer.android.com/ndk/reference/group/a-hardware-buffer.
This wrapper creates and owns a handle to a managed hardware buffer. That is, there is no ability to take a reference to an externally created hardware buffer.
This wrapper is only available on Android API 29 and above.
Definition at line 95 of file hardware_buffer.h.
|
strong |
Enumerator | |
---|---|
kRead | |
kWrite |
Definition at line 135 of file hardware_buffer.h.
|
explicit |
Definition at line 57 of file hardware_buffer.cc.
References impeller::android::GetProcTable(), impeller::android::HardwareBufferDescriptor::IsAllocatable(), and VALIDATION_LOG.
|
default |
|
delete |
|
static |
Definition at line 127 of file hardware_buffer.cc.
References impeller::android::GetProcTable().
Referenced by impeller::android::testing::TEST().
const AHardwareBuffer_Desc & impeller::android::HardwareBuffer::GetAndroidDescriptor | ( | ) | const |
Definition at line 103 of file hardware_buffer.cc.
const HardwareBufferDescriptor & impeller::android::HardwareBuffer::GetDescriptor | ( | ) | const |
Definition at line 99 of file hardware_buffer.cc.
AHardwareBuffer * impeller::android::HardwareBuffer::GetHandle | ( | ) | const |
Definition at line 83 of file hardware_buffer.cc.
Referenced by impeller::glvk::CreateEGLImageFromAHBTexture(), GetSystemUniqueID(), impeller::android::SurfaceTransaction::SetContents(), and impeller::android::testing::TEST().
std::optional< uint64_t > impeller::android::HardwareBuffer::GetSystemUniqueID | ( | ) | const |
Get the system wide unique ID of the hardware buffer if possible. This is only available on Android API 31 and above. Within the process, the handle are unique.
Definition at line 111 of file hardware_buffer.cc.
References GetHandle().
Referenced by impeller::android::testing::TEST().
|
static |
Get the system wide unique ID of the hardware buffer if possible. This is only available on Android API 31 and above. Within the process, the handle are unique.
Definition at line 115 of file hardware_buffer.cc.
References impeller::android::GetProcTable().
|
static |
Definition at line 107 of file hardware_buffer.cc.
References impeller::android::GetProcTable(), and impeller::android::ProcTable::IsValid().
Referenced by impeller::AHBSwapchainVK::IsAvailableOnPlatform(), and impeller::android::testing::TEST().
bool impeller::android::HardwareBuffer::IsValid | ( | ) | const |
Definition at line 79 of file hardware_buffer.cc.
Referenced by impeller::android::testing::TEST().
void * impeller::android::HardwareBuffer::Lock | ( | CPUAccessType | type | ) | const |
Lock the buffer for CPU access. This call may fail if the buffer was not created with one the usages that allow for CPU access.
[in] | type | The type |
Definition at line 137 of file hardware_buffer.cc.
References impeller::android::GetProcTable(), kRead, kWrite, and type.
|
delete |
bool impeller::android::HardwareBuffer::Unlock | ( | ) | const |
Unlock a mapping previously locked for CPU access.
Definition at line 161 of file hardware_buffer.cc.
References impeller::android::GetProcTable().