From bc2df65a3f3f4b8abaaaa2a4e576a3a42c2d30f3 Mon Sep 17 00:00:00 2001 From: Eino-Ville Talvala Date: Thu, 21 Jul 2016 17:06:58 -0700 Subject: BufferQueue consumers: Add discardFreeBuffer method This method releases all free buffers owned by the buffer queue, in order to save memory (at the cost of potential future reallocation of buffers). Bug: 28695173 Change-Id: I458d10373e639e3144faf673af2ba01aca36e65a --- libs/gui/BufferQueueConsumer.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'libs/gui/BufferQueueConsumer.cpp') diff --git a/libs/gui/BufferQueueConsumer.cpp b/libs/gui/BufferQueueConsumer.cpp index e8860d12fe..ca2a374e16 100644 --- a/libs/gui/BufferQueueConsumer.cpp +++ b/libs/gui/BufferQueueConsumer.cpp @@ -725,6 +725,12 @@ status_t BufferQueueConsumer::getOccupancyHistory(bool forceFlush, return NO_ERROR; } +status_t BufferQueueConsumer::discardFreeBuffers() { + Mutex::Autolock lock(mCore->mMutex); + mCore->discardFreeBuffersLocked(); + return NO_ERROR; +} + void BufferQueueConsumer::dump(String8& result, const char* prefix) const { const IPCThreadState* ipc = IPCThreadState::self(); const pid_t pid = ipc->getCallingPid(); -- cgit v1.2.3-59-g8ed1b