summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorandroid-build-team Robot <android-build-team-robot@google.com>2017-06-15 19:16:32 +0000
committerandroid-build-team Robot <android-build-team-robot@google.com>2017-06-15 19:16:32 +0000
commite3348505287230be0e8a9d33f47e158d5f6b7a1c (patch)
tree3fde11238ef0aea291136f297a639db5c15eb02c
parente8dbc1a3fa08d18cd327df2a5ceeb42d1923b1af (diff)
parent39dfabd43cbe57f92b771c0110a5c2d976b6c44f (diff)
downloadnative-e3348505287230be0e8a9d33f47e158d5f6b7a1c.tar.gz
Merge cherrypicks of [2413468, 2413357, 2413489, 2413431, 2413506, 2413398, 2413399, 2413319, 2413507, 2413508, 2413371, 2413410, 2413432, 2413358, 2413490, 2413359, 2413360, 2413320, 2413509, 2413491, 2414061, 2413372, 2413492, 2413433, 2413469, 2413411, 2414062, 2413373, 2413374, 2413470, 2413400, 2414063, 2414064, 2413447, 2413434, 2414101, 2413412] into nyc-mr2-releaseandroid-7.1.2_r28
Change-Id: I3468d071cdcf838e73b0317fa1b9e9df6d81a12d
-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;
}