@@ -58,7 +58,6 @@ SharedBufferStack::SharedBufferStack()
5858
5959void SharedBufferStack::init (int32_t i)
6060{
61- inUse = -2 ;
6261 status = NO_ERROR;
6362 identity = i;
6463}
@@ -199,9 +198,9 @@ String8 SharedBufferBase::dump(char const* prefix) const
199198 SharedBufferStack& stack ( *mSharedStack );
200199 snprintf (buffer, SIZE,
201200 " %s[ head=%2d, available=%2d, queued=%2d ] "
202- " reallocMask=%08x, inUse=%2d, identity=%d, status=%d" ,
201+ " reallocMask=%08x, identity=%d, status=%d" ,
203202 prefix, stack.head , stack.available , stack.queued ,
204- stack.reallocMask , stack.inUse , stack. identity , stack.status );
203+ stack.reallocMask , stack.identity , stack.status );
205204 result.append (buffer);
206205 result.append (" \n " );
207206 return result;
@@ -261,8 +260,7 @@ bool SharedBufferClient::LockCondition::operator()() const {
261260 // NOTE: if stack.head is messed up, we could crash the client
262261 // or cause some drawing artifacts. This is okay, as long as it is
263262 // limited to the client.
264- return (buf != stack.index [stack.head ] ||
265- (stack.queued > 0 && stack.inUse != buf));
263+ return (buf != stack.index [stack.head ]);
266264}
267265
268266// ----------------------------------------------------------------------------
@@ -295,22 +293,6 @@ ssize_t SharedBufferClient::CancelUpdate::operator()() {
295293 return NO_ERROR;
296294}
297295
298- SharedBufferServer::UnlockUpdate::UnlockUpdate (
299- SharedBufferBase* sbb, int lockedBuffer)
300- : UpdateBase(sbb), lockedBuffer(lockedBuffer) {
301- }
302- ssize_t SharedBufferServer::UnlockUpdate::operator ()() {
303- if (stack.inUse != lockedBuffer) {
304- LOGE (" unlocking %d, but currently locked buffer is %d "
305- " (identity=%d, token=%d)" ,
306- lockedBuffer, stack.inUse ,
307- stack.identity , stack.token );
308- return BAD_VALUE;
309- }
310- android_atomic_write (-1 , &stack.inUse );
311- return NO_ERROR;
312- }
313-
314296SharedBufferServer::RetireUpdate::RetireUpdate (
315297 SharedBufferBase* sbb, int numBuffers)
316298 : UpdateBase(sbb), numBuffers(numBuffers) {
@@ -320,9 +302,6 @@ ssize_t SharedBufferServer::RetireUpdate::operator()() {
320302 if (uint32_t (head) >= SharedBufferStack::NUM_BUFFER_MAX)
321303 return BAD_VALUE;
322304
323- // Preventively lock the current buffer before updating queued.
324- android_atomic_write (stack.headBuf , &stack.inUse );
325-
326305 // Decrement the number of queued buffers
327306 int32_t queued;
328307 do {
@@ -338,7 +317,6 @@ ssize_t SharedBufferServer::RetireUpdate::operator()() {
338317 head = (head + 1 ) % numBuffers;
339318 const int8_t headBuf = stack.index [head];
340319 stack.headBuf = headBuf;
341- android_atomic_write (headBuf, &stack.inUse );
342320
343321 // head is only modified here, so we don't need to use cmpxchg
344322 android_atomic_write (head, &stack.head );
@@ -542,13 +520,6 @@ ssize_t SharedBufferServer::retireAndLock()
542520 return buf;
543521}
544522
545- status_t SharedBufferServer::unlock (int buf)
546- {
547- UnlockUpdate update (this , buf);
548- status_t err = updateCondition ( update );
549- return err;
550- }
551-
552523void SharedBufferServer::setStatus (status_t status)
553524{
554525 if (status < NO_ERROR) {
0 commit comments