Skip to content

Commit

Permalink
Merge tag 'android-7.1.2_r29' into cm-14.1
Browse files Browse the repository at this point in the history
Android 7.1.2 Release 29 (NJH47F)

# gpg: Signature made Fri 28 Jul 2017 01:56:01 PM CDT
# gpg:                using DSA key E8AD3F819AB10E78
# gpg: Can't check signature: No public key
  • Loading branch information
invisiblek authored and task650 committed Aug 11, 2017
1 parent 36f7856 commit 81d3446
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions libs/gui/BufferQueueProducer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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;
}
Expand Down

0 comments on commit 81d3446

Please sign in to comment.