summaryrefslogtreecommitdiffstats
path: root/libs/gui
diff options
context:
space:
mode:
authorJesse Hall <jessehall@google.com>2012-10-01 14:05:20 -0700
committerAndroid (Google) Code Review <android-gerrit@google.com>2012-10-02 16:29:46 -0700
commitba607d53c6a94ea8c4c12571980c4ad159af308b (patch)
tree80458eab2d99780520b25b83b5c09ea13461387c /libs/gui
parent2ae7bec77093744206080dbae020edfa3bfac2e1 (diff)
downloadframeworks_native-ba607d53c6a94ea8c4c12571980c4ad159af308b.zip
frameworks_native-ba607d53c6a94ea8c4c12571980c4ad159af308b.tar.gz
frameworks_native-ba607d53c6a94ea8c4c12571980c4ad159af308b.tar.bz2
Add Fence::waitForever which logs a warning timeout, and use it
Bug: 7217641 Change-Id: If0c1a613ead307c4045a47824174bf40c72bc7d7
Diffstat (limited to 'libs/gui')
-rw-r--r--libs/gui/BufferItemConsumer.cpp2
-rw-r--r--libs/gui/CpuConsumer.cpp2
-rw-r--r--libs/gui/SurfaceTexture.cpp3
-rw-r--r--libs/gui/SurfaceTextureClient.cpp13
4 files changed, 12 insertions, 8 deletions
diff --git a/libs/gui/BufferItemConsumer.cpp b/libs/gui/BufferItemConsumer.cpp
index 74b684f..fdfd15e 100644
--- a/libs/gui/BufferItemConsumer.cpp
+++ b/libs/gui/BufferItemConsumer.cpp
@@ -63,7 +63,7 @@ status_t BufferItemConsumer::acquireBuffer(BufferItem *item, bool waitForFence)
}
if (waitForFence && item->mFence.get()) {
- err = item->mFence->wait(Fence::TIMEOUT_NEVER);
+ err = item->mFence->waitForever(1000, "BufferItemConsumer::acquireBuffer");
if (err != OK) {
BI_LOGE("Failed to wait for fence of acquired buffer: %s (%d)",
strerror(-err), err);
diff --git a/libs/gui/CpuConsumer.cpp b/libs/gui/CpuConsumer.cpp
index e1a2838..710e1af 100644
--- a/libs/gui/CpuConsumer.cpp
+++ b/libs/gui/CpuConsumer.cpp
@@ -78,7 +78,7 @@ status_t CpuConsumer::lockNextBuffer(LockedBuffer *nativeBuffer) {
int buf = b.mBuf;
if (b.mFence.get()) {
- err = b.mFence->wait(Fence::TIMEOUT_NEVER);
+ err = b.mFence->waitForever(1000, "CpuConsumer::lockNextBuffer");
if (err != OK) {
CC_LOGE("Failed to wait for fence of acquired buffer: %s (%d)",
strerror(-err), err);
diff --git a/libs/gui/SurfaceTexture.cpp b/libs/gui/SurfaceTexture.cpp
index 7daa074..8df1302 100644
--- a/libs/gui/SurfaceTexture.cpp
+++ b/libs/gui/SurfaceTexture.cpp
@@ -812,7 +812,8 @@ status_t SurfaceTexture::doGLFenceWaitLocked() const {
return UNKNOWN_ERROR;
}
} else {
- status_t err = mCurrentFence->wait(Fence::TIMEOUT_NEVER);
+ status_t err = mCurrentFence->waitForever(1000,
+ "SurfaceTexture::doGLFenceWaitLocked");
if (err != NO_ERROR) {
ST_LOGE("doGLFenceWait: error waiting for fence: %d", err);
return err;
diff --git a/libs/gui/SurfaceTextureClient.cpp b/libs/gui/SurfaceTextureClient.cpp
index 18a0c10..afdbf04 100644
--- a/libs/gui/SurfaceTextureClient.cpp
+++ b/libs/gui/SurfaceTextureClient.cpp
@@ -129,15 +129,18 @@ int SurfaceTextureClient::hook_queueBuffer(ANativeWindow* window,
int SurfaceTextureClient::hook_dequeueBuffer_DEPRECATED(ANativeWindow* window,
ANativeWindowBuffer** buffer) {
SurfaceTextureClient* c = getSelf(window);
+ ANativeWindowBuffer* buf;
int fenceFd = -1;
- int result = c->dequeueBuffer(buffer, &fenceFd);
+ int result = c->dequeueBuffer(&buf, &fenceFd);
sp<Fence> fence(new Fence(fenceFd));
- int waitResult = fence->wait(Fence::TIMEOUT_NEVER);
+ int waitResult = fence->waitForever(1000, "dequeueBuffer_DEPRECATED");
if (waitResult != OK) {
- ALOGE("hook_dequeueBuffer_DEPRECATED: Fence::wait returned an "
- "error: %d", waitResult);
+ ALOGE("dequeueBuffer_DEPRECATED: Fence::wait returned an error: %d",
+ waitResult);
+ c->cancelBuffer(buf, -1);
return waitResult;
}
+ *buffer = buf;
return result;
}
@@ -751,7 +754,7 @@ status_t SurfaceTextureClient::lock(
sp<GraphicBuffer> backBuffer(GraphicBuffer::getSelf(out));
sp<Fence> fence(new Fence(fenceFd));
- err = fence->wait(Fence::TIMEOUT_NEVER);
+ err = fence->waitForever(1000, "SurfaceTextureClient::lock");
if (err != OK) {
ALOGE("Fence::wait failed (%s)", strerror(-err));
cancelBuffer(out, fenceFd);