From: Greg Hackmann Date: Fri, 9 May 2014 21:54:48 +0000 (+0000) Subject: am 4b46776f: am 8a6cd189: am f60564a1: Merge "Use asynchronous lock/unlock API" X-Git-Tag: android-x86-6.0-r1~797 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=02528cf6aaedbbfec55be57d33389e1c57d88245;p=android-x86%2Fframeworks-native.git am 4b46776f: am 8a6cd189: am f60564a1: Merge "Use asynchronous lock/unlock API" * commit '4b46776ff88c5a365700b88e8b2b04e1b2c77e6e': Use asynchronous lock/unlock API --- 02528cf6aaedbbfec55be57d33389e1c57d88245 diff --cc libs/ui/GraphicBuffer.cpp index 99601edc70,708888e458..e21dc53ca5 --- a/libs/ui/GraphicBuffer.cpp +++ b/libs/ui/GraphicBuffer.cpp @@@ -208,8 -200,54 +208,54 @@@ status_t GraphicBuffer::unlock( return res; } + status_t GraphicBuffer::lockAsync(uint32_t usage, void** vaddr, int fenceFd) + { + const Rect lockBounds(width, height); + status_t res = lockAsync(usage, lockBounds, vaddr, fenceFd); + return res; + } + + status_t GraphicBuffer::lockAsync(uint32_t usage, const Rect& rect, void** vaddr, int fenceFd) + { + if (rect.left < 0 || rect.right > this->width || + rect.top < 0 || rect.bottom > this->height) { + ALOGE("locking pixels (%d,%d,%d,%d) outside of buffer (w=%d, h=%d)", + rect.left, rect.top, rect.right, rect.bottom, + this->width, this->height); + return BAD_VALUE; + } + status_t res = getBufferMapper().lockAsync(handle, usage, rect, vaddr, fenceFd); + return res; + } + + status_t GraphicBuffer::lockAsyncYCbCr(uint32_t usage, android_ycbcr *ycbcr, int fenceFd) + { + const Rect lockBounds(width, height); + status_t res = lockAsyncYCbCr(usage, lockBounds, ycbcr, fenceFd); + return res; + } + + status_t GraphicBuffer::lockAsyncYCbCr(uint32_t usage, const Rect& rect, android_ycbcr *ycbcr, int fenceFd) + { + if (rect.left < 0 || rect.right > this->width || + rect.top < 0 || rect.bottom > this->height) { + ALOGE("locking pixels (%d,%d,%d,%d) outside of buffer (w=%d, h=%d)", + rect.left, rect.top, rect.right, rect.bottom, + this->width, this->height); + return BAD_VALUE; + } + status_t res = getBufferMapper().lockAsyncYCbCr(handle, usage, rect, ycbcr, fenceFd); + return res; + } + + status_t GraphicBuffer::unlockAsync(int *fenceFd) + { + status_t res = getBufferMapper().unlockAsync(handle, fenceFd); + return res; + } + size_t GraphicBuffer::getFlattenedSize() const { - return (8 + (handle ? handle->numInts : 0))*sizeof(int); + return (10 + (handle ? handle->numInts : 0))*sizeof(int); } size_t GraphicBuffer::getFdCount() const {