Cache frame event history producer-side.
* Producer maintains a recent history of frames.
* Producer only does a binder call if requested
informatiVon doesn't exist in the cache.
* Consumer sends fences to the producer, which
can be queried for timestamps without a
binder call.
Test: adb shell /data/nativetest/libgui_test/libgui_test
--gtest_filter=*GetFrameTimestamps*
Change-Id: I8a64579407cc2935f5c659462cb227b07ba27e43
diff --git a/services/surfaceflinger/Layer.cpp b/services/surfaceflinger/Layer.cpp
index c16af59..2334e47 100644
--- a/services/surfaceflinger/Layer.cpp
+++ b/services/surfaceflinger/Layer.cpp
@@ -2215,24 +2215,16 @@
mFrameEventHistory.dump(result);
}
-bool Layer::addAndGetFrameTimestamps(
- const NewFrameEventsEntry* newTimestamps,
- uint64_t frameNumber, FrameTimestamps *outTimestamps) {
+void Layer::addAndGetFrameTimestamps(const NewFrameEventsEntry* newTimestamps,
+ FrameEventHistoryDelta *outDelta) {
Mutex::Autolock lock(mFrameEventHistoryMutex);
if (newTimestamps) {
mFrameEventHistory.addQueue(*newTimestamps);
}
- if (outTimestamps) {
- FrameEvents* frameEvents = mFrameEventHistory.getFrame(frameNumber);
- if (frameEvents) {
- frameEvents->checkFencesForCompletion();
- *outTimestamps = FrameTimestamps(*frameEvents);
- return true;
- }
+ if (outDelta) {
+ mFrameEventHistory.getAndResetDelta(outDelta);
}
-
- return false;
}
std::vector<OccupancyTracker::Segment> Layer::getOccupancyHistory(