From a5b7513711555c8681eb9391cfafe30fb7d6dd3d Mon Sep 17 00:00:00 2001 From: Igor Murashkin Date: Wed, 14 Aug 2013 18:49:12 -0700 Subject: [PATCH] gui: CpuConsumer::lockNextBuffer change return code when too many bufs acquired - Return NOT_ENOUGH_DATA instead of INVALID_OPERATION when too many buffers have already been locked. - INVALID_OPERATION is nominally used when something irrecoverable happens, but in this case the client just needs to call unlockBuffer to go back into a good state. Bug: 10333400 Change-Id: I3a034d77de85741429f832a90eedd670afa1dc94 --- include/gui/CpuConsumer.h | 2 +- libs/gui/CpuConsumer.cpp | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/include/gui/CpuConsumer.h b/include/gui/CpuConsumer.h index 9290676ca..6f4c2ec1e 100644 --- a/include/gui/CpuConsumer.h +++ b/include/gui/CpuConsumer.h @@ -90,7 +90,7 @@ class CpuConsumer : public ConsumerBase // Gets the next graphics buffer from the producer and locks it for CPU use, // filling out the passed-in locked buffer structure with the native pointer // and metadata. Returns BAD_VALUE if no new buffer is available, and - // INVALID_OPERATION if the maximum number of buffers is already locked. + // NOT_ENOUGH_DATA if the maximum number of buffers is already locked. // // Only a fixed number of buffers can be locked at a time, determined by the // construction-time maxLockedBuffers parameter. If INVALID_OPERATION is diff --git a/libs/gui/CpuConsumer.cpp b/libs/gui/CpuConsumer.cpp index 3db46bceb..bff55d1b0 100644 --- a/libs/gui/CpuConsumer.cpp +++ b/libs/gui/CpuConsumer.cpp @@ -72,7 +72,9 @@ status_t CpuConsumer::lockNextBuffer(LockedBuffer *nativeBuffer) { if (!nativeBuffer) return BAD_VALUE; if (mCurrentLockedBuffers == mMaxLockedBuffers) { - return INVALID_OPERATION; + CC_LOGW("Max buffers have been locked (%d), cannot lock anymore.", + mMaxLockedBuffers); + return NOT_ENOUGH_DATA; } BufferQueue::BufferItem b;