diff options
author | Michael Lentine <mlentine@google.com> | 2015-05-12 18:07:27 -0700 |
---|---|---|
committer | Michael Lentine <mlentine@google.com> | 2015-05-22 14:18:23 -0700 |
commit | 3540d325335005c6761c3557679201ae29f7c1d0 (patch) | |
tree | 0942feb361fbe694d68b5493b81c5e205921384c | |
parent | e8bb8dfaf5c91de50c9336e141af0acf8bf2987a (diff) | |
download | hwcomposer-3540d325335005c6761c3557679201ae29f7c1d0.tar.gz |
Add support for hotplug events on primary display
Remove the ifdefs protecting hotplug from being called.
Fix Hwcomposer to use the display index instead of the display type when
sending a hotplug event.
Bug: 18698244
Change-Id: I32582c23323e409ca602db86d297c406e4010da9
14 files changed, 38 insertions, 38 deletions
diff --git a/moorefield_hdmi/common/base/Hwcomposer.cpp b/moorefield_hdmi/common/base/Hwcomposer.cpp index eac1448..824781a 100755 --- a/moorefield_hdmi/common/base/Hwcomposer.cpp +++ b/moorefield_hdmi/common/base/Hwcomposer.cpp @@ -334,13 +334,11 @@ void Hwcomposer::hotplug(__attribute__((unused))int disp, bool connected) { RETURN_VOID_IF_NOT_INIT(); -#ifndef INTEL_SUPPORT_HDMI_PRIMARY if (mProcs && mProcs->hotplug) { DLOGTRACE("report hotplug on disp %d, connected %d", disp, connected); mProcs->hotplug(const_cast<hwc_procs_t*>(mProcs), disp, connected); DLOGTRACE("hotplug callback processed and returned!"); } -#endif mDisplayAnalyzer->postHotplugEvent(connected); } diff --git a/moorefield_hdmi/common/devices/DummyDevice.cpp b/moorefield_hdmi/common/devices/DummyDevice.cpp index d763a70..7c9355e 100755 --- a/moorefield_hdmi/common/devices/DummyDevice.cpp +++ b/moorefield_hdmi/common/devices/DummyDevice.cpp @@ -21,11 +21,11 @@ namespace android { namespace intel { -DummyDevice::DummyDevice(uint32_t type, Hwcomposer& hwc) +DummyDevice::DummyDevice(uint32_t disp, Hwcomposer& hwc) : mInitialized(false), mConnected(false), mBlank(false), - mType(type), + mDisp(disp), mHwc(hwc), mVsyncObserver(NULL), mName("Dummy") @@ -54,7 +54,7 @@ bool DummyDevice::prepare(hwc_display_contents_1_t *display) { RETURN_FALSE_IF_NOT_INIT(); - if (!display || mType >= DEVICE_VIRTUAL) { + if (!display || mDisp >= DEVICE_VIRTUAL) { return true; } @@ -205,7 +205,7 @@ const char* DummyDevice::getName() const int DummyDevice::getType() const { - return mType; + return mDisp; } void DummyDevice::onVsync(int64_t timestamp) @@ -213,7 +213,7 @@ void DummyDevice::onVsync(int64_t timestamp) if (!mConnected) return; - mHwc.vsync(mType, timestamp); + mHwc.vsync(mDisp, timestamp); } void DummyDevice::dump(Dump& d) diff --git a/moorefield_hdmi/common/devices/ExternalDevice.cpp b/moorefield_hdmi/common/devices/ExternalDevice.cpp index bd7e35f..75f8700 100755 --- a/moorefield_hdmi/common/devices/ExternalDevice.cpp +++ b/moorefield_hdmi/common/devices/ExternalDevice.cpp @@ -23,8 +23,8 @@ namespace android { namespace intel { -ExternalDevice::ExternalDevice(Hwcomposer& hwc, DisplayPlaneManager& dpm) - : PhysicalDevice(DEVICE_EXTERNAL, hwc, dpm), +ExternalDevice::ExternalDevice(uint32_t disp, Hwcomposer& hwc, DisplayPlaneManager& dpm) + : PhysicalDevice(disp, DEVICE_EXTERNAL, hwc, dpm), mHdcpControl(NULL), mAbortModeSettingCond(), mPendingDrmMode(), @@ -146,7 +146,7 @@ void ExternalDevice::setDrmMode() Drm *drm = Hwcomposer::getInstance().getDrm(); mConnected = false; - mHwc.hotplug(mType, false); + mHwc.hotplug(mDisp, false); { Mutex::Autolock lock(mLock); @@ -155,7 +155,7 @@ void ExternalDevice::setDrmMode() status_t err = mAbortModeSettingCond.waitRelative(mLock, milliseconds(20)); if (err != -ETIMEDOUT) { ILOGTRACE("Mode settings is interrupted"); - mHwc.hotplug(mType, true); + mHwc.hotplug(mDisp, true); return; } } @@ -164,13 +164,13 @@ void ExternalDevice::setDrmMode() mHdcpControl->stopHdcp(); if (!drm->setDrmMode(mType, mPendingDrmMode)) { ELOGTRACE("failed to set Drm mode"); - mHwc.hotplug(mType, true); + mHwc.hotplug(mDisp, true); return; } if (!PhysicalDevice::updateDisplayConfigs()) { ELOGTRACE("failed to update display configs"); - mHwc.hotplug(mType, true); + mHwc.hotplug(mDisp, true); return; } mConnected = true; @@ -179,7 +179,7 @@ void ExternalDevice::setDrmMode() if (mHdcpControl->startHdcpAsync(HdcpLinkStatusListener, this) == false) { ELOGTRACE("startHdcpAsync() failed; HDCP is not enabled"); mHotplugEventPending = false; - mHwc.hotplug(mType, true); + mHwc.hotplug(mDisp, true); } } @@ -198,7 +198,7 @@ void ExternalDevice::HdcpLinkStatusListener(bool success) { if (mHotplugEventPending) { DLOGTRACE("HDCP authentication status %d, sending hotplug event...", success); - mHwc.hotplug(mType, mConnected); + mHwc.hotplug(mDisp, mConnected); mHotplugEventPending = false; } } @@ -240,7 +240,7 @@ void ExternalDevice::hotplugListener() if (mConnected == false) { mHotplugEventPending = false; mHdcpControl->stopHdcp(); - mHwc.hotplug(mType, mConnected); + mHwc.hotplug(mDisp, mConnected); } else { DLOGTRACE("start HDCP asynchronously..."); // delay sending hotplug event till HDCP is authenticated. @@ -249,7 +249,7 @@ void ExternalDevice::hotplugListener() if (ret == false) { ELOGTRACE("failed to start HDCP"); mHotplugEventPending = false; - mHwc.hotplug(mType, mConnected); + mHwc.hotplug(mDisp, mConnected); } } mActiveDisplayConfig = 0; diff --git a/moorefield_hdmi/common/devices/PhysicalDevice.cpp b/moorefield_hdmi/common/devices/PhysicalDevice.cpp index b4e8fa0..6b477ae 100755 --- a/moorefield_hdmi/common/devices/PhysicalDevice.cpp +++ b/moorefield_hdmi/common/devices/PhysicalDevice.cpp @@ -21,8 +21,9 @@ namespace android { namespace intel { -PhysicalDevice::PhysicalDevice(uint32_t type, Hwcomposer& hwc, DisplayPlaneManager& dpm) - : mType(type), +PhysicalDevice::PhysicalDevice(uint32_t disp, uint32_t type, Hwcomposer& hwc, DisplayPlaneManager& dpm) + : mDisp(disp), + mType(type), mHwc(hwc), mDisplayPlaneManager(dpm), mActiveDisplayConfig(-1), @@ -62,7 +63,7 @@ void PhysicalDevice::onGeometryChanged(hwc_display_contents_1_t *list) return; } - ALOGTRACE("disp = %d, layer number = %d", mType, list->numHwLayers); + ALOGTRACE("disp = %d, layer number = %d", mDisp, list->numHwLayers); // NOTE: should NOT be here if (mLayerList) { @@ -131,7 +132,7 @@ bool PhysicalDevice::vsyncControl(bool enabled) { RETURN_FALSE_IF_NOT_INIT(); - ALOGTRACE("disp = %d, enabled = %d", mType, enabled); + ALOGTRACE("disp = %d, enabled = %d", mDisp, enabled); return mVsyncObserver->control(enabled); } @@ -140,7 +141,7 @@ bool PhysicalDevice::blank(bool blank) RETURN_FALSE_IF_NOT_INIT(); mBlank = blank; - bool ret = mBlankControl->blank(mType, blank); + bool ret = mBlankControl->blank(mDisp, blank); if (ret == false) { ELOGTRACE("failed to blank device"); return false; diff --git a/moorefield_hdmi/common/devices/PrimaryDevice.cpp b/moorefield_hdmi/common/devices/PrimaryDevice.cpp index 62a573c..6f0126e 100755 --- a/moorefield_hdmi/common/devices/PrimaryDevice.cpp +++ b/moorefield_hdmi/common/devices/PrimaryDevice.cpp @@ -22,8 +22,8 @@ namespace android { namespace intel { -PrimaryDevice::PrimaryDevice(Hwcomposer& hwc, DisplayPlaneManager& dpm) - : PhysicalDevice(DEVICE_PRIMARY, hwc, dpm) +PrimaryDevice::PrimaryDevice(uint32_t disp, Hwcomposer& hwc, DisplayPlaneManager& dpm) + : PhysicalDevice(disp, DEVICE_PRIMARY, hwc, dpm) { CTRACE(); } diff --git a/moorefield_hdmi/include/DummyDevice.h b/moorefield_hdmi/include/DummyDevice.h index 74625a9..9bae6e4 100755 --- a/moorefield_hdmi/include/DummyDevice.h +++ b/moorefield_hdmi/include/DummyDevice.h @@ -26,7 +26,7 @@ class SoftVsyncObserver; class DummyDevice : public IDisplayDevice { public: - DummyDevice(uint32_t type, Hwcomposer& hwc); + DummyDevice(uint32_t disp, Hwcomposer& hwc); virtual ~DummyDevice(); public: @@ -61,7 +61,7 @@ protected: bool mInitialized; bool mConnected; bool mBlank; - uint32_t mType; + uint32_t mDisp; Hwcomposer& mHwc; SoftVsyncObserver *mVsyncObserver; diff --git a/moorefield_hdmi/include/ExternalDevice.h b/moorefield_hdmi/include/ExternalDevice.h index cff2b83..a88f7eb 100755 --- a/moorefield_hdmi/include/ExternalDevice.h +++ b/moorefield_hdmi/include/ExternalDevice.h @@ -27,7 +27,7 @@ namespace intel { class ExternalDevice : public PhysicalDevice { public: - ExternalDevice(Hwcomposer& hwc, DisplayPlaneManager& dpm); + ExternalDevice(uint32_t disp, Hwcomposer& hwc, DisplayPlaneManager& dpm); virtual ~ExternalDevice(); public: virtual bool initialize(); diff --git a/moorefield_hdmi/include/PhysicalDevice.h b/moorefield_hdmi/include/PhysicalDevice.h index f271021..795fb9b 100755 --- a/moorefield_hdmi/include/PhysicalDevice.h +++ b/moorefield_hdmi/include/PhysicalDevice.h @@ -32,7 +32,7 @@ class Hwcomposer; // Base class for primary and external devices class PhysicalDevice : public IDisplayDevice { public: - PhysicalDevice(uint32_t type, Hwcomposer& hwc, DisplayPlaneManager& dpm); + PhysicalDevice(uint32_t disp, uint32_t type, Hwcomposer& hwc, DisplayPlaneManager& dpm); virtual ~PhysicalDevice(); public: virtual bool prePrepare(hwc_display_contents_1_t *display); @@ -78,6 +78,7 @@ protected: friend class VsyncEventObserver; protected: + uint32_t mDisp; uint32_t mType; const char *mName; diff --git a/moorefield_hdmi/include/PrimaryDevice.h b/moorefield_hdmi/include/PrimaryDevice.h index 5ed6e93..00ab621 100755 --- a/moorefield_hdmi/include/PrimaryDevice.h +++ b/moorefield_hdmi/include/PrimaryDevice.h @@ -29,7 +29,7 @@ namespace intel { class PrimaryDevice : public PhysicalDevice { public: - PrimaryDevice(Hwcomposer& hwc, DisplayPlaneManager& dpm); + PrimaryDevice(uint32_t disp, Hwcomposer& hwc, DisplayPlaneManager& dpm); virtual ~PrimaryDevice(); public: virtual bool initialize(); diff --git a/moorefield_hdmi/platforms/merrifield_plus/PlatfExternalDevice.cpp b/moorefield_hdmi/platforms/merrifield_plus/PlatfExternalDevice.cpp index 8c36743..9def68d 100755 --- a/moorefield_hdmi/platforms/merrifield_plus/PlatfExternalDevice.cpp +++ b/moorefield_hdmi/platforms/merrifield_plus/PlatfExternalDevice.cpp @@ -23,9 +23,9 @@ namespace android { namespace intel { -PlatfExternalDevice::PlatfExternalDevice(Hwcomposer& hwc, +PlatfExternalDevice::PlatfExternalDevice(uint32_t disp, Hwcomposer& hwc, DisplayPlaneManager& dpm) - : ExternalDevice(hwc, dpm) + : ExternalDevice(disp, hwc, dpm) { CTRACE(); } diff --git a/moorefield_hdmi/platforms/merrifield_plus/PlatfExternalDevice.h b/moorefield_hdmi/platforms/merrifield_plus/PlatfExternalDevice.h index 7289260..edadd9a 100755 --- a/moorefield_hdmi/platforms/merrifield_plus/PlatfExternalDevice.h +++ b/moorefield_hdmi/platforms/merrifield_plus/PlatfExternalDevice.h @@ -23,7 +23,7 @@ namespace intel { class PlatfExternalDevice : public ExternalDevice { public: - PlatfExternalDevice(Hwcomposer& hwc, + PlatfExternalDevice(uint32_t disp, Hwcomposer& hwc, DisplayPlaneManager& dpm); virtual ~PlatfExternalDevice(); diff --git a/moorefield_hdmi/platforms/merrifield_plus/PlatfHwcomposer.cpp b/moorefield_hdmi/platforms/merrifield_plus/PlatfHwcomposer.cpp index a681579..311cfca 100755 --- a/moorefield_hdmi/platforms/merrifield_plus/PlatfHwcomposer.cpp +++ b/moorefield_hdmi/platforms/merrifield_plus/PlatfHwcomposer.cpp @@ -59,16 +59,16 @@ IDisplayDevice* PlatfHwcomposer::createDisplayDevice(int disp, switch (disp) { case IDisplayDevice::DEVICE_PRIMARY: #ifdef INTEL_SUPPORT_HDMI_PRIMARY - return new PlatfExternalDevice(*this, dpm); + return new PlatfExternalDevice((uint32_t)disp, *this, dpm); #else - return new PlatfPrimaryDevice(*this, dpm); + return new PlatfPrimaryDevice((uint32_t)disp, *this, dpm); #endif case IDisplayDevice::DEVICE_EXTERNAL: #ifdef INTEL_SUPPORT_HDMI_PRIMARY return new DummyDevice((uint32_t)disp, *this); #else - return new PlatfExternalDevice(*this, dpm); + return new PlatfExternalDevice((uint32_t)disp, *this, dpm); #endif case IDisplayDevice::DEVICE_VIRTUAL: diff --git a/moorefield_hdmi/platforms/merrifield_plus/PlatfPrimaryDevice.cpp b/moorefield_hdmi/platforms/merrifield_plus/PlatfPrimaryDevice.cpp index d819e75..cd64246 100755 --- a/moorefield_hdmi/platforms/merrifield_plus/PlatfPrimaryDevice.cpp +++ b/moorefield_hdmi/platforms/merrifield_plus/PlatfPrimaryDevice.cpp @@ -22,9 +22,9 @@ namespace android { namespace intel { -PlatfPrimaryDevice::PlatfPrimaryDevice(Hwcomposer& hwc, +PlatfPrimaryDevice::PlatfPrimaryDevice(uint32_t disp, Hwcomposer& hwc, DisplayPlaneManager& dpm) - : PrimaryDevice(hwc, dpm) + : PrimaryDevice(disp, hwc, dpm) { CTRACE(); } diff --git a/moorefield_hdmi/platforms/merrifield_plus/PlatfPrimaryDevice.h b/moorefield_hdmi/platforms/merrifield_plus/PlatfPrimaryDevice.h index 14404d2..8684370 100755 --- a/moorefield_hdmi/platforms/merrifield_plus/PlatfPrimaryDevice.h +++ b/moorefield_hdmi/platforms/merrifield_plus/PlatfPrimaryDevice.h @@ -24,7 +24,7 @@ namespace intel { class PlatfPrimaryDevice : public PrimaryDevice { public: - PlatfPrimaryDevice(Hwcomposer& hwc, + PlatfPrimaryDevice(uint32_t disp, Hwcomposer& hwc, DisplayPlaneManager& dpm); virtual ~PlatfPrimaryDevice(); |