diff options
author | Taiju Tsuiki <tzik@google.com> | 2015-04-30 22:13:14 +0900 |
---|---|---|
committer | Dan Stoza <stoza@google.com> | 2015-04-30 09:58:31 -0700 |
commit | 84f1d9c288f35fa399f97207b6af43a261d5989a (patch) | |
tree | 59f4f29baa586d63dadbd08a0c84245dbbdec7f3 | |
parent | 7a6c5861619ab42f2a34903591ed24a265f68c26 (diff) | |
download | frameworks_native-84f1d9c288f35fa399f97207b6af43a261d5989a.zip frameworks_native-84f1d9c288f35fa399f97207b6af43a261d5989a.tar.gz frameworks_native-84f1d9c288f35fa399f97207b6af43a261d5989a.tar.bz2 |
Avoid closing invalid FD in Surface and GraphicBufferMapper
GraphicBufferMapper::lockAsync{,YCbCr} close the fence FD even when the FD
is invalid.
Change-Id: Ia2b4dae3b2c06426e34f623f19ba92435f486ab7
(cherry picked from commit dcfe91e1f3f15b68793a69650f9bd0ca6a58ff4c)
-rw-r--r-- | libs/ui/GraphicBufferMapper.cpp | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/libs/ui/GraphicBufferMapper.cpp b/libs/ui/GraphicBufferMapper.cpp index 31bfb2d..b03e8d6 100644 --- a/libs/ui/GraphicBufferMapper.cpp +++ b/libs/ui/GraphicBufferMapper.cpp @@ -131,8 +131,10 @@ status_t GraphicBufferMapper::lockAsync(buffer_handle_t handle, bounds.left, bounds.top, bounds.width(), bounds.height(), vaddr, fenceFd); } else { - sync_wait(fenceFd, -1); - close(fenceFd); + if (fenceFd >= 0) { + sync_wait(fenceFd, -1); + close(fenceFd); + } err = mAllocMod->lock(mAllocMod, handle, static_cast<int>(usage), bounds.left, bounds.top, bounds.width(), bounds.height(), vaddr); @@ -154,8 +156,10 @@ status_t GraphicBufferMapper::lockAsyncYCbCr(buffer_handle_t handle, static_cast<int>(usage), bounds.left, bounds.top, bounds.width(), bounds.height(), ycbcr, fenceFd); } else if (mAllocMod->lock_ycbcr != NULL) { - sync_wait(fenceFd, -1); - close(fenceFd); + if (fenceFd >= 0) { + sync_wait(fenceFd, -1); + close(fenceFd); + } err = mAllocMod->lock_ycbcr(mAllocMod, handle, static_cast<int>(usage), bounds.left, bounds.top, bounds.width(), bounds.height(), ycbcr); |