summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Yao, Kefei <kefei.yao@intel.com> 2021-11-01 15:20:31 +0800
committer Alec Mouri <alecmouri@google.com> 2021-11-15 12:05:34 -0800
commitad741ccb93731e1fcfb307de1491eede00d096eb (patch)
treef39426765ecbef4d3b37ade2d15efd34225ce6ea
parentc9963a2d6e1b8751541fa395115311bd50b90b87 (diff)
Treat fence with error as invalid in terms of signal time
Previously, fence with error was treated as pending, resulting in buffer not being able to be latched. This is especially bad when GPU hang happened and driver has restored context and states being able to recover the pipeline, but the whole pipeline is stuck at the buffer consumer (surfaceflinger) failing to consume the buffer, essentially because of fence error. Treating fence error as signaled but fence time as invalid, eliminate the possiblity of such defect while still sounding the alarm to the rest of the system regarding signal time of the underlying fence Also this could be justified by kernel, the status of a dma_fence is defined as 0 if the fence has not yet been signaled, 1 if the fence has been signaled without an error condition, or a negtive error code if the fence has been completed in err (see dma-fence.h). In this sense, a fence with error should not be treated as *not* signaled either. Bug: 204919015 Test: Manually trigger a GPU hang, the layer undergoing the GPU hang recovered from the hang and continuously get rendered as apposed to freezing Change-Id: Idc8e85f132520576802d1ebc32b2597bfe341be0
-rw-r--r--libs/ui/Fence.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/libs/ui/Fence.cpp b/libs/ui/Fence.cpp
index 33ab7c470e..cc96f83578 100644
--- a/libs/ui/Fence.cpp
+++ b/libs/ui/Fence.cpp
@@ -132,9 +132,13 @@ nsecs_t Fence::getSignalTime() const {
ALOGE("sync_file_info returned NULL for fd %d", mFenceFd.get());
return SIGNAL_TIME_INVALID;
}
+
if (finfo->status != 1) {
+ const auto status = finfo->status;
+ ALOGE_IF(status < 0, "%s: sync_file_info contains an error: <%d> for fd: <%d>", __func__,
+ status, mFenceFd.get());
sync_file_info_free(finfo);
- return SIGNAL_TIME_PENDING;
+ return status < 0 ? SIGNAL_TIME_INVALID : SIGNAL_TIME_PENDING;
}
uint64_t timestamp = 0;