diff options
author | Mathias Agopian <mathias@google.com> | 2012-09-20 23:14:05 -0700 |
---|---|---|
committer | Mathias Agopian <mathias@google.com> | 2012-09-21 14:20:35 -0700 |
commit | b4d18ed34e3513f3a14ea0876c7e330bee72a529 (patch) | |
tree | 3d87d41a7f8f26834ab7468c03f318f65ea8d178 /services | |
parent | 16cfa2e38bfbdafdba21af7f9f1c4d1418cbe1d3 (diff) | |
download | frameworks_native-b4d18ed34e3513f3a14ea0876c7e330bee72a529.zip frameworks_native-b4d18ed34e3513f3a14ea0876c7e330bee72a529.tar.gz frameworks_native-b4d18ed34e3513f3a14ea0876c7e330bee72a529.tar.bz2 |
fix an issue where hotplug events were not dispatched
Change-Id: I527eec77f338cd6f1a9021aa4c9d384dbddd6d2a
Diffstat (limited to 'services')
-rw-r--r-- | services/surfaceflinger/DisplayHardware/HWComposer.cpp | 15 | ||||
-rw-r--r-- | services/surfaceflinger/EventThread.cpp | 31 |
2 files changed, 31 insertions, 15 deletions
diff --git a/services/surfaceflinger/DisplayHardware/HWComposer.cpp b/services/surfaceflinger/DisplayHardware/HWComposer.cpp index a0c39a9..8107828 100644 --- a/services/surfaceflinger/DisplayHardware/HWComposer.cpp +++ b/services/surfaceflinger/DisplayHardware/HWComposer.cpp @@ -865,9 +865,18 @@ void HWComposer::dump(String8& result, char* buffer, size_t SIZE, result.appendFormat(" mDebugForceFakeVSync=%d\n", mDebugForceFakeVSync); for (size_t i=0 ; i<mNumDisplays ; i++) { const DisplayData& disp(mDisplayData[i]); - if (disp.list) { - result.appendFormat(" id=%d, numHwLayers=%u, flags=%08x\n", - i, disp.list->numHwLayers, disp.list->flags); + + if (disp.connected) { + result.appendFormat( + " Display[%d] : %ux%u, xdpi=%f, ydpi=%f, refresh=%lld\n", + i, disp.width, disp.height, disp.xdpi, disp.ydpi, disp.refresh); + } + + if (disp.list && disp.connected) { + result.appendFormat( + " numHwLayers=%u, flags=%08x\n", + disp.list->numHwLayers, disp.list->flags); + result.append( " type | handle | hints | flags | tr | blend | format | source crop | frame name \n" "------------+----------+----------+----------+----+-------+----------+---------------------------+--------------------------------\n"); diff --git a/services/surfaceflinger/EventThread.cpp b/services/surfaceflinger/EventThread.cpp index 6e7424e..24e9f2b 100644 --- a/services/surfaceflinger/EventThread.cpp +++ b/services/surfaceflinger/EventThread.cpp @@ -125,22 +125,24 @@ void EventThread::onHotplugReceived(int type, bool connected) { } bool EventThread::threadLoop() { - DisplayEventReceiver::Event vsync; + DisplayEventReceiver::Event event; Vector< sp<EventThread::Connection> > signalConnections; - signalConnections = waitForEvent(&vsync); + signalConnections = waitForEvent(&event); // dispatch events to listeners... const size_t count = signalConnections.size(); for (size_t i=0 ; i<count ; i++) { const sp<Connection>& conn(signalConnections[i]); - // now see if we still need to report this VSYNC event - status_t err = conn->postEvent(vsync); + // now see if we still need to report this event + status_t err = conn->postEvent(event); if (err == -EAGAIN || err == -EWOULDBLOCK) { // The destination doesn't accept events anymore, it's probably // full. For now, we just drop the events on the floor. - // Note that some events cannot be dropped and would have to be - // re-sent later. Right-now we don't have the ability to do - // this, but it doesn't matter for VSYNC. + // FIXME: Note that some events cannot be dropped and would have + // to be re-sent later. + // Right-now we don't have the ability to do this. + ALOGW("EventThread: dropping event (%08x) for connection %p", + event.header.type, conn.get()); } else if (err < 0) { // handle any other error on the pipe as fatal. the only // reasonable thing to do is to clean-up this connection. @@ -185,6 +187,7 @@ Vector< sp<EventThread::Connection> > EventThread::waitForEvent( for (size_t i=0 ; i<count ; i++) { sp<Connection> connection(mDisplayEventConnections[i].promote()); if (connection != NULL) { + bool added = false; if (connection->count >= 0) { // we need vsync events because at least // one connection is waiting for it @@ -196,18 +199,22 @@ Vector< sp<EventThread::Connection> > EventThread::waitForEvent( // fired this time around connection->count = -1; signalConnections.add(connection); + added = true; } else if (connection->count == 1 || (vsyncCount % connection->count) == 0) { // continuous event, and time to report it signalConnections.add(connection); + added = true; } - } else if (eventPending) { - // we don't have a vsync event to process - // (timestamp==0), but we have some pending - // messages. - signalConnections.add(connection); } } + + if (eventPending && !timestamp && !added) { + // we don't have a vsync event to process + // (timestamp==0), but we have some pending + // messages. + signalConnections.add(connection); + } } else { // we couldn't promote this reference, the connection has // died, so clean-up! |