From 9e9689c11148521d2c16a121a0b87b062be0714c Mon Sep 17 00:00:00 2001 From: Andy McFadden Date: Wed, 10 Oct 2012 18:17:51 -0700 Subject: Fix HDMI unblank behavior Two issues: (1) We were announcing the hotplug event before we were ready to handle blank/unblank events, so we were losing the initial unblank that power manager sends us when HDMI is first plugged in. This left the display blank until you toggled the device power off/on. (2) We were retaining fbTargetHandle for HDMI after the display was disconnected. The value didn't get updated when HDMI was reconnected because the display was blank, so we didn't go through that code path. So, when HDMI was re-connected, we passed stale data into the HWC. Bug 7323938 Change-Id: I2335d24fd7b0f00bb23fc63aa7bcf44cb8857c73 --- services/surfaceflinger/DisplayHardware/HWComposer.cpp | 1 + services/surfaceflinger/SurfaceFlinger.cpp | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) (limited to 'services') diff --git a/services/surfaceflinger/DisplayHardware/HWComposer.cpp b/services/surfaceflinger/DisplayHardware/HWComposer.cpp index be4af51..d9bda11 100644 --- a/services/surfaceflinger/DisplayHardware/HWComposer.cpp +++ b/services/surfaceflinger/DisplayHardware/HWComposer.cpp @@ -696,6 +696,7 @@ void HWComposer::disconnectDisplay(int disp) { free(dd.list); dd.list = NULL; dd.framebufferTarget = NULL; // points into dd.list + dd.fbTargetHandle = NULL; } } diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp index 17c67f9..492d1cf 100644 --- a/services/surfaceflinger/SurfaceFlinger.cpp +++ b/services/surfaceflinger/SurfaceFlinger.cpp @@ -772,8 +772,7 @@ void SurfaceFlinger::onHotplugReceived(int type, bool connected) { } setTransactionFlags(eDisplayTransactionNeeded); - // we should only receive DisplayDevice::DisplayType from the vsync callback - mEventThread->onHotplugReceived(type, connected); + // Defer EventThread notification until SF has updated mDisplays. } } @@ -1130,6 +1129,7 @@ void SurfaceFlinger::handleTransactionLocked(uint32_t transactionFlags) DisplayDevice::makeCurrent(mEGLDisplay, hw, mEGLContext); mDisplays.removeItem(draw.keyAt(i)); getHwComposer().disconnectDisplay(draw[i].type); + mEventThread->onHotplugReceived(draw[i].type, false); } else { ALOGW("trying to remove the main display"); } @@ -1212,6 +1212,7 @@ void SurfaceFlinger::handleTransactionLocked(uint32_t transactionFlags) state.viewport, state.frame); hw->setDisplayName(state.displayName); mDisplays.add(display, hw); + mEventThread->onHotplugReceived(state.type, true); } } } -- cgit v1.1