diff options
author | Mathias Agopian <mathias@google.com> | 2010-03-08 19:24:27 -0800 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2010-03-08 19:24:27 -0800 |
commit | 8d8a915a935378405fcf9978b83bd815ac5a265c (patch) | |
tree | 03c8c93c2ebce03a7100ea6c797ff5caac55b517 /libs | |
parent | ca14320fa28b818d755cff8f0c2ff4c780d30105 (diff) | |
parent | 4119c543024b4ae647b22a2da1422f8848a6ef7a (diff) | |
download | frameworks_base-8d8a915a935378405fcf9978b83bd815ac5a265c.zip frameworks_base-8d8a915a935378405fcf9978b83bd815ac5a265c.tar.gz frameworks_base-8d8a915a935378405fcf9978b83bd815ac5a265c.tar.bz2 |
Merge "Fix a small bug where we could compute SharedBufferStack's tail incorrectly."
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; } |