summaryrefslogtreecommitdiffstats
path: root/libs/gui/include
diff options
context:
space:
mode:
authorSungtak Lee <taklee@google.com>2019-03-02 16:40:47 -0800
committerSungtak Lee <taklee@google.com>2019-04-09 10:39:07 -0700
commit3249fb6a0d8dd1e2020884711ce7d078b913ee44 (patch)
tree30a1930e18425a84dea19867fe3656e79a9b0205 /libs/gui/include
parent3c9aec6db94841a5b16075923d22b38423dfa667 (diff)
downloadandroid_frameworks_native-3249fb6a0d8dd1e2020884711ce7d078b913ee44.tar.gz
android_frameworks_native-3249fb6a0d8dd1e2020884711ce7d078b913ee44.tar.bz2
android_frameworks_native-3249fb6a0d8dd1e2020884711ce7d078b913ee44.zip
BufferQueueProducer::queueBuffer may not drop buffers
Enable BufferQueueProducer::setDequeueTimeout retain existing dropping behavior. Setting negative and zero to setDequeueTimeout will not change existing dropping behavior. BufferQueueProducer::setLegacyBufferDrop can disable buffer dropping behavior of BufferQueueProducer::queueBuffer. If it's disabled, buffers will not be dropped unless consumer is SurfaceFlinger. Bug: 130039639 Change-Id: I8432a7ad386836498e632c67953ad49c6be008bb
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