CE: Pass the fence with the cached client composition buffer
Composition cache checks the buffer id with the client
composition request to see if we can reuse a buffer if the
request has not changed. We never bothered with a fence
here because by the time the cache was accessed, we
would have sent the buffer to the display at least once.
With composition strategy prediction, our assumption
breaks. There is a chance we fail to predict the strategy
but the new strategy results in the same client
composition request so we can reuse the client
composition work that was submitted in the beginning
of the frame.
Test: Repro steps in bug
Test: go/wm-smoke
Bug: 239944175
Change-Id: Idbe6a9bb3bba889aa7b459b1046890ea3960982f
diff --git a/services/surfaceflinger/CompositionEngine/src/Output.cpp b/services/surfaceflinger/CompositionEngine/src/Output.cpp
index c3385a8..f360504 100644
--- a/services/surfaceflinger/CompositionEngine/src/Output.cpp
+++ b/services/surfaceflinger/CompositionEngine/src/Output.cpp
@@ -1218,7 +1218,8 @@
ATRACE_NAME("ClientCompositionCacheHit");
outputCompositionState.reusedClientComposition = true;
setExpensiveRenderingExpected(false);
- return base::unique_fd();
+ // b/239944175 pass the fence associated with the buffer.
+ return base::unique_fd(std::move(fd));
}
ATRACE_NAME("ClientCompositionCacheMiss");
mClientCompositionRequestCache->add(tex->getBuffer()->getId(), clientCompositionDisplay,