diff options
author | Igor Murashkin <iam@google.com> | 2013-05-23 13:45:08 -0700 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2013-05-23 13:45:08 -0700 |
commit | 599d83e4f2197968d77d3d106630179c88c8a6d7 (patch) | |
tree | 79d76fbef655811bc99d495cf520ba4fc5c16ffb /services/camera | |
parent | 7d7bb975026a3b428101cdea11e2d94605f845c1 (diff) | |
parent | 9b89c15d9d8abb9408760ffdb022df4c4367685b (diff) | |
download | frameworks_av-599d83e4f2197968d77d3d106630179c88c8a6d7.zip frameworks_av-599d83e4f2197968d77d3d106630179c88c8a6d7.tar.gz frameworks_av-599d83e4f2197968d77d3d106630179c88c8a6d7.tar.bz2 |
am 9b89c15d: am ca3fb120: Merge "camera3: Fix zsl buffers released-while-in-use race condition" into jb-mr2-dev
* commit '9b89c15d9d8abb9408760ffdb022df4c4367685b':
camera3: Fix zsl buffers released-while-in-use race condition
Diffstat (limited to 'services/camera')
-rw-r--r-- | services/camera/libcameraservice/camera2/ZslProcessor3.cpp | 2 | ||||
-rw-r--r-- | services/camera/libcameraservice/gui/RingBufferConsumer.cpp | 30 |
2 files changed, 20 insertions, 12 deletions
diff --git a/services/camera/libcameraservice/camera2/ZslProcessor3.cpp b/services/camera/libcameraservice/camera2/ZslProcessor3.cpp index af3e266..2e06691 100644 --- a/services/camera/libcameraservice/camera2/ZslProcessor3.cpp +++ b/services/camera/libcameraservice/camera2/ZslProcessor3.cpp @@ -413,6 +413,8 @@ nsecs_t ZslProcessor3::getCandidateTimestampLocked(size_t* metadataIdx) const { minTimestamp = frameTimestamp; idx = j; } + + ALOGVV("%s: Saw timestamp %lld", __FUNCTION__, frameTimestamp); } } diff --git a/services/camera/libcameraservice/gui/RingBufferConsumer.cpp b/services/camera/libcameraservice/gui/RingBufferConsumer.cpp index 2fa78a4..cd39bad 100644 --- a/services/camera/libcameraservice/gui/RingBufferConsumer.cpp +++ b/services/camera/libcameraservice/gui/RingBufferConsumer.cpp @@ -101,12 +101,6 @@ sp<PinnedBufferItem> RingBufferConsumer::pinSelectedBuffer( } // end scope of mMutex autolock - if (pinnedBuffer != 0) { - BI_LOGV("Pinned buffer frame %lld, timestamp %lld", - pinnedBuffer->getBufferItem().mFrameNumber, - pinnedBuffer->getBufferItem().mTimestamp); - } - if (waitForFence) { status_t err = pinnedBuffer->getBufferItem().mFence->waitForever( "RingBufferConsumer::pinSelectedBuffer"); @@ -172,6 +166,9 @@ void RingBufferConsumer::pinBufferLocked(const BufferItem& item) { if (it == end) { BI_LOGE("Failed to pin buffer (timestamp %lld, framenumber %lld)", item.mTimestamp, item.mFrameNumber); + } else { + BI_LOGV("Pinned buffer (frame %lld, timestamp %lld)", + item.mFrameNumber, item.mTimestamp); } } @@ -182,7 +179,7 @@ status_t RingBufferConsumer::releaseOldestBufferLocked(size_t* pinnedFrames) { it = mBufferItemList.begin(); end = mBufferItemList.end(); - accIt = it; + accIt = end; if (it == end) { /** @@ -197,12 +194,17 @@ status_t RingBufferConsumer::releaseOldestBufferLocked(size_t* pinnedFrames) { for (; it != end; ++it) { RingBufferItem& find = *it; - if (find.mTimestamp < accIt->mTimestamp && find.mPinCount <= 0) { - accIt = it; + + if (find.mPinCount > 0) { + if (pinnedFrames != NULL) { + ++(*pinnedFrames); + } + // Filter out pinned frame when searching for buffer to release + continue; } - if (find.mPinCount > 0 && pinnedFrames != NULL) { - ++(*pinnedFrames); + if (find.mTimestamp < accIt->mTimestamp || accIt == end) { + accIt = it; } } @@ -323,7 +325,11 @@ void RingBufferConsumer::unpinBuffer(const BufferItem& item) { } if (it == end) { - BI_LOGE("Failed to unpin buffer (timestamp %lld, framenumber %lld", + // This should never happen. If it happens, we have a bug. + BI_LOGE("Failed to unpin buffer (timestamp %lld, framenumber %lld)", + item.mTimestamp, item.mFrameNumber); + } else { + BI_LOGV("Unpinned buffer (timestamp %lld, framenumber %lld)", item.mTimestamp, item.mFrameNumber); } } |