summaryrefslogtreecommitdiffstats
path: root/include/gui
diff options
context:
space:
mode:
authorDan Stoza <stoza@google.com>2015-04-20 20:59:55 +0000
committerAndroid Git Automerger <android-git-automerger@android.com>2015-04-20 20:59:55 +0000
commit97ef903db12c72b24afba66c9971bbf35ec68de5 (patch)
tree826a3f3a16accd2369f279ad0ce7b6a9595a7e52 /include/gui
parentb85401d4badec20da60a588ee5d04cb139036a5d (diff)
parentaadb236d2e944791c1e7600eae9439fcb8a6caa9 (diff)
downloadframeworks_native-97ef903db12c72b24afba66c9971bbf35ec68de5.zip
frameworks_native-97ef903db12c72b24afba66c9971bbf35ec68de5.tar.gz
frameworks_native-97ef903db12c72b24afba66c9971bbf35ec68de5.tar.bz2
am aadb236d: am 483c76dc: am ff5c1a6b: Merge "libgui: Change BufferQueue to use free lists"
* commit 'aadb236d2e944791c1e7600eae9439fcb8a6caa9': libgui: Change BufferQueue to use free lists
Diffstat (limited to 'include/gui')
-rw-r--r--include/gui/BufferQueueCore.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/include/gui/BufferQueueCore.h b/include/gui/BufferQueueCore.h
index 40026bd..a6065a9 100644
--- a/include/gui/BufferQueueCore.h
+++ b/include/gui/BufferQueueCore.h
@@ -30,6 +30,9 @@
#include <utils/Trace.h>
#include <utils/Vector.h>
+#include <list>
+#include <set>
+
#define BQ_LOGV(x, ...) ALOGV("[%s] " x, mConsumerName.string(), ##__VA_ARGS__)
#define BQ_LOGD(x, ...) ALOGD("[%s] " x, mConsumerName.string(), ##__VA_ARGS__)
#define BQ_LOGI(x, ...) ALOGI("[%s] " x, mConsumerName.string(), ##__VA_ARGS__)
@@ -123,6 +126,10 @@ private:
// waitWhileAllocatingLocked blocks until mIsAllocating is false.
void waitWhileAllocatingLocked() const;
+ // validateConsistencyLocked ensures that the free lists are in sync with
+ // the information stored in mSlots
+ void validateConsistencyLocked() const;
+
// mAllocator is the connection to SurfaceFlinger that is used to allocate
// new GraphicBuffer objects.
sp<IGraphicBufferAlloc> mAllocator;
@@ -177,6 +184,14 @@ private:
// mQueue is a FIFO of queued buffers used in synchronous mode.
Fifo mQueue;
+ // mFreeSlots contains all of the slots which are FREE and do not currently
+ // have a buffer attached
+ std::set<int> mFreeSlots;
+
+ // mFreeBuffers contains all of the slots which are FREE and currently have
+ // a buffer attached
+ std::list<int> mFreeBuffers;
+
// mOverrideMaxBufferCount is the limit on the number of buffers that will
// be allocated at one time. This value is set by the producer by calling
// setBufferCount. The default is 0, which means that the producer doesn't