Tune scheduling a bit, avoid a binder ipc
Don't query running behind if it's not possible to be behind such
as having received a vsync since the last call to swap buffers.
This also avoids an accidental-starvation issue where if surface
flinger was a bit sluggish to dequeue then renderthread would drop
thinking the queue was full.
Also be a bit smarter about tracking if we've already drawn for this
vsync target to avoid producing two frames for the same vsync
Change-Id: Ib266500a693c27000b2e8ea578f111229d75147a
diff --git a/libs/hwui/renderthread/CanvasContext.h b/libs/hwui/renderthread/CanvasContext.h
index 16956e6..db3aeb1 100644
--- a/libs/hwui/renderthread/CanvasContext.h
+++ b/libs/hwui/renderthread/CanvasContext.h
@@ -150,7 +150,13 @@
EGLSurface mEglSurface = EGL_NO_SURFACE;
bool mBufferPreserved = false;
SwapBehavior mSwapBehavior = kSwap_default;
- RingBuffer<SkRect, 3> mDamageHistory;
+ struct SwapHistory {
+ SkRect damage;
+ nsecs_t vsyncTime;
+ nsecs_t swapTime;
+ };
+
+ RingBuffer<SwapHistory, 3> mSwapHistory;
bool mOpaque;
OpenGLRenderer* mCanvas = nullptr;