summaryrefslogtreecommitdiffstats
path: root/libs/gui
diff options
context:
space:
mode:
authorJesse Hall <jessehall@google.com>2014-10-08 16:50:13 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2014-10-08 16:50:13 +0000
commitb7702c5ce7f010fa5f19646fd79f28ff04e7014b (patch)
treea136f4b0d5d05108b444f9315c9df2231b5b28e8 /libs/gui
parent5acc751ffea2fab38f7fcc4e06866640e70174e4 (diff)
parent99a0afbaee9eddabc2b544e3a5c432901c1d498c (diff)
downloadframeworks_native-b7702c5ce7f010fa5f19646fd79f28ff04e7014b.zip
frameworks_native-b7702c5ce7f010fa5f19646fd79f28ff04e7014b.tar.gz
frameworks_native-b7702c5ce7f010fa5f19646fd79f28ff04e7014b.tar.bz2
Merge "BufferQueueProducer: Throttle EGL frame production." into lmp-mr1-dev
Diffstat (limited to 'libs/gui')
-rw-r--r--libs/gui/BufferQueueProducer.cpp12
1 files changed, 11 insertions, 1 deletions
diff --git a/libs/gui/BufferQueueProducer.cpp b/libs/gui/BufferQueueProducer.cpp
index a53775f..03bd4fd 100644
--- a/libs/gui/BufferQueueProducer.cpp
+++ b/libs/gui/BufferQueueProducer.cpp
@@ -38,7 +38,8 @@ BufferQueueProducer::BufferQueueProducer(const sp<BufferQueueCore>& core) :
mCore(core),
mSlots(core->mSlots),
mConsumerName(),
- mStickyTransform(0) {}
+ mStickyTransform(0),
+ mLastQueueBufferFence(Fence::NO_FENCE) {}
BufferQueueProducer::~BufferQueueProducer() {}
@@ -644,6 +645,15 @@ status_t BufferQueueProducer::queueBuffer(int slot,
ATRACE_INT(mCore->mConsumerName.string(), mCore->mQueue.size());
} // Autolock scope
+ // Wait without lock held
+ if (mCore->mConnectedApi == 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");
+ mLastQueueBufferFence = fence;
+ }
+
// Call back without lock held
if (listener != NULL) {
listener->onFrameAvailable();