From e16b144a4a5d1b78596d1998ccf4fb6fcb95c185 Mon Sep 17 00:00:00 2001 From: Stark Li Date: Mon, 18 Dec 2017 09:33:36 +0000 Subject: hwc2: Fix hdmi uevent and refresh sf after hotplug complete. PD#157039 Change-Id: Ibf2e07b5d256664f4d15494427e20cad4aa0d65e --- diff --git a/hwc2/common/devices/PrimaryDevice.cpp b/hwc2/common/devices/PrimaryDevice.cpp index 377db74..797f9ff 100644 --- a/hwc2/common/devices/PrimaryDevice.cpp +++ b/hwc2/common/devices/PrimaryDevice.cpp @@ -49,6 +49,8 @@ bool PrimaryDevice::initialize() DEINIT_AND_RETURN_FALSE("failed to initialize physical device"); } + mSignalHpd = false; + UeventObserver *observer = Hwcomposer::getInstance().getUeventObserver(); if (observer) { observer->registerListener( @@ -75,7 +77,8 @@ void PrimaryDevice::hotplugEventListener(void *data, bool status) { PrimaryDevice *pThis = (PrimaryDevice*)data; if (pThis) { - pThis->hotplugListener(status); + pThis->hotplugListener(0); + if (status) pThis->mSignalHpd = true; } } @@ -83,6 +86,7 @@ void PrimaryDevice::modeChangeEventListener(void *data, bool status) { PrimaryDevice *pThis = (PrimaryDevice*)data; DTRACE("mode change event: %d", status); + if (status && pThis) { pThis->changeModeDetectThread(); } @@ -96,7 +100,10 @@ void PrimaryDevice::hotplugListener(bool connected) updateHotplugState(connected); // update display configs - onHotplug(getDisplayId(), connected); + // onHotplug(getDisplayId(), connected); + + // notify sf to refresh. + getDevice().refresh(getDisplayId()); } int PrimaryDevice::parseConfigFile() @@ -152,9 +159,14 @@ void* PrimaryDevice::changeModeDetect(void* data) Utils::getSysfsStr(SYSFS_DISPLAY_MODE, lastMode); do { modeChanged = Utils::checkSysfsStatus(SYSFS_DISPLAY_MODE, lastMode, 32); - usleep(1000 * 1000); + usleep(500 * 1000); } while (!modeChanged); - pThis->setOsdMouse(); + + if (pThis->mSignalHpd) { + pThis->setOsdMouse(); + pThis->hotplugListener(1); + pThis->mSignalHpd = false; + } return NULL; } diff --git a/hwc2/common/utils/Utils.cpp b/hwc2/common/utils/Utils.cpp index deae89c..4bccd50 100644 --- a/hwc2/common/utils/Utils.cpp +++ b/hwc2/common/utils/Utils.cpp @@ -203,7 +203,7 @@ bool Utils::checkSysfsStatus(const char* sysfstr, char* lastr, int32_t size) { const char* Utils::getHotplugUeventEnvelope() { - return "change@/devices/virtual/switch/hdmi_delay"; + return "change@/devices/virtual/amhdmitx/amhdmitx0/hdmi"; } const char* Utils::getHdcpUeventEnvelope() diff --git a/hwc2/include/PrimaryDevice.h b/hwc2/include/PrimaryDevice.h index 7cb8fef..216f404 100644 --- a/hwc2/include/PrimaryDevice.h +++ b/hwc2/include/PrimaryDevice.h @@ -58,6 +58,7 @@ private: const char* pConfigPath; int mDisplayType; + bool mSignalHpd; }; } -- cgit