summaryrefslogtreecommitdiffstats
path: root/services/surfaceflinger/MessageQueue.cpp
diff options
context:
space:
mode:
authorMathias Agopian <mathias@google.com>2012-06-29 14:12:52 -0700
committerMathias Agopian <mathias@google.com>2012-07-10 14:29:27 -0700
commit4fec873a98f7b4380720cd1ad006f74c8cdc73da (patch)
tree5d21495a3f4e9f87bf20c6a3d3ea0db83cbe33c0 /services/surfaceflinger/MessageQueue.cpp
parente7db724bed5d1e5086801df7705d9b1f2a071785 (diff)
downloadframeworks_native-4fec873a98f7b4380720cd1ad006f74c8cdc73da.zip
frameworks_native-4fec873a98f7b4380720cd1ad006f74c8cdc73da.tar.gz
frameworks_native-4fec873a98f7b4380720cd1ad006f74c8cdc73da.tar.bz2
one more step towards multiple display support
- remove dependency on cached state in validateVisibility - get rid of mVertices and mTransformedBounds - get rid of validateVisibility - get rid of unlockPageFlip - handleTransaction now returns a dirty region - computevisibileregion now uses window-manager space
Diffstat (limited to 'services/surfaceflinger/MessageQueue.cpp')
-rw-r--r--services/surfaceflinger/MessageQueue.cpp30
1 files changed, 26 insertions, 4 deletions
diff --git a/services/surfaceflinger/MessageQueue.cpp b/services/surfaceflinger/MessageQueue.cpp
index 290fff4..3f77f74 100644
--- a/services/surfaceflinger/MessageQueue.cpp
+++ b/services/surfaceflinger/MessageQueue.cpp
@@ -49,13 +49,13 @@ void MessageBase::handleMessage(const Message&) {
// ---------------------------------------------------------------------------
-void MessageQueue::Handler::signalRefresh() {
+void MessageQueue::Handler::dispatchRefresh() {
if ((android_atomic_or(eventMaskRefresh, &mEventMask) & eventMaskRefresh) == 0) {
mQueue.mLooper->sendMessage(this, Message(MessageQueue::REFRESH));
}
}
-void MessageQueue::Handler::signalInvalidate() {
+void MessageQueue::Handler::dispatchInvalidate() {
if ((android_atomic_or(eventMaskInvalidate, &mEventMask) & eventMaskInvalidate) == 0) {
mQueue.mLooper->sendMessage(this, Message(MessageQueue::INVALIDATE));
}
@@ -132,13 +132,31 @@ status_t MessageQueue::postMessage(
return NO_ERROR;
}
+/* 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() {
-// mHandler->signalInvalidate();
+#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) {
@@ -152,7 +170,11 @@ 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) {
- mHandler->signalRefresh();
+#if INVALIDATE_ON_VSYNC
+ mHandler->dispatchInvalidate();
+#else
+ mHandler->dispatchRefresh();
+#endif
break;
}
}