From 378ef07760eda717367d9429428c42d54d54d9a7 Mon Sep 17 00:00:00 2001 From: Francis Hart Date: Tue, 1 Apr 2014 15:30:53 +0300 Subject: Use asynchronous lock/unlock API The gralloc API now provides a way for using lock/unlock with the Android explicit synchronisation concept. This changes updates the GraphicBuffer class to also expose this functionality, and updates the Surface class to make use of in line with the dequeueBuffer/queueBuffer mechanism. This new behaviour is dependent on GRALLOC_MODULE_API_VERSION_0_3. If the local gralloc module does not support this then the existing synchronous lock/unlock mechanism will be used. Change-Id: I77daa1beb197b63b1c2f281b8414ac4ae4b5b03c --- include/ui/GraphicBuffer.h | 5 +++++ include/ui/GraphicBufferMapper.h | 8 ++++++++ 2 files changed, 13 insertions(+) (limited to 'include') diff --git a/include/ui/GraphicBuffer.h b/include/ui/GraphicBuffer.h index 3cf628c..b973c40 100644 --- a/include/ui/GraphicBuffer.h +++ b/include/ui/GraphicBuffer.h @@ -97,6 +97,11 @@ public: status_t lockYCbCr(uint32_t usage, android_ycbcr *ycbcr); status_t lockYCbCr(uint32_t usage, const Rect& rect, android_ycbcr *ycbcr); status_t unlock(); + status_t lockAsync(uint32_t usage, void** vaddr, int fenceFd); + status_t lockAsync(uint32_t usage, const Rect& rect, void** vaddr, int fenceFd); + status_t lockAsyncYCbCr(uint32_t usage, android_ycbcr *ycbcr, int fenceFd); + status_t lockAsyncYCbCr(uint32_t usage, const Rect& rect, android_ycbcr *ycbcr, int fenceFd); + status_t unlockAsync(int *fenceFd); ANativeWindowBuffer* getNativeBuffer() const; diff --git a/include/ui/GraphicBufferMapper.h b/include/ui/GraphicBufferMapper.h index 99d8723..98fff0e 100644 --- a/include/ui/GraphicBufferMapper.h +++ b/include/ui/GraphicBufferMapper.h @@ -49,6 +49,14 @@ public: int usage, const Rect& bounds, android_ycbcr *ycbcr); status_t unlock(buffer_handle_t handle); + + status_t lockAsync(buffer_handle_t handle, + int usage, const Rect& bounds, void** vaddr, int fenceFd); + + status_t lockAsyncYCbCr(buffer_handle_t handle, + int usage, const Rect& bounds, android_ycbcr *ycbcr, int fenceFd); + + status_t unlockAsync(buffer_handle_t handle, int *fenceFd); // dumps information about the mapping of this handle void dump(buffer_handle_t handle); -- cgit v1.1