If the old fence for a given layer has already expired, we can replace
it with the new fence rather than merging the two.
This saves 300-400us per frame on Android Wear
Change-Id: I5d907c336c7383ae4e2e0f71e42f23749494a359
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);