diff options
author | Mathias Agopian <mathias@google.com> | 2011-01-18 15:51:30 -0800 |
---|---|---|
committer | Mathias Agopian <mathias@google.com> | 2011-01-25 14:19:13 -0800 |
commit | 21956040a77808909ebda426fbd3cce6c8ed059f (patch) | |
tree | caef5eb4375780074435043e54323cd256c07dfc /include | |
parent | 68d3478860fecc9b8fbf256796a832a037434555 (diff) | |
download | frameworks_base-21956040a77808909ebda426fbd3cce6c8ed059f.zip frameworks_base-21956040a77808909ebda426fbd3cce6c8ed059f.tar.gz frameworks_base-21956040a77808909ebda426fbd3cce6c8ed059f.tar.bz2 |
fix [3361121] hang in glClear() - device unresponsive, OTA fails (DO NOT MERGE)
Generally we never want to lock a buffer for write access if it is at
the "head" on the surfaceflinger side. The only exception (1) is when
the buffer is not currently in use AND there is at least one queued
buffer -- in which case, SurfaceFlinger will never use said buffer
anymore, because on the next composition around, it will be able to
retire the first queued buffer.
The logic above relies on SurfaceFlinger always retiring
and locking a buffer before composition -- unfortunately this
didn't happen during a screenshot.
This could leave us in a situation where a buffer is locked by the
application for write, and used by SurfaceFlinger for texturing,
causing a hang.
Here, we fix this issue by never assuming the exception (1), it was
intended as an optimization allowing ANativeWindow::lockBuffer() to
return sooner and was justified when most of SF composition was
done in software. The actual buffer locking is now ensured by
gralloc. We could have handled screenshots in a similar way to
a regular composition, but it could have caused glitches on screen,
essentially, taking a screenshot could cause to skip a frame.
now that we removed the notion of a "inUse" buffer in surfaceflinger
a lot of code can be simplified / removed.
noteworthy, the whole concept of "unlockClient" wrt. "compositionComplete"
is also gone.
Diffstat (limited to 'include')
-rw-r--r-- | include/private/surfaceflinger/SharedBufferStack.h | 8 |
1 files changed, 1 insertions, 7 deletions
diff --git a/include/private/surfaceflinger/SharedBufferStack.h b/include/private/surfaceflinger/SharedBufferStack.h index d6ae5e9..4ae3cdf 100644 --- a/include/private/surfaceflinger/SharedBufferStack.h +++ b/include/private/surfaceflinger/SharedBufferStack.h @@ -105,7 +105,7 @@ public: volatile int32_t head; // server's current front buffer volatile int32_t available; // number of dequeue-able buffers volatile int32_t queued; // number of buffers waiting for post - volatile int32_t inUse; // buffer currently in use by SF + volatile int32_t reserved1; volatile status_t status; // surface's status code // not part of the conditions @@ -275,7 +275,6 @@ public: int32_t identity); ssize_t retireAndLock(); - status_t unlock(int buffer); void setStatus(status_t status); status_t reallocateAll(); status_t reallocateAllExcept(int buffer); @@ -346,11 +345,6 @@ private: int mNumBuffers; BufferList mBufferList; - struct UnlockUpdate : public UpdateBase { - const int lockedBuffer; - inline UnlockUpdate(SharedBufferBase* sbb, int lockedBuffer); - inline ssize_t operator()(); - }; struct RetireUpdate : public UpdateBase { const int numBuffers; |