diff options
author | Mathias Agopian <mathias@google.com> | 2010-03-08 19:23:26 -0800 |
---|---|---|
committer | Mathias Agopian <mathias@google.com> | 2010-03-08 19:23:26 -0800 |
commit | 4119c543024b4ae647b22a2da1422f8848a6ef7a (patch) | |
tree | 259188a8db6b8d22d286ea14dd8fd989de5ae91e /libs | |
parent | 0e0b0c9e3d2c2edf8deff1f02b7856ad47db3ff9 (diff) | |
download | frameworks_base-4119c543024b4ae647b22a2da1422f8848a6ef7a.zip frameworks_base-4119c543024b4ae647b22a2da1422f8848a6ef7a.tar.gz frameworks_base-4119c543024b4ae647b22a2da1422f8848a6ef7a.tar.bz2 |
Fix a small bug where we could compute SharedBufferStack's tail incorrectly.
Also add "tail" to the debug dump().
Change-Id: I04b1ea375dfc9ddcc22f0c6b6cd01300e507572e
Diffstat (limited to 'libs')
-rw-r--r-- | libs/surfaceflinger_client/SharedBufferStack.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/libs/surfaceflinger_client/SharedBufferStack.cpp b/libs/surfaceflinger_client/SharedBufferStack.cpp index ceb5e59..65ce1c1 100644 --- a/libs/surfaceflinger_client/SharedBufferStack.cpp +++ b/libs/surfaceflinger_client/SharedBufferStack.cpp @@ -132,10 +132,11 @@ String8 SharedBufferBase::dump(char const* prefix) const char buffer[SIZE]; String8 result; SharedBufferStack& stack( *mSharedStack ); + int tail = (mNumBuffers + stack.head - stack.available + 1) % mNumBuffers; snprintf(buffer, SIZE, - "%s[ head=%2d, available=%2d, queued=%2d ] " + "%s[ head=%2d, available=%2d, queued=%2d, tail=%2d ] " "reallocMask=%08x, inUse=%2d, identity=%d, status=%d\n", - prefix, stack.head, stack.available, stack.queued, + prefix, stack.head, stack.available, stack.queued, tail, stack.reallocMask, stack.inUse, stack.identity, stack.status); result.append(buffer); return result; @@ -269,6 +270,8 @@ int32_t SharedBufferClient::computeTail() const newTail = head - avail + 1; if (newTail < 0) { newTail += mNumBuffers; + } else if (newTail >= mNumBuffers) { + newTail -= mNumBuffers; } return newTail; } |