OSDN Git Service

am 38c9e132: am c1ffd351: am bd20e551: Merge "Use asynchronous lock/unlock API"
authorGreg Hackmann <ghackmann@google.com>
Mon, 12 May 2014 18:18:47 +0000 (18:18 +0000)
committerAndroid Git Automerger <android-git-automerger@android.com>
Mon, 12 May 2014 18:18:47 +0000 (18:18 +0000)
* commit '38c9e1327a5b24267c3dab5293bc9d7ada6e9fc9':
  Use asynchronous lock/unlock API

1  2 
include/ui/GraphicBuffer.h
libs/gui/Surface.cpp
libs/ui/GraphicBuffer.cpp

Simple merge
Simple merge
@@@ -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 {