summaryrefslogtreecommitdiff
path: root/libs/gui/ConsumerBase.cpp
diff options
context:
space:
mode:
author Matthew Bouyack <mbouyack@google.com> 2016-10-18 17:16:22 +0000
committer android-build-merger <android-build-merger@google.com> 2016-10-18 17:16:22 +0000
commit29cacbe8fedffe0f6db2c2836f76b6497caf78ab (patch)
treef6142a40496693621b08b33f0ab8570b69f95aa0 /libs/gui/ConsumerBase.cpp
parentf873bd4d31c7055695ce74f44b2c97f9df71f5a6 (diff)
parent377c2033750ad2a47e5c560f982a0242ea7dc79e (diff)
In SurfaceFlinger, test fence before merging
am: 377c203375 Change-Id: Icfbcbe58de9f6930f06774f47e6576ec523115bd
Diffstat (limited to 'libs/gui/ConsumerBase.cpp')
-rw-r--r--libs/gui/ConsumerBase.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/libs/gui/ConsumerBase.cpp b/libs/gui/ConsumerBase.cpp
index 5546d5416c..3cf3078345 100644
--- a/libs/gui/ConsumerBase.cpp
+++ b/libs/gui/ConsumerBase.cpp
@@ -314,6 +314,18 @@ status_t ConsumerBase::addReleaseFenceLocked(int slot,
if (!mSlots[slot].mFence.get()) {
mSlots[slot].mFence = fence;
+ return OK;
+ }
+
+ auto signaled = mSlots[slot].mFence->hasSignaled();
+
+ if (!signaled) {
+ CB_LOGE("fence has invalid state");
+ return BAD_VALUE;
+ }
+
+ if (*signaled) {
+ mSlots[slot].mFence = fence;
} else {
char fenceName[32] = {};
snprintf(fenceName, 32, "%.28s:%d", mName.string(), slot);