Skip to content

Most visited

Recently visited

navigation

hardware_buffer.h File Reference

hardware_buffer.h File Reference

Data Structures

struct  AHardwareBuffer_Desc
 

Typedefs

typedef struct AHardwareBuffer_Desc AHardwareBuffer_Desc
 
typedef struct AHardwareBuffer AHardwareBuffer
 

Enumerations

enum  {
  AHARDWAREBUFFER_FORMAT_R8G8B8A8_UNORM = 1, AHARDWAREBUFFER_FORMAT_R8G8B8X8_UNORM = 2, AHARDWAREBUFFER_FORMAT_R8G8B8_UNORM = 3, AHARDWAREBUFFER_FORMAT_R5G6B5_UNORM = 4,
  AHARDWAREBUFFER_FORMAT_R16G16B16A16_FLOAT = 0x16, AHARDWAREBUFFER_FORMAT_R10G10B10A2_UNORM = 0x2b, AHARDWAREBUFFER_FORMAT_BLOB = 0x21, AHARDWAREBUFFER_FORMAT_D16_UNORM = 0x30,
  AHARDWAREBUFFER_FORMAT_D24_UNORM = 0x31, AHARDWAREBUFFER_FORMAT_D24_UNORM_S8_UINT = 0x32, AHARDWAREBUFFER_FORMAT_D32_FLOAT = 0x33, AHARDWAREBUFFER_FORMAT_D32_FLOAT_S8_UINT = 0x34,
  AHARDWAREBUFFER_FORMAT_S8_UINT = 0x35
}
 
enum  {
  AHARDWAREBUFFER_USAGE_CPU_READ_NEVER = 0UL, AHARDWAREBUFFER_USAGE_CPU_READ_RARELY = 2UL, AHARDWAREBUFFER_USAGE_CPU_READ_OFTEN = 3UL, AHARDWAREBUFFER_USAGE_CPU_READ_MASK = 0xFUL,
  AHARDWAREBUFFER_USAGE_CPU_WRITE_NEVER = 0UL << 4, AHARDWAREBUFFER_USAGE_CPU_WRITE_RARELY = 2UL << 4, AHARDWAREBUFFER_USAGE_CPU_WRITE_OFTEN = 3UL << 4, AHARDWAREBUFFER_USAGE_CPU_WRITE_MASK = 0xFUL << 4,
  AHARDWAREBUFFER_USAGE_GPU_SAMPLED_IMAGE = 1UL << 8, AHARDWAREBUFFER_USAGE_GPU_COLOR_OUTPUT = 1UL << 9, AHARDWAREBUFFER_USAGE_PROTECTED_CONTENT = 1UL << 14, AHARDWAREBUFFER_USAGE_VIDEO_ENCODE = 1UL << 16,
  AHARDWAREBUFFER_USAGE_SENSOR_DIRECT_DATA = 1UL << 23, AHARDWAREBUFFER_USAGE_GPU_DATA_BUFFER = 1UL << 24, AHARDWAREBUFFER_USAGE_GPU_CUBE_MAP = 1UL << 25, AHARDWAREBUFFER_USAGE_GPU_MIPMAP_COMPLETE = 1UL << 26,
  AHARDWAREBUFFER_USAGE_VENDOR_0 = 1ULL << 28, AHARDWAREBUFFER_USAGE_VENDOR_1 = 1ULL << 29, AHARDWAREBUFFER_USAGE_VENDOR_2 = 1ULL << 30, AHARDWAREBUFFER_USAGE_VENDOR_3 = 1ULL << 31,
  AHARDWAREBUFFER_USAGE_VENDOR_4 = 1ULL << 48, AHARDWAREBUFFER_USAGE_VENDOR_5 = 1ULL << 49, AHARDWAREBUFFER_USAGE_VENDOR_6 = 1ULL << 50, AHARDWAREBUFFER_USAGE_VENDOR_7 = 1ULL << 51,
  AHARDWAREBUFFER_USAGE_VENDOR_8 = 1ULL << 52, AHARDWAREBUFFER_USAGE_VENDOR_9 = 1ULL << 53, AHARDWAREBUFFER_USAGE_VENDOR_10 = 1ULL << 54, AHARDWAREBUFFER_USAGE_VENDOR_11 = 1ULL << 55,
  AHARDWAREBUFFER_USAGE_VENDOR_12 = 1ULL << 56, AHARDWAREBUFFER_USAGE_VENDOR_13 = 1ULL << 57, AHARDWAREBUFFER_USAGE_VENDOR_14 = 1ULL << 58, AHARDWAREBUFFER_USAGE_VENDOR_15 = 1ULL << 59,
  AHARDWAREBUFFER_USAGE_VENDOR_16 = 1ULL << 60, AHARDWAREBUFFER_USAGE_VENDOR_17 = 1ULL << 61, AHARDWAREBUFFER_USAGE_VENDOR_18 = 1ULL << 62, AHARDWAREBUFFER_USAGE_VENDOR_19 = 1ULL << 63
}
 

Functions

int AHardwareBuffer_allocate (const AHardwareBuffer_Desc *desc, AHardwareBuffer **outBuffer)
 
void AHardwareBuffer_acquire (AHardwareBuffer *buffer)
 
void AHardwareBuffer_release (AHardwareBuffer *buffer)
 
void AHardwareBuffer_describe (const AHardwareBuffer *buffer, AHardwareBuffer_Desc *outDesc)
 
int AHardwareBuffer_lock (AHardwareBuffer *buffer, uint64_t usage, int32_t fence, const ARect *rect, void **outVirtualAddress)
 
int AHardwareBuffer_unlock (AHardwareBuffer *buffer, int32_t *fence)
 
int AHardwareBuffer_sendHandleToUnixSocket (const AHardwareBuffer *buffer, int socketFd)
 
int AHardwareBuffer_recvHandleFromUnixSocket (int socketFd, AHardwareBuffer **outBuffer)
 

Typedef Documentation

◆ AHardwareBuffer

◆ AHardwareBuffer_Desc

Enumeration Type Documentation

◆ anonymous enum

anonymous enum

Buffer pixel formats.

Enumerator
AHARDWAREBUFFER_FORMAT_R8G8B8A8_UNORM 

Corresponding formats: Vulkan: VK_FORMAT_R8G8B8A8_UNORM OpenGL ES: GL_RGBA8

AHARDWAREBUFFER_FORMAT_R8G8B8X8_UNORM 

Corresponding formats: Vulkan: VK_FORMAT_R8G8B8A8_UNORM OpenGL ES: GL_RGBA8

AHARDWAREBUFFER_FORMAT_R8G8B8_UNORM 

Corresponding formats: Vulkan: VK_FORMAT_R8G8B8_UNORM OpenGL ES: GL_RGB8

AHARDWAREBUFFER_FORMAT_R5G6B5_UNORM 

Corresponding formats: Vulkan: VK_FORMAT_R5G6B5_UNORM_PACK16 OpenGL ES: GL_RGB565

AHARDWAREBUFFER_FORMAT_R16G16B16A16_FLOAT 

Corresponding formats: Vulkan: VK_FORMAT_R16G16B16A16_SFLOAT OpenGL ES: GL_RGBA16F

AHARDWAREBUFFER_FORMAT_R10G10B10A2_UNORM 

Corresponding formats: Vulkan: VK_FORMAT_A2B10G10R10_UNORM_PACK32 OpenGL ES: GL_RGB10_A2

AHARDWAREBUFFER_FORMAT_BLOB 

An opaque binary blob format that must have height 1, with width equal to the buffer size in bytes.

AHARDWAREBUFFER_FORMAT_D16_UNORM 

Corresponding formats: Vulkan: VK_FORMAT_D16_UNORM OpenGL ES: GL_DEPTH_COMPONENT16

AHARDWAREBUFFER_FORMAT_D24_UNORM 

Corresponding formats: Vulkan: VK_FORMAT_X8_D24_UNORM_PACK32 OpenGL ES: GL_DEPTH_COMPONENT24

AHARDWAREBUFFER_FORMAT_D24_UNORM_S8_UINT 

Corresponding formats: Vulkan: VK_FORMAT_D24_UNORM_S8_UINT OpenGL ES: GL_DEPTH24_STENCIL8

AHARDWAREBUFFER_FORMAT_D32_FLOAT 

Corresponding formats: Vulkan: VK_FORMAT_D32_SFLOAT OpenGL ES: GL_DEPTH_COMPONENT32F

AHARDWAREBUFFER_FORMAT_D32_FLOAT_S8_UINT 

Corresponding formats: Vulkan: VK_FORMAT_D32_SFLOAT_S8_UINT OpenGL ES: GL_DEPTH32F_STENCIL8

AHARDWAREBUFFER_FORMAT_S8_UINT 

Corresponding formats: Vulkan: VK_FORMAT_S8_UINT OpenGL ES: GL_STENCIL_INDEX8

◆ anonymous enum

anonymous enum
Enumerator
AHARDWAREBUFFER_USAGE_CPU_READ_NEVER 
AHARDWAREBUFFER_USAGE_CPU_READ_RARELY 
AHARDWAREBUFFER_USAGE_CPU_READ_OFTEN 
AHARDWAREBUFFER_USAGE_CPU_READ_MASK 
AHARDWAREBUFFER_USAGE_CPU_WRITE_NEVER 
AHARDWAREBUFFER_USAGE_CPU_WRITE_RARELY 
AHARDWAREBUFFER_USAGE_CPU_WRITE_OFTEN 
AHARDWAREBUFFER_USAGE_CPU_WRITE_MASK 
AHARDWAREBUFFER_USAGE_GPU_SAMPLED_IMAGE 
AHARDWAREBUFFER_USAGE_GPU_COLOR_OUTPUT 
AHARDWAREBUFFER_USAGE_PROTECTED_CONTENT 
AHARDWAREBUFFER_USAGE_VIDEO_ENCODE 
AHARDWAREBUFFER_USAGE_SENSOR_DIRECT_DATA 
AHARDWAREBUFFER_USAGE_GPU_DATA_BUFFER 
AHARDWAREBUFFER_USAGE_GPU_CUBE_MAP 
AHARDWAREBUFFER_USAGE_GPU_MIPMAP_COMPLETE 
AHARDWAREBUFFER_USAGE_VENDOR_0 
AHARDWAREBUFFER_USAGE_VENDOR_1 
AHARDWAREBUFFER_USAGE_VENDOR_2 
AHARDWAREBUFFER_USAGE_VENDOR_3 
AHARDWAREBUFFER_USAGE_VENDOR_4 
AHARDWAREBUFFER_USAGE_VENDOR_5 
AHARDWAREBUFFER_USAGE_VENDOR_6 
AHARDWAREBUFFER_USAGE_VENDOR_7 
AHARDWAREBUFFER_USAGE_VENDOR_8 
AHARDWAREBUFFER_USAGE_VENDOR_9 
AHARDWAREBUFFER_USAGE_VENDOR_10 
AHARDWAREBUFFER_USAGE_VENDOR_11 
AHARDWAREBUFFER_USAGE_VENDOR_12 
AHARDWAREBUFFER_USAGE_VENDOR_13 
AHARDWAREBUFFER_USAGE_VENDOR_14 
AHARDWAREBUFFER_USAGE_VENDOR_15 
AHARDWAREBUFFER_USAGE_VENDOR_16 
AHARDWAREBUFFER_USAGE_VENDOR_17 
AHARDWAREBUFFER_USAGE_VENDOR_18 
AHARDWAREBUFFER_USAGE_VENDOR_19 

Function Documentation

◆ AHardwareBuffer_acquire()

void AHardwareBuffer_acquire ( AHardwareBuffer buffer)

Acquire a reference on the given AHardwareBuffer object. This prevents the object from being deleted until the last reference is removed.

◆ AHardwareBuffer_allocate()

int AHardwareBuffer_allocate ( const AHardwareBuffer_Desc desc,
AHardwareBuffer **  outBuffer 
)

Allocates a buffer that backs an AHardwareBuffer using the passed AHardwareBuffer_Desc.

Returns NO_ERROR on success, or an error number of the allocation fails for any reason.

◆ AHardwareBuffer_describe()

void AHardwareBuffer_describe ( const AHardwareBuffer buffer,
AHardwareBuffer_Desc outDesc 
)

Return a description of the AHardwareBuffer in the passed AHardwareBuffer_Desc struct.

◆ AHardwareBuffer_lock()

int AHardwareBuffer_lock ( AHardwareBuffer buffer,
uint64_t  usage,
int32_t  fence,
const ARect rect,
void **  outVirtualAddress 
)

◆ AHardwareBuffer_recvHandleFromUnixSocket()

int AHardwareBuffer_recvHandleFromUnixSocket ( int  socketFd,
AHardwareBuffer **  outBuffer 
)

◆ AHardwareBuffer_release()

void AHardwareBuffer_release ( AHardwareBuffer buffer)

Remove a reference that was previously acquired with AHardwareBuffer_acquire().

◆ AHardwareBuffer_sendHandleToUnixSocket()

int AHardwareBuffer_sendHandleToUnixSocket ( const AHardwareBuffer buffer,
int  socketFd 
)

◆ AHardwareBuffer_unlock()

int AHardwareBuffer_unlock ( AHardwareBuffer buffer,
int32_t *  fence 
)
This site uses cookies to store your preferences for site-specific language and display options.

Get the latest Android developer news and tips that will help you find success on Google Play.

* Required Fields

Hooray!

Follow Google Developers on WeChat

Browse this site in ?

You requested a page in , but your language preference for this site is .

Would you like to change your language preference and browse this site in ? If you want to change your language preference later, use the language menu at the bottom of each page.

This class requires API level or higher

This doc is hidden because your selected API level for the documentation is . You can change the documentation API level with the selector above the left navigation.

For more information about specifying the API level your app requires, read Supporting Different Platform Versions.

Take a short survey?
Help us improve the Android developer experience. (April 2018 — Developer Survey)