diff options
author | Dan Stoza <stoza@google.com> | 2015-04-28 14:42:06 -0700 |
---|---|---|
committer | Dan Stoza <stoza@google.com> | 2015-04-30 15:29:05 -0700 |
commit | 2e36f2283f48ab764b496490c73a132acf21df3a (patch) | |
tree | 9c6a951420250a966b71b12317927c4d1d49114d /include | |
parent | 8de71a2408f632407c25942a39c31f78c7f64ffd (diff) | |
download | frameworks_native-2e36f2283f48ab764b496490c73a132acf21df3a.zip frameworks_native-2e36f2283f48ab764b496490c73a132acf21df3a.tar.gz frameworks_native-2e36f2283f48ab764b496490c73a132acf21df3a.tar.bz2 |
SurfaceFlinger: Fix PTS on stale buffers
SurfaceFlinger's (Layer's) shadow copy of the BufferQueue queue was
getting out of sync for a few reasons. This change fixes these by
doing the following:
- Adds a check to re-synchronize the shadow copy every time we
successfully acquire a buffer by first dropping stale buffers before
removing the current buffer.
- Avoids trying to perform updates for buffers which have been rejected
(for incorrect dimensions) by SurfaceFlinger.
- Adds IGraphicBufferConsumer::setShadowQueueSize, which allows the
consumer to notify the BufferQueue that it is maintaining a shadow
copy of the queue and prevents it from dropping so many buffers
during acquireBuffer that it ends up returning a buffer for which the
consumer has not yet received an onFrameAvailable call.
Bug: 20096136
Change-Id: I78d0738428005fc19b3be85cc8f1db498043612f
Diffstat (limited to 'include')
-rw-r--r-- | include/gui/BufferQueueConsumer.h | 3 | ||||
-rw-r--r-- | include/gui/BufferQueueCore.h | 7 | ||||
-rw-r--r-- | include/gui/IGraphicBufferConsumer.h | 5 |
3 files changed, 15 insertions, 0 deletions
diff --git a/include/gui/BufferQueueConsumer.h b/include/gui/BufferQueueConsumer.h index 9c91fc7..0f42613 100644 --- a/include/gui/BufferQueueConsumer.h +++ b/include/gui/BufferQueueConsumer.h @@ -148,6 +148,9 @@ public: // Retrieve the sideband buffer stream, if any. virtual sp<NativeHandle> getSidebandStream() const; + // See IGraphicBufferConsumer::setShadowQueueSize + virtual void setShadowQueueSize(size_t size); + // dump our state in a String virtual void dump(String8& result, const char* prefix) const; diff --git a/include/gui/BufferQueueCore.h b/include/gui/BufferQueueCore.h index e3624b7..a22015c 100644 --- a/include/gui/BufferQueueCore.h +++ b/include/gui/BufferQueueCore.h @@ -274,6 +274,13 @@ private: // mBufferAge tracks the age of the contents of the most recently dequeued // buffer as the number of frames that have elapsed since it was last queued uint64_t mBufferAge; + + // mConsumerHasShadowQueue determines if acquireBuffer should be more + // cautious about dropping buffers so that it always returns a buffer that + // is represented in the consumer's shadow queue. + bool mConsumerHasShadowQueue; + size_t mConsumerShadowQueueSize; + }; // class BufferQueueCore } // namespace android diff --git a/include/gui/IGraphicBufferConsumer.h b/include/gui/IGraphicBufferConsumer.h index 8f31b55..0be09a2 100644 --- a/include/gui/IGraphicBufferConsumer.h +++ b/include/gui/IGraphicBufferConsumer.h @@ -248,6 +248,11 @@ public: // Retrieve the sideband buffer stream, if any. virtual sp<NativeHandle> getSidebandStream() const = 0; + // setShadowQueueSize notifies the BufferQueue that the consumer is + // shadowing its queue and allows it to limit the number of buffers it is + // permitted to drop during acquire so as to not get out of sync. + virtual void setShadowQueueSize(size_t size) = 0; + // dump state into a string virtual void dump(String8& result, const char* prefix) const = 0; |