diff options
author | android-build-team Robot <android-build-team-robot@google.com> | 2017-06-16 17:24:19 +0000 |
---|---|---|
committer | android-build-team Robot <android-build-team-robot@google.com> | 2017-06-16 17:24:19 +0000 |
commit | a64a9be05f4a2acba4095a0b2183aa38542a0d75 (patch) | |
tree | b9b66071b0dc06a9a7c649447275798db197c8b0 | |
parent | 2f398ff11c7657d7302bc7f8d1dc8ebb6adeff5c (diff) | |
parent | db6aa0b907ddab49d06dad67a664c786b3026dd1 (diff) | |
download | native-nougat-mr2.1-release.tar.gz |
Merge cherrypicks of [2419750, 2419599, 2419638, 2419698, 2419640, 2419699, 2419728, 2419801, 2419821, 2419763, 2419753, 2419600, 2419802, 2419783, 2419841, 2419822, 2419676, 2419754, 2419764, 2419729, 2419700, 2419765, 2419823, 2419730, 2419824, 2419755, 2419715, 2419716, 2419733, 2419829, 2419869, 2419870, 2419805, 2419871, 2419786] into nyc-mr2-security-a-releaseandroid-7.1.2_r30nougat-mr2.1-release
Change-Id: Ie8301d257a1ea7a4a13ee9b05982f6ae14d384f1
-rw-r--r-- | libs/gui/BufferQueueProducer.cpp | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/libs/gui/BufferQueueProducer.cpp b/libs/gui/BufferQueueProducer.cpp index b2169c84c7..ff85eb5ce8 100644 --- a/libs/gui/BufferQueueProducer.cpp +++ b/libs/gui/BufferQueueProducer.cpp @@ -921,7 +921,11 @@ status_t BufferQueueProducer::queueBuffer(int slot, // Call back without the main BufferQueue lock held, but with the callback // lock held so we can ensure that callbacks occur in order - { + + int connectedApi; + sp<Fence> lastQueuedFence; + + { // scope for the lock Mutex::Autolock lock(mCallbackMutex); while (callbackTicket != mCurrentCallbackTicket) { mCallbackCondition.wait(mCallbackMutex); @@ -933,20 +937,24 @@ status_t BufferQueueProducer::queueBuffer(int slot, frameReplacedListener->onFrameReplaced(item); } + connectedApi = mCore->mConnectedApi; + lastQueuedFence = std::move(mLastQueueBufferFence); + + mLastQueueBufferFence = std::move(fence); + mLastQueuedCrop = item.mCrop; + mLastQueuedTransform = item.mTransform; + ++mCurrentCallbackTicket; mCallbackCondition.broadcast(); } // Wait without lock held - if (mCore->mConnectedApi == NATIVE_WINDOW_API_EGL) { + if (connectedApi == NATIVE_WINDOW_API_EGL) { // Waiting here allows for two full buffers to be queued but not a // third. In the event that frames take varying time, this makes a // small trade-off in favor of latency rather than throughput. - mLastQueueBufferFence->waitForever("Throttling EGL Production"); + lastQueuedFence->waitForever("Throttling EGL Production"); } - mLastQueueBufferFence = fence; - mLastQueuedCrop = item.mCrop; - mLastQueuedTransform = item.mTransform; return NO_ERROR; } |