diff options
| author | 2013-08-16 14:55:39 -0700 | |
|---|---|---|
| committer | 2013-08-16 15:15:16 -0700 | |
| commit | 3c25621ad7d13f64d3ab95a27fa970fbc9998f73 (patch) | |
| tree | 2115e7f38faf3ac66c885f9be003d2fc1082220a /libs/gui/BufferQueue.cpp | |
| parent | a33b62cc4700c68a3481d415a55e1a7b688981e1 (diff) | |
Re-enable frame dropping for non-auto timestamps
This change adds an entire field to note whether the timestamp was
auto-generated by Surface or supplied by the application.
The value is used when deciding whether or not to drop frames based
on buffer presentation timestamps. If a desired presentation time
was set explicitly, BufferQueue will use that value to decide if a
frame should be dropped. If the timestamp was generated by Surface
at the time the buffer was queued, the timestamp is ignored.
Bug 10151804
Change-Id: Ibd571a7578351063b813cbdad2ddbeed70655ba5
Diffstat (limited to 'libs/gui/BufferQueue.cpp')
| -rw-r--r-- | libs/gui/BufferQueue.cpp | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/libs/gui/BufferQueue.cpp b/libs/gui/BufferQueue.cpp index 033c2a6c45..65007fa24a 100644 --- a/libs/gui/BufferQueue.cpp +++ b/libs/gui/BufferQueue.cpp @@ -475,10 +475,12 @@ status_t BufferQueue::queueBuffer(int buf, uint32_t transform; int scalingMode; int64_t timestamp; + bool isAutoTimestamp; bool async; sp<Fence> fence; - input.deflate(×tamp, &crop, &scalingMode, &transform, &async, &fence); + input.deflate(×tamp, &isAutoTimestamp, &crop, &scalingMode, &transform, + &async, &fence); if (fence == NULL) { ST_LOGE("queueBuffer: fence is NULL"); @@ -558,6 +560,7 @@ status_t BufferQueue::queueBuffer(int buf, item.mTransform = transform; item.mScalingMode = scalingMode; item.mTimestamp = timestamp; + item.mIsAutoTimestamp = isAutoTimestamp; item.mFrameNumber = mFrameCounter; item.mBuf = buf; item.mFence = fence; @@ -860,7 +863,12 @@ status_t BufferQueue::acquireBuffer(BufferItem *buffer, nsecs_t expectedPresent) // // NOTE: code assumes monotonic time values from the system clock are // positive. - while (false && mQueue.size() > 1) { + + // Start by checking to see if we can drop frames. We skip this check + // if the timestamps are being auto-generated by Surface -- if the + // app isn't generating timestamps explicitly, they probably don't + // want frames to be discarded based on them. + while (mQueue.size() > 1 && !mQueue[0].mIsAutoTimestamp) { // If entry[1] is timely, drop entry[0] (and repeat). We apply // an additional criteria here: we only drop the earlier buffer if // our desiredPresent falls within +/- 1 second of the expected |