summaryrefslogtreecommitdiff
authorLuan Yuan <luan.yuan@amlogic.com>2017-12-22 12:05:41 (GMT)
committer Luan Yuan <luan.yuan@amlogic.com>2017-12-26 11:13:01 (GMT)
commitb211a1e817b04b8cc42c680d4807e5cb66aa6ccc (patch)
tree1dff6b4d566250fcea073e20e9ce883374510fad
parentdeaf618be119cb330b78217204e2e3accf197437 (diff)
downloadhwcomposer-b211a1e817b04b8cc42c680d4807e5cb66aa6ccc.zip
hwcomposer-b211a1e817b04b8cc42c680d4807e5cb66aa6ccc.tar.gz
hwcomposer-b211a1e817b04b8cc42c680d4807e5cb66aa6ccc.tar.bz2
hwcomposer: update params when switch hdmi to cvbs[2/2]
PD#157561 remove unnecessary code and add new Uevent to observe change of mode state. Change-Id: Ib4ca4dfc2cb30447e84c55bfb52294acd58835b8
Diffstat
-rw-r--r--hwc2/common/devices/PrimaryDevice.cpp40
-rw-r--r--hwc2/common/observers/UeventObserver.cpp4
-rw-r--r--hwc2/common/utils/Utils.cpp11
-rw-r--r--hwc2/common/utils/Utils.h2
-rw-r--r--hwc2/include/PrimaryDevice.h2
5 files changed, 23 insertions, 36 deletions
diff --git a/hwc2/common/devices/PrimaryDevice.cpp b/hwc2/common/devices/PrimaryDevice.cpp
index 797f9ff..88ac1cb 100644
--- a/hwc2/common/devices/PrimaryDevice.cpp
+++ b/hwc2/common/devices/PrimaryDevice.cpp
@@ -49,7 +49,7 @@ bool PrimaryDevice::initialize()
DEINIT_AND_RETURN_FALSE("failed to initialize physical device");
}
- mSignalHpd = false;
+ mSignalHpd = Utils::getSysfsInt(DISPLAY_HPD_STATE, 1) == 1 ? true : false;
UeventObserver *observer = Hwcomposer::getInstance().getUeventObserver();
if (observer) {
@@ -75,20 +75,21 @@ void PrimaryDevice::deinitialize()
void PrimaryDevice::hotplugEventListener(void *data, bool status)
{
+ DTRACE("HDMI Plug State[%s]", status == true ? "Plug" : "UnPlug");
PrimaryDevice *pThis = (PrimaryDevice*)data;
if (pThis) {
- pThis->hotplugListener(0);
- if (status) pThis->mSignalHpd = true;
+ pThis->mSignalHpd = status;
}
}
void PrimaryDevice::modeChangeEventListener(void *data, bool status)
{
PrimaryDevice *pThis = (PrimaryDevice*)data;
- DTRACE("mode change event: %d", status);
+ DTRACE("mode state: [%s] display mode.", status == true ? "Begin to change" : "Complete");
- if (status && pThis) {
- pThis->changeModeDetectThread();
+ if (!status && pThis) {
+ pThis->setOsdMouse();
+ pThis->hotplugListener(pThis->mSignalHpd);
}
}
@@ -143,32 +144,5 @@ int PrimaryDevice::parseConfigFile()
return status;
}
-void PrimaryDevice::changeModeDetectThread()
-{
- pthread_t id;
- int ret = pthread_create(&id, NULL, changeModeDetect, this);
- if (ret != 0)
- ETRACE("Create changeModeDetect error!\n");
-}
-
-void* PrimaryDevice::changeModeDetect(void* data)
-{
- PrimaryDevice *pThis = (PrimaryDevice*)data;
- bool modeChanged = false;
- char lastMode[32];
- Utils::getSysfsStr(SYSFS_DISPLAY_MODE, lastMode);
- do {
- modeChanged = Utils::checkSysfsStatus(SYSFS_DISPLAY_MODE, lastMode, 32);
- usleep(500 * 1000);
- } while (!modeChanged);
-
- if (pThis->mSignalHpd) {
- pThis->setOsdMouse();
- pThis->hotplugListener(1);
- pThis->mSignalHpd = false;
- }
- return NULL;
-}
-
} // namespace amlogic
} // namespace android
diff --git a/hwc2/common/observers/UeventObserver.cpp b/hwc2/common/observers/UeventObserver.cpp
index 7f6bbc1..3f458a8 100644
--- a/hwc2/common/observers/UeventObserver.cpp
+++ b/hwc2/common/observers/UeventObserver.cpp
@@ -212,6 +212,10 @@ void UeventObserver::onUevent()
listener->func(listener->data, true);
} else if (key.contains(Utils::getSwitchState0())) {
listener->func(listener->data, false);
+ } else if (key.contains(Utils::getSwitchModeState1())) {
+ listener->func(listener->data, true);
+ } else if (key.contains(Utils::getSwitchModeState0())) {
+ listener->func(listener->data, false);
}
msg += strlen(msg) + 1;
}
diff --git a/hwc2/common/utils/Utils.cpp b/hwc2/common/utils/Utils.cpp
index 4bccd50..ce733b3 100644
--- a/hwc2/common/utils/Utils.cpp
+++ b/hwc2/common/utils/Utils.cpp
@@ -213,7 +213,7 @@ const char* Utils::getHdcpUeventEnvelope()
const char* Utils::getModeChangeUeventEnvelope()
{
- return "change@/devices/virtual/amhdmitx/amhdmitx0/setmode";
+ return "change@/devices/platform/vout/extcon/setmode";
}
const char* Utils::getSwitchState0()
@@ -226,6 +226,15 @@ const char* Utils::getSwitchState1()
return "STATE=HDMI=1";
}
+const char* Utils::getSwitchModeState0()
+{
+ return "STATE=ACA=0";
+}
+
+const char* Utils::getSwitchModeState1()
+{
+ return "STATE=ACA=1";
+}
bool Utils::rectEmpty(hwc_rect_t& rect) {
if ((rect.right - rect.left <= 0) ||(rect.bottom - rect.top <= 0))
diff --git a/hwc2/common/utils/Utils.h b/hwc2/common/utils/Utils.h
index f9c782f..5c7824d 100644
--- a/hwc2/common/utils/Utils.h
+++ b/hwc2/common/utils/Utils.h
@@ -66,6 +66,8 @@ public:
static const char* getModeChangeUeventEnvelope();
static const char* getSwitchState0();
static const char* getSwitchState1();
+ static const char* getSwitchModeState0();
+ static const char* getSwitchModeState1();
template <typename T, typename S>
static inline bool compareRect(T a, S b) {
diff --git a/hwc2/include/PrimaryDevice.h b/hwc2/include/PrimaryDevice.h
index 216f404..423e705 100644
--- a/hwc2/include/PrimaryDevice.h
+++ b/hwc2/include/PrimaryDevice.h
@@ -53,8 +53,6 @@ private:
static void modeChangeEventListener(void *data, bool status);
void hotplugListener(bool connected);
int parseConfigFile();
- void changeModeDetectThread();
- static void* changeModeDetect(void * data);
const char* pConfigPath;
int mDisplayType;