am ea74d3b7: make the warning timout of Fence::waitForever() implicit and longer

* commit 'ea74d3b78d607cde17790a7bb83e6f68ffd34cfd':
  make the warning timout of Fence::waitForever() implicit and longer
This commit is contained in:
Mathias Agopian 2013-05-17 10:16:51 -07:00 committed by Android Git Automerger
commit e6eef6c136
7 changed files with 11 additions and 9 deletions

View File

@ -70,9 +70,10 @@ public:
// waitForever is a convenience function for waiting forever for a fence to
// signal (just like wait(TIMEOUT_NEVER)), but issuing an error to the
// system log and fence state to the kernel log if the wait lasts longer
// than warningTimeout. The logname argument should be a string identifying
// than a warning timeout.
// The logname argument should be a string identifying
// the caller and will be included in the log message.
status_t waitForever(unsigned int warningTimeout, const char* logname);
status_t waitForever(const char* logname);
// merge combines two Fence objects, creating a new Fence object that
// becomes signaled when both f1 and f2 are signaled (even if f1 or f2 is

View File

@ -63,7 +63,7 @@ status_t BufferItemConsumer::acquireBuffer(BufferItem *item, bool waitForFence)
}
if (waitForFence) {
err = item->mFence->waitForever(1000, "BufferItemConsumer::acquireBuffer");
err = item->mFence->waitForever("BufferItemConsumer::acquireBuffer");
if (err != OK) {
BI_LOGE("Failed to wait for fence of acquired buffer: %s (%d)",
strerror(-err), err);

View File

@ -80,7 +80,7 @@ status_t CpuConsumer::lockNextBuffer(LockedBuffer *nativeBuffer) {
int buf = b.mBuf;
if (b.mFence.get()) {
err = b.mFence->waitForever(1000, "CpuConsumer::lockNextBuffer");
err = b.mFence->waitForever("CpuConsumer::lockNextBuffer");
if (err != OK) {
CC_LOGE("Failed to wait for fence of acquired buffer: %s (%d)",
strerror(-err), err);

View File

@ -821,7 +821,7 @@ status_t GLConsumer::doGLFenceWaitLocked() const {
return UNKNOWN_ERROR;
}
} else {
status_t err = mCurrentFence->waitForever(1000,
status_t err = mCurrentFence->waitForever(
"GLConsumer::doGLFenceWaitLocked");
if (err != NO_ERROR) {
ST_LOGE("doGLFenceWait: error waiting for fence: %d", err);

View File

@ -113,7 +113,7 @@ int Surface::hook_dequeueBuffer_DEPRECATED(ANativeWindow* window,
int fenceFd = -1;
int result = c->dequeueBuffer(&buf, &fenceFd);
sp<Fence> fence(new Fence(fenceFd));
int waitResult = fence->waitForever(1000, "dequeueBuffer_DEPRECATED");
int waitResult = fence->waitForever("dequeueBuffer_DEPRECATED");
if (waitResult != OK) {
ALOGE("dequeueBuffer_DEPRECATED: Fence::wait returned an error: %d",
waitResult);
@ -734,7 +734,7 @@ status_t Surface::lock(
sp<GraphicBuffer> backBuffer(GraphicBuffer::getSelf(out));
sp<Fence> fence(new Fence(fenceFd));
err = fence->waitForever(1000, "Surface::lock");
err = fence->waitForever("Surface::lock");
if (err != OK) {
ALOGE("Fence::wait failed (%s)", strerror(-err));
cancelBuffer(out, fenceFd);

View File

@ -54,11 +54,12 @@ status_t Fence::wait(unsigned int timeout) {
return err < 0 ? -errno : status_t(NO_ERROR);
}
status_t Fence::waitForever(unsigned int warningTimeout, const char* logname) {
status_t Fence::waitForever(const char* logname) {
ATRACE_CALL();
if (mFenceFd == -1) {
return NO_ERROR;
}
unsigned int warningTimeout = 3000;
int err = sync_wait(mFenceFd, warningTimeout);
if (err < 0 && errno == ETIME) {
ALOGE("%s: fence %d didn't signal in %u ms", logname, mFenceFd,

View File

@ -750,7 +750,7 @@ int HWComposer::fbPost(int32_t id,
if (mHwc && hwcHasApiVersion(mHwc, HWC_DEVICE_API_VERSION_1_1)) {
return setFramebufferTarget(id, acquireFence, buffer);
} else {
acquireFence->waitForever(1000, "HWComposer::fbPost");
acquireFence->waitForever("HWComposer::fbPost");
return mFbDev->post(mFbDev, buffer->handle);
}
}