Fence didn't manager sync_wait error codes properly
error codes are returned in errno, this caused ::waitForwever() to only wait for 1 second and return improper error code (-1). needed to help debugging 7316632 Bug: 7316632 Change-Id: Ie144f614a88393393972a3a770c6b4b0581f961a
This commit is contained in:
parent
cb55857bbd
commit
b5c9dcdf3b
|
@ -60,14 +60,14 @@ public:
|
||||||
// before the fence signals then -ETIME is returned. A timeout of
|
// before the fence signals then -ETIME is returned. A timeout of
|
||||||
// TIMEOUT_NEVER may be used to indicate that the call should wait
|
// TIMEOUT_NEVER may be used to indicate that the call should wait
|
||||||
// indefinitely for the fence to signal.
|
// indefinitely for the fence to signal.
|
||||||
int wait(unsigned int timeout);
|
status_t wait(unsigned int timeout);
|
||||||
|
|
||||||
// waitForever is a convenience function for waiting forever for a fence to
|
// waitForever is a convenience function for waiting forever for a fence to
|
||||||
// signal (just like wait(TIMEOUT_NEVER)), but issuing an error to the
|
// 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
|
// 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 warningTimeout. The logname argument should be a string identifying
|
||||||
// the caller and will be included in the log message.
|
// the caller and will be included in the log message.
|
||||||
int waitForever(unsigned int warningTimeout, const char* logname);
|
status_t waitForever(unsigned int warningTimeout, const char* logname);
|
||||||
|
|
||||||
// TIMEOUT_NEVER may be passed to the wait method to indicate that it
|
// TIMEOUT_NEVER may be passed to the wait method to indicate that it
|
||||||
// should wait indefinitely for the fence to signal.
|
// should wait indefinitely for the fence to signal.
|
||||||
|
|
|
@ -42,26 +42,27 @@ Fence::~Fence() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int Fence::wait(unsigned int timeout) {
|
status_t Fence::wait(unsigned int timeout) {
|
||||||
ATRACE_CALL();
|
ATRACE_CALL();
|
||||||
if (mFenceFd == -1) {
|
if (mFenceFd == -1) {
|
||||||
return NO_ERROR;
|
return NO_ERROR;
|
||||||
}
|
}
|
||||||
return sync_wait(mFenceFd, timeout);
|
int err = sync_wait(mFenceFd, timeout);
|
||||||
|
return err < 0 ? -errno : status_t(NO_ERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
int Fence::waitForever(unsigned int warningTimeout, const char* logname) {
|
status_t Fence::waitForever(unsigned int warningTimeout, const char* logname) {
|
||||||
ATRACE_CALL();
|
ATRACE_CALL();
|
||||||
if (mFenceFd == -1) {
|
if (mFenceFd == -1) {
|
||||||
return NO_ERROR;
|
return NO_ERROR;
|
||||||
}
|
}
|
||||||
int err = sync_wait(mFenceFd, warningTimeout);
|
int err = sync_wait(mFenceFd, warningTimeout);
|
||||||
if (err == -ETIME) {
|
if (err < 0 && errno == ETIME) {
|
||||||
ALOGE("%s: fence %d didn't signal in %u ms", logname, mFenceFd,
|
ALOGE("%s: fence %d didn't signal in %u ms", logname, mFenceFd,
|
||||||
warningTimeout);
|
warningTimeout);
|
||||||
err = sync_wait(mFenceFd, TIMEOUT_NEVER);
|
err = sync_wait(mFenceFd, TIMEOUT_NEVER);
|
||||||
}
|
}
|
||||||
return err;
|
return err < 0 ? -errno : status_t(NO_ERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
sp<Fence> Fence::merge(const String8& name, const sp<Fence>& f1,
|
sp<Fence> Fence::merge(const String8& name, const sp<Fence>& f1,
|
||||||
|
|
Loading…
Reference in New Issue