summaryrefslogtreecommitdiff
path: root/services/surfaceflinger/MessageQueue.cpp
diff options
context:
space:
mode:
author Dan Stoza <stoza@google.com> 2016-07-01 13:33:38 -0700
committer Dan Stoza <stoza@google.com> 2016-07-06 09:52:51 -0700
commit05dacfb68af895fce3cc8ebb0b4aa06c6c336e26 (patch)
tree76d979531ac6ed78cdac7065d4fb70752cbcf0c3 /services/surfaceflinger/MessageQueue.cpp
parent1ce6581ac788eaad58fd3329c2154af7dd74aa3d (diff)
HWC2: Backpressure missed vsyncs into apps
Adds a mechanism to detect whether the prior frame SurfaceFlinger presented to hardware composer was actually picked up or not. We then use this mechanism to avoid pushing two frames in the same vsync. This backpressure is passed back to applications by not latching any buffers, which will manifest as dequeueBuffer stalling until SurfaceFlinger releases a buffer on the following vsync. Also makes the former INVALIDATE_ON_VSYNC behavior the only behavior so that this functionality works correctly. Bug: 29413700 Change-Id: Ibde358e45423ee6fea7b5e09ff65e49c4ad67baa
Diffstat (limited to 'services/surfaceflinger/MessageQueue.cpp')
-rw-r--r--services/surfaceflinger/MessageQueue.cpp23
1 files changed, 0 insertions, 23 deletions
diff --git a/services/surfaceflinger/MessageQueue.cpp b/services/surfaceflinger/MessageQueue.cpp
index 34dc24b1f3..974c7a340e 100644
--- a/services/surfaceflinger/MessageQueue.cpp
+++ b/services/surfaceflinger/MessageQueue.cpp
@@ -134,31 +134,12 @@ status_t MessageQueue::postMessage(
}
-/* when INVALIDATE_ON_VSYNC is set SF only processes
- * buffer updates on VSYNC and performs a refresh immediately
- * after.
- *
- * when INVALIDATE_ON_VSYNC is set to false, SF will instead
- * perform the buffer updates immediately, but the refresh only
- * at the next VSYNC.
- * THIS MODE IS BUGGY ON GALAXY NEXUS AND WILL CAUSE HANGS
- */
-#define INVALIDATE_ON_VSYNC 1
-
void MessageQueue::invalidate() {
-#if INVALIDATE_ON_VSYNC
mEvents->requestNextVsync();
-#else
- mHandler->dispatchInvalidate();
-#endif
}
void MessageQueue::refresh() {
-#if INVALIDATE_ON_VSYNC
mHandler->dispatchRefresh();
-#else
- mEvents->requestNextVsync();
-#endif
}
int MessageQueue::cb_eventReceiver(int fd, int events, void* data) {
@@ -172,11 +153,7 @@ int MessageQueue::eventReceiver(int /*fd*/, int /*events*/) {
while ((n = DisplayEventReceiver::getEvents(mEventTube, buffer, 8)) > 0) {
for (int i=0 ; i<n ; i++) {
if (buffer[i].header.type == DisplayEventReceiver::DISPLAY_EVENT_VSYNC) {
-#if INVALIDATE_ON_VSYNC
mHandler->dispatchInvalidate();
-#else
- mHandler->dispatchRefresh();
-#endif
break;
}
}