summaryrefslogtreecommitdiffstats
path: root/libs/gui/include
diff options
context:
space:
mode:
authorTreeHugger Robot <treehugger-gerrit@google.com>2019-04-11 02:53:34 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2019-04-11 02:53:34 +0000
commita37a61c9a1781001511568d49e95b6fb24945756 (patch)
tree60d46c96fafbb98a9a34d5947e67635a1d8d5ced /libs/gui/include
parente5d92c3ff1ed3ab038631b076ddd00f8b92c913f (diff)
parent3249fb6a0d8dd1e2020884711ce7d078b913ee44 (diff)
downloadandroid_frameworks_native-a37a61c9a1781001511568d49e95b6fb24945756.tar.gz
android_frameworks_native-a37a61c9a1781001511568d49e95b6fb24945756.tar.bz2
android_frameworks_native-a37a61c9a1781001511568d49e95b6fb24945756.zip
Merge "BufferQueueProducer::queueBuffer may not drop buffers" into qt-dev
Diffstat (limited to 'libs/gui/include')
-rw-r--r--libs/gui/include/gui/BufferQueueCore.h10
-rw-r--r--libs/gui/include/gui/BufferQueueProducer.h3
-rw-r--r--libs/gui/include/gui/IGraphicBufferProducer.h8
3 files changed, 21 insertions, 0 deletions
diff --git a/libs/gui/include/gui/BufferQueueCore.h b/libs/gui/include/gui/BufferQueueCore.h
index 0e8028380..9c0ee99b5 100644
--- a/libs/gui/include/gui/BufferQueueCore.h
+++ b/libs/gui/include/gui/BufferQueueCore.h
@@ -226,6 +226,16 @@ private:
// consumer are controlled by the application.
bool mDequeueBufferCannotBlock;
+ // mQueueBufferCanDrop indicates whether queueBuffer is allowed to drop
+ // buffers in non-async mode. This flag is set during connect when both the
+ // producer and consumer are controlled by application.
+ bool mQueueBufferCanDrop;
+
+ // mLegacyBufferDrop indicates whether mQueueBufferCanDrop is in effect.
+ // If this flag is set mQueueBufferCanDrop is working as explained. If not
+ // queueBuffer will not drop buffers unless consumer is SurfaceFlinger.
+ bool mLegacyBufferDrop;
+
// mDefaultBufferFormat can be set so it will override the buffer format
// when it isn't specified in dequeueBuffer.
PixelFormat mDefaultBufferFormat;
diff --git a/libs/gui/include/gui/BufferQueueProducer.h b/libs/gui/include/gui/BufferQueueProducer.h
index 415e2a616..d2a47a6aa 100644
--- a/libs/gui/include/gui/BufferQueueProducer.h
+++ b/libs/gui/include/gui/BufferQueueProducer.h
@@ -174,6 +174,9 @@ public:
// See IGraphicBufferProducer::setDequeueTimeout
virtual status_t setDequeueTimeout(nsecs_t timeout) override;
+ // see IGraphicBufferProducer::setLegacyBufferDrop
+ virtual status_t setLegacyBufferDrop(bool drop);
+
// See IGraphicBufferProducer::getLastQueuedBuffer
virtual status_t getLastQueuedBuffer(sp<GraphicBuffer>* outBuffer,
sp<Fence>* outFence, float outTransformMatrix[16]) override;
diff --git a/libs/gui/include/gui/IGraphicBufferProducer.h b/libs/gui/include/gui/IGraphicBufferProducer.h
index 9f7e22bac..3dde8c8c8 100644
--- a/libs/gui/include/gui/IGraphicBufferProducer.h
+++ b/libs/gui/include/gui/IGraphicBufferProducer.h
@@ -592,12 +592,20 @@ public:
// non-blocking mode and its corresponding spare buffer (which is used to
// ensure a buffer is always available).
//
+ // Note well: queueBuffer will stop buffer dropping behavior if timeout is
+ // strictly positive. If timeout is zero or negative, previous buffer
+ // dropping behavior will not be changed.
+ //
// Return of a value other than NO_ERROR means an error has occurred:
// * BAD_VALUE - Failure to adjust the number of available slots. This can
// happen because of trying to allocate/deallocate the async
// buffer.
virtual status_t setDequeueTimeout(nsecs_t timeout) = 0;
+ // Used to enable/disable buffer drop behavior of queueBuffer.
+ // If it's not used, legacy drop behavior will be retained.
+ virtual status_t setLegacyBufferDrop(bool drop);
+
// Returns the last queued buffer along with a fence which must signal
// before the contents of the buffer are read. If there are no buffers in
// the queue, outBuffer will be populated with nullptr and outFence will be