From b5c4577b887ccc06f39b82c8216995ee2aa5d60d Mon Sep 17 00:00:00 2001 From: Mathias Agopian Date: Mon, 17 May 2010 18:54:19 -0700 Subject: fix a bug where queueBuffer() would fail after the SharedbufferStack is resized Change-Id: I12bf13a62018ce1349bab7be0b0cad7fad13fee8 --- libs/surfaceflinger_client/SharedBufferStack.cpp | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) (limited to 'libs') diff --git a/libs/surfaceflinger_client/SharedBufferStack.cpp b/libs/surfaceflinger_client/SharedBufferStack.cpp index 5705748..dab8ed8 100644 --- a/libs/surfaceflinger_client/SharedBufferStack.cpp +++ b/libs/surfaceflinger_client/SharedBufferStack.cpp @@ -182,10 +182,22 @@ String8 SharedBufferBase::dump(char const* prefix) const int tail = computeTail(); snprintf(buffer, SIZE, "%s[ head=%2d, available=%2d, queued=%2d, tail=%2d ] " - "reallocMask=%08x, inUse=%2d, identity=%d, status=%d\n", + "reallocMask=%08x, inUse=%2d, identity=%d, status=%d", prefix, stack.head, stack.available, stack.queued, tail, stack.reallocMask, stack.inUse, stack.identity, stack.status); result.append(buffer); + + snprintf(buffer, SIZE, " { "); + result.append(buffer); + + for (int i=0 ; i= mNumBuffers) ? 0 : queued_head+1); + queued_head = (queued_head + 1) % mNumBuffers; stack.index[queued_head] = buf; QueueUpdate update(this); @@ -449,9 +462,11 @@ status_t SharedBufferClient::setDirtyRegion(int buf, const Region& reg) status_t SharedBufferClient::setBufferCount(int bufferCount) { + SharedBufferStack& stack( *mSharedStack ); if (uint32_t(bufferCount) >= NUM_BUFFER_MAX) return BAD_VALUE; mNumBuffers = bufferCount; + queued_head = (stack.head + stack.queued) % mNumBuffers; return NO_ERROR; } -- cgit v1.1