summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMathias Agopian <mathias@google.com>2011-01-18 15:51:30 -0800
committerMathias Agopian <mathias@google.com>2011-01-18 15:51:30 -0800
commit2e102a05ca24c15921795d3bc320ade8353319bb (patch)
tree2741969af9c9126585d6634dfe92c07b444c7e55
parent48395385039a0c845bba8913c8d0c76981425aa4 (diff)
downloadframeworks_base-2e102a05ca24c15921795d3bc320ade8353319bb.zip
frameworks_base-2e102a05ca24c15921795d3bc320ade8353319bb.tar.gz
frameworks_base-2e102a05ca24c15921795d3bc320ade8353319bb.tar.bz2
fix [3361121] hang in glClear() - device unresponsive, OTA fails
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. Change-Id: I1f226b1ebdf6918439b687c2723955d55b842c55
-rw-r--r--libs/surfaceflinger_client/SharedBufferStack.cpp3
1 files changed, 1 insertions, 2 deletions
diff --git a/libs/surfaceflinger_client/SharedBufferStack.cpp b/libs/surfaceflinger_client/SharedBufferStack.cpp
index 3b2ef84..af11f97 100644
--- a/libs/surfaceflinger_client/SharedBufferStack.cpp
+++ b/libs/surfaceflinger_client/SharedBufferStack.cpp
@@ -261,8 +261,7 @@ bool SharedBufferClient::LockCondition::operator()() const {
// NOTE: if stack.head is messed up, we could crash the client
// or cause some drawing artifacts. This is okay, as long as it is
// limited to the client.
- return (buf != stack.index[stack.head] ||
- (stack.queued > 0 && stack.inUse != buf));
+ return (buf != stack.index[stack.head]);
}
SharedBufferServer::BuffersAvailableCondition::BuffersAvailableCondition(