Lock the AHardwareBuffer for reading or writing, depending on the usage flags
passed. This call may block if the hardware needs to finish rendering or if
CPU caches need to be synchronized, or possibly for other implementation-
specific reasons. If fence is not negative, then it specifies a fence file
descriptor that will be signaled when the buffer is locked, otherwise the
caller will block until the buffer is available.
If \a rect is not NULL, the caller promises to modify only data in the area
specified by rect. If rect is NULL, the caller may modify the contents of the
entire buffer.
The content of the buffer outside of the specified rect is NOT modified
by this call.
The \a usage parameter may only specify AHARDWAREBUFFER_USAGE_CPU_*. If set,
then outVirtualAddress is filled with the address of the buffer in virtual
memory.
THREADING CONSIDERATIONS:
It is legal for several different threads to lock a buffer for read access;
none of the threads are blocked.
Locking a buffer simultaneously for write or read/write is undefined, but
will neither terminate the process nor block the caller; AHardwareBuffer_lock
may return an error or leave the buffer's content into an indeterminate
state.
\return 0 on success, -EINVAL if \a buffer is NULL or if the usage
flags are not a combination of AHARDWAREBUFFER_USAGE_CPU_*, or an error
number of the lock fails for any reason.
Lock the AHardwareBuffer for reading or writing, depending on the usage flags passed. This call may block if the hardware needs to finish rendering or if CPU caches need to be synchronized, or possibly for other implementation- specific reasons. If fence is not negative, then it specifies a fence file descriptor that will be signaled when the buffer is locked, otherwise the caller will block until the buffer is available.
If \a rect is not NULL, the caller promises to modify only data in the area specified by rect. If rect is NULL, the caller may modify the contents of the entire buffer.
The content of the buffer outside of the specified rect is NOT modified by this call.
The \a usage parameter may only specify AHARDWAREBUFFER_USAGE_CPU_*. If set, then outVirtualAddress is filled with the address of the buffer in virtual memory.
THREADING CONSIDERATIONS:
It is legal for several different threads to lock a buffer for read access; none of the threads are blocked.
Locking a buffer simultaneously for write or read/write is undefined, but will neither terminate the process nor block the caller; AHardwareBuffer_lock may return an error or leave the buffer's content into an indeterminate state.
\return 0 on success, -EINVAL if \a buffer is NULL or if the usage flags are not a combination of AHARDWAREBUFFER_USAGE_CPU_*, or an error number of the lock fails for any reason.