summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorandroid-build-team Robot <android-build-team-robot@google.com>2017-06-16 18:46:07 +0000
committerandroid-build-team Robot <android-build-team-robot@google.com>2017-06-16 18:46:07 +0000
commit25ce0cc2f63eb505878965724cdf0698a694dda1 (patch)
tree9827260541fdbcb505d58be8b86fc02739056a69
parent3a0af0475f3f92e8fc5153116b02c1143501c92e (diff)
parentacb44f42a1999bdb1238987079d04cf47d500eb5 (diff)
downloadnative-nougat-mr1.1-release.tar.gz
Merge cherrypicks of [2420241, 2420242, 2420222, 2420190, 2420097, 2420079, 2420098, 2420099, 2420100, 2420153, 2420120, 2420208, 2420281, 2420209, 2420282, 2420301, 2420192, 2420302, 2420193, 2420211, 2420264, 2420247, 2420157, 2420265, 2420216, 2420307, 2420217, 2420250, 2420341, 2420219, 2420326, 2420180, 2420254] into nyc-mr1-security-a-releaseandroid-7.1.1_r54android-7.1.1_r51android-7.1.1_r47nougat-mr1.1-release
Change-Id: I6208f2a8c884e6a12e16d8c86c77efbfae77fdea
-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 05923b5d35..ce4778435f 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;
}