libgui: Add Surface::getLastDequeueStartTime
Adds the getLastDequeueStartTime method, which allows the caller to
determine whether the last dequeueBuffer call fell into a given time
window.
Bug: 62213889
Test: SurfaceTest.TestGetLastDequeueStartTime in libgui_test
Change-Id: I1684deb09273745a3adc751554624d2257fa890e
diff --git a/include/gui/Surface.h b/include/gui/Surface.h
index 8b1d106..e8dc83e 100644
--- a/include/gui/Surface.h
+++ b/include/gui/Surface.h
@@ -160,6 +160,9 @@
status_t getUniqueId(uint64_t* outId) const;
+ // Returns the CLOCK_MONOTONIC start time of the last dequeueBuffer call
+ nsecs_t getLastDequeueStartTime() const;
+
protected:
virtual ~Surface();
@@ -421,6 +424,9 @@
nsecs_t mLastDequeueDuration = 0;
nsecs_t mLastQueueDuration = 0;
+ // Stores the time right before we call IGBP::dequeueBuffer
+ nsecs_t mLastDequeueStartTime = 0;
+
Condition mQueueBufferCondition;
uint64_t mNextFrameNumber = 1;