summaryrefslogtreecommitdiffstats
path: root/services/surfaceflinger/EventThread.cpp
diff options
context:
space:
mode:
authorMathias Agopian <mathias@google.com>2012-04-10 18:25:31 -0700
committerMathias Agopian <mathias@google.com>2012-04-10 21:04:12 -0700
commite2c4f4ec23b735dd2a03f4ea8b08b288a1bb04e8 (patch)
treeb90a8c78d8ee70040a5dd8b66c9361b16a146ab8 /services/surfaceflinger/EventThread.cpp
parentf0bc2f1d8d37977bd3aef3d3326a70e9e69d4246 (diff)
downloadframeworks_native-e2c4f4ec23b735dd2a03f4ea8b08b288a1bb04e8.zip
frameworks_native-e2c4f4ec23b735dd2a03f4ea8b08b288a1bb04e8.tar.gz
frameworks_native-e2c4f4ec23b735dd2a03f4ea8b08b288a1bb04e8.tar.bz2
Added vsync debugging information in dumpsys log
Change-Id: I20ef05a73d89caaf6a70dc9ca25ada6e6a1f6ff9
Diffstat (limited to 'services/surfaceflinger/EventThread.cpp')
-rw-r--r--services/surfaceflinger/EventThread.cpp31
1 files changed, 23 insertions, 8 deletions
diff --git a/services/surfaceflinger/EventThread.cpp b/services/surfaceflinger/EventThread.cpp
index cc44186..5813eef 100644
--- a/services/surfaceflinger/EventThread.cpp
+++ b/services/surfaceflinger/EventThread.cpp
@@ -41,7 +41,8 @@ EventThread::EventThread(const sp<SurfaceFlinger>& flinger)
mHw(flinger->graphicPlane(0).editDisplayHardware()),
mLastVSyncTimestamp(0),
mVSyncTimestamp(0),
- mDeliveredEvents(0)
+ mDeliveredEvents(0),
+ mDebugVsyncEnabled(false)
{
}
@@ -144,8 +145,7 @@ bool EventThread::threadLoop() {
if (!waitForNextVsync) {
// we received a VSYNC but we have no clients
// don't report it, and disable VSYNC events
- mHw.getHwComposer().eventControl(
- HWComposer::EVENT_VSYNC, false);
+ disableVSync();
} else {
// report VSYNC event
break;
@@ -157,8 +157,7 @@ bool EventThread::threadLoop() {
// disable VSYNC events then.
if (waitForNextVsync) {
// enable
- mHw.getHwComposer().eventControl(
- HWComposer::EVENT_VSYNC, true);
+ enableVSync();
}
}
@@ -234,6 +233,16 @@ bool EventThread::threadLoop() {
return true;
}
+void EventThread::enableVSync() {
+ mHw.getHwComposer().eventControl(HWComposer::EVENT_VSYNC, true);
+ mDebugVsyncEnabled = true;
+}
+
+void EventThread::disableVSync() {
+ mHw.getHwComposer().eventControl(HWComposer::EVENT_VSYNC, false);
+ mDebugVsyncEnabled = false;
+}
+
status_t EventThread::readyToRun() {
ALOGI("EventThread ready to run.");
return NO_ERROR;
@@ -241,10 +250,16 @@ status_t EventThread::readyToRun() {
void EventThread::dump(String8& result, char* buffer, size_t SIZE) const {
Mutex::Autolock _l(mLock);
- result.append("VSYNC state:\n");
- snprintf(buffer, SIZE, " numListeners=%u, events-delivered: %u\n",
+ result.appendFormat("VSYNC state: %s\n",
+ mDebugVsyncEnabled?"enabled":"disabled");
+ result.appendFormat(" numListeners=%u,\n events-delivered: %u\n",
mDisplayEventConnections.size(), mDeliveredEvents);
- result.append(buffer);
+ for (size_t i=0 ; i<mDisplayEventConnections.size() ; i++) {
+ sp<Connection> connection =
+ mDisplayEventConnections.itemAt(i).promote();
+ result.appendFormat(" %p: count=%d\n",
+ connection.get(), connection!=NULL ? connection->count : 0);
+ }
}
// ---------------------------------------------------------------------------