summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorandroid-build-team Robot <android-build-team-robot@google.com>2017-06-16 17:21:50 +0000
committerandroid-build-team Robot <android-build-team-robot@google.com>2017-06-16 17:21:50 +0000
commit3b97b3eea90b63a2f6f6e2dcd81f5a7ccf0a0729 (patch)
treeb9b66071b0dc06a9a7c649447275798db197c8b0
parentc84df654377f0a16be74399f46af6abd3af7e82f (diff)
parentca1a1094a8262d5a41b660570cf6121b26d2d8aa (diff)
downloadnative-nougat-mr2.3-release.tar.gz
Merge cherrypicks of [2419615, 2419671, 2419656, 2419633, 2419709, 2419634, 2419635, 2419617, 2419618, 2419619, 2419658, 2419697, 2419659, 2419673, 2419726, 2419747, 2419596, 2419748, 2419597, 2419636, 2419711, 2419749, 2419660, 2419713, 2419714, 2419727, 2419674, 2419782, 2419752, 2419731, 2419732, 2419677, 2419717, 2419734, 2419784] into nyc-mr2-security-c-releaseandroid-7.1.2_r33nougat-mr2.3-release
Change-Id: I8ad2f36ffeb8ead54643cf3d7707099f422df47c
-rw-r--r--libs/gui/BufferQueueProducer.cpp20
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;
}