diff options
-rw-r--r-- | cmds/hdmid/HDMIDaemon.cpp | 17 | ||||
-rw-r--r-- | include/surfaceflinger/ISurfaceComposer.h | 10 | ||||
-rw-r--r-- | include/surfaceflinger/SurfaceComposerClient.h | 8 | ||||
-rw-r--r-- | libs/gui/ISurfaceComposer.cpp | 36 | ||||
-rw-r--r-- | libs/gui/SurfaceComposerClient.cpp | 14 | ||||
-rw-r--r-- | services/surfaceflinger/SurfaceFlinger.cpp | 35 | ||||
-rw-r--r-- | services/surfaceflinger/SurfaceFlinger.h | 8 |
7 files changed, 59 insertions, 69 deletions
diff --git a/cmds/hdmid/HDMIDaemon.cpp b/cmds/hdmid/HDMIDaemon.cpp index 7c1684b..acfa74b 100644 --- a/cmds/hdmid/HDMIDaemon.cpp +++ b/cmds/hdmid/HDMIDaemon.cpp @@ -69,6 +69,11 @@ namespace android { #define SYSFS_HPD DEVICE_ROOT "/" DEVICE_NODE "/hpd" #define SYSFS_HDCP_PRESENT DEVICE_ROOT "/" DEVICE_NODE "/hdcp_present" +#ifdef QCOM_HARDWARE +//Should match to the external_display_type HDMI in QComUI +#define EXT_DISPLAY_HDMI 1 +#endif + HDMIDaemon::HDMIDaemon() : Thread(false), mFrameworkSock(-1), mAcceptedConnection(-1), mUeventSock(-1), mHDMIUeventQueueHead(NULL), fd1(-1), mCurrentID(-1), mNxtMode(-1) @@ -525,7 +530,11 @@ void HDMIDaemon::setResolution(int ID) if (cur->video_format == ID) mode = cur; } +#ifdef QCOM_HARDWARE + SurfaceComposerClient::enableExternalDisplay(EXT_DISPLAY_HDMI, 0); +#else SurfaceComposerClient::enableHDMIOutput(0); +#endif ioctl(fd1, FBIOGET_VSCREENINFO, &info); LOGD("GET Info<ID=%d %dx%d (%d,%d,%d), (%d,%d,%d) %dMHz>", info.reserved[3], info.xres, info.yres, @@ -549,7 +558,11 @@ void HDMIDaemon::setResolution(int ID) ioctl(fd1, FBIOPAN_DISPLAY, &info); property_set("hw.hdmiON", "1"); //Inform SF about HDMI +#ifdef QCOM_HARDWARE + SurfaceComposerClient::enableExternalDisplay(EXT_DISPLAY_HDMI, 1); +#else SurfaceComposerClient::enableHDMIOutput(1); +#endif } int HDMIDaemon::processFrameworkCommand() @@ -582,7 +595,11 @@ int HDMIDaemon::processFrameworkCommand() if (!openFramebuffer()) return -1; property_set("hw.hdmiON", "0"); +#ifdef QCOM_HARDWARE + SurfaceComposerClient::enableExternalDisplay(EXT_DISPLAY_HDMI, 0); +#else SurfaceComposerClient::enableHDMIOutput(0); +#endif close(fd1); fd1 = -1; } else if (!strncmp(buffer, HDMI_CMD_SET_ASWIDTH, strlen(HDMI_CMD_SET_ASWIDTH))) { diff --git a/include/surfaceflinger/ISurfaceComposer.h b/include/surfaceflinger/ISurfaceComposer.h index 2c60993..c96f88a 100644 --- a/include/surfaceflinger/ISurfaceComposer.h +++ b/include/surfaceflinger/ISurfaceComposer.h @@ -133,10 +133,8 @@ public: const sp<ISurfaceTexture>& surface) const = 0; #ifdef QCOM_HDMI_OUT - //HDMI SPecific functions - virtual void enableHDMIOutput(int enable) = 0; - virtual void setActionSafeWidthRatio(float asWidthRatio) = 0; - virtual void setActionSafeHeightRatio(float asHeightRatio) = 0; + //External display specific functions + virtual void enableExternalDisplay(int disp_type, int enable) = 0; #endif }; @@ -160,9 +158,7 @@ public: TURN_ELECTRON_BEAM_ON, AUTHENTICATE_SURFACE, #ifdef QCOM_HDMI_OUT - ENABLE_HDMI_OUTPUT, - SET_ACTIONSAFE_WIDTH_RATIO, - SET_ACTIONSAFE_HEIGHT_RATIO + EXTERNAL_DISPLAY, #endif }; diff --git a/include/surfaceflinger/SurfaceComposerClient.h b/include/surfaceflinger/SurfaceComposerClient.h index 842a86b..3c7a022 100644 --- a/include/surfaceflinger/SurfaceComposerClient.h +++ b/include/surfaceflinger/SurfaceComposerClient.h @@ -110,13 +110,13 @@ public: //! Open a composer transaction on all active SurfaceComposerClients. static void openGlobalTransaction(); - + //! Close a composer transaction on all active SurfaceComposerClients. static void closeGlobalTransaction(bool synchronous = false); - + //! Freeze the specified display but not transactions. static status_t freezeDisplay(DisplayID dpy, uint32_t flags = 0); - + //! Resume updates on the specified display. static status_t unfreezeDisplay(DisplayID dpy, uint32_t flags = 0); @@ -137,7 +137,7 @@ public: #ifdef QCOM_HDMI_OUT //HDMI SPecific functions - static void enableHDMIOutput(int enable); + static void enableExternalDisplay(int disp_type, int enable); static void setActionSafeWidthRatio(float asWidthRatio); static void setActionSafeHeightRatio(float asHeightRatio); #endif diff --git a/libs/gui/ISurfaceComposer.cpp b/libs/gui/ISurfaceComposer.cpp index c0bdb08..1b18d4f 100644 --- a/libs/gui/ISurfaceComposer.cpp +++ b/libs/gui/ISurfaceComposer.cpp @@ -176,28 +176,13 @@ public: } #ifdef QCOM_HDMI_OUT - virtual void enableHDMIOutput(int enable) + virtual void enableExternalDisplay(int disp_type, int enable) { Parcel data, reply; data.writeInterfaceToken(ISurfaceComposer::getInterfaceDescriptor()); + data.writeInt32(disp_type); data.writeInt32(enable); - remote()->transact(BnSurfaceComposer::ENABLE_HDMI_OUTPUT, data, &reply); - } - - virtual void setActionSafeWidthRatio(float asWidthRatio) - { - Parcel data, reply; - data.writeInterfaceToken(ISurfaceComposer::getInterfaceDescriptor()); - data.writeFloat(asWidthRatio); - remote()->transact(BnSurfaceComposer::SET_ACTIONSAFE_WIDTH_RATIO, data, &reply); - } - - virtual void setActionSafeHeightRatio(float asHeightRatio) - { - Parcel data, reply; - data.writeInterfaceToken(ISurfaceComposer::getInterfaceDescriptor()); - data.writeFloat(asHeightRatio); - remote()->transact(BnSurfaceComposer::SET_ACTIONSAFE_HEIGHT_RATIO, data, &reply); + remote()->transact(BnSurfaceComposer::EXTERNAL_DISPLAY, data, &reply); } #endif @@ -282,20 +267,11 @@ status_t BnSurfaceComposer::onTransact( reply->writeInt32(result); } break; #ifdef QCOM_HDMI_OUT - case ENABLE_HDMI_OUTPUT: { + case EXTERNAL_DISPLAY: { CHECK_INTERFACE(ISurfaceComposer, data, reply); + int disp_type = data.readInt32(); int enable = data.readInt32(); - enableHDMIOutput(enable); - } break; - case SET_ACTIONSAFE_WIDTH_RATIO: { - CHECK_INTERFACE(ISurfaceComposer, data, reply); - float asWidthRatio = data.readFloat(); - setActionSafeWidthRatio(asWidthRatio); - } break; - case SET_ACTIONSAFE_HEIGHT_RATIO: { - CHECK_INTERFACE(ISurfaceComposer, data, reply); - float asHeightRatio = data.readFloat(); - setActionSafeHeightRatio(asHeightRatio); + enableExternalDisplay(disp_type, enable); } break; #endif default: diff --git a/libs/gui/SurfaceComposerClient.cpp b/libs/gui/SurfaceComposerClient.cpp index 6264395..4e570e8 100644 --- a/libs/gui/SurfaceComposerClient.cpp +++ b/libs/gui/SurfaceComposerClient.cpp @@ -281,20 +281,10 @@ status_t Composer::setFreezeTint(const sp<SurfaceComposerClient>& client, } #ifdef QCOM_HDMI_OUT -void SurfaceComposerClient::enableHDMIOutput(int enable) +void SurfaceComposerClient::enableExternalDisplay(int disp_type, int enable) { sp<ISurfaceComposer> sm(getComposerService()); - return sm->enableHDMIOutput(enable); -} - -void SurfaceComposerClient::setActionSafeWidthRatio(float asWidthRatio){ - sp<ISurfaceComposer> sm(getComposerService()); - return sm->setActionSafeWidthRatio(asWidthRatio); -} - -void SurfaceComposerClient::setActionSafeHeightRatio(float asHeightRatio){ - sp<ISurfaceComposer> sm(getComposerService()); - return sm->setActionSafeHeightRatio(asHeightRatio); + return sm->enableExternalDisplay(disp_type, enable); } #endif diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp index 99e42fc..a157bce 100644 --- a/services/surfaceflinger/SurfaceFlinger.cpp +++ b/services/surfaceflinger/SurfaceFlinger.cpp @@ -106,7 +106,7 @@ SurfaceFlinger::SurfaceFlinger() mLastTransactionTime(0), mBootFinished(false), #ifdef QCOM_HDMI_OUT - mHDMIOutput(EXT_DISPLAY_OFF), + mExtDispOutput(EXT_TYPE_NONE), #endif #ifdef QCOM_HARDWARE mCanSkipComposition(false), @@ -428,10 +428,11 @@ bool SurfaceFlinger::threadLoop() //Necessary for race-free overlay channel management. //Must always be held only after handleConsoleEvents() since //that could enable / disable HDMI based on suspend resume - Mutex::Autolock _l(mHDMILock); + Mutex::Autolock _l(mExtDispLock); #else // if we're in a global transaction, don't do anything. #endif + const uint32_t mask = eTransactionNeeded | eTraversalNeeded; uint32_t transactionFlags = peekTransactionFlags(mask); if (UNLIKELY(transactionFlags)) { @@ -524,7 +525,7 @@ void SurfaceFlinger::handleConsoleEvents() if (what & eConsoleAcquired) { hw.acquireScreen(); #ifdef QCOM_HDMI_OUT - updateHwcHDMI(mHDMIOutput); + updateHwcExternalDisplay(mExtDispOutput); #endif // this is a temporary work-around, eventually this should be called // by the power-manager @@ -535,7 +536,7 @@ void SurfaceFlinger::handleConsoleEvents() if (hw.isScreenAcquired()) { hw.releaseScreen(); #ifdef QCOM_HDMI_OUT - updateHwcHDMI(false); + updateHwcExternalDisplay(false); #endif } } @@ -1395,20 +1396,30 @@ int SurfaceFlinger::setOrientation(DisplayID dpy, } #ifdef QCOM_HDMI_OUT -void SurfaceFlinger::updateHwcHDMI(bool enable) +void SurfaceFlinger::updateHwcExternalDisplay(int externaltype) { invalidateHwcGeometry(); const DisplayHardware& hw(graphicPlane(0).displayHardware()); HWComposer& hwc(hw.getHwComposer()); - hwc.enableHDMIOutput(enable); + hwc.enableHDMIOutput(externaltype); } -void SurfaceFlinger::enableHDMIOutput(int enable) -{ - Mutex::Autolock _l(mHDMILock); - mHDMIOutput = enable; - updateHwcHDMI(enable); - signalEvent(); +/* + * Handles the externalDisplay event + * @param: disp_type - external display type(HDMI/WFD) + * @param: value - value(on/off) + * */ +void SurfaceFlinger::enableExternalDisplay(int disp_type, int value) +{ + Mutex::Autolock _l(mExtDispLock); + external_display_type newType = handleEventHDMI( + (external_display_type) disp_type, value, + (external_display_type) mExtDispOutput); + if(newType != mExtDispOutput) { + mExtDispOutput = (int) newType; + updateHwcExternalDisplay(mExtDispOutput); + signalEvent(); + } } void SurfaceFlinger::setActionSafeWidthRatio(float asWidthRatio){ diff --git a/services/surfaceflinger/SurfaceFlinger.h b/services/surfaceflinger/SurfaceFlinger.h index afc02d4..3406bb3 100644 --- a/services/surfaceflinger/SurfaceFlinger.h +++ b/services/surfaceflinger/SurfaceFlinger.h @@ -184,7 +184,7 @@ public: #ifdef QCOM_HDMI_OUT //HDMI Specific - virtual void enableHDMIOutput(int enable); + virtual void enableExternalDisplay(int disp_type, int externaltype); virtual void setActionSafeWidthRatio(float asWidthRatio); virtual void setActionSafeHeightRatio(float asHeightRatio); #endif @@ -356,7 +356,7 @@ private: #ifdef QCOM_HDMI_OUT //HDMI Specific - void updateHwcHDMI(bool enable); + void updateHwcExternalDisplay(int externaltype); #endif #ifdef QCOM_HARDWARE bool isGPULayerPresent(); @@ -416,8 +416,8 @@ private: #ifdef QCOM_HDMI_OUT //HDMI specific - bool mHDMIOutput; - Mutex mHDMILock; + int mExtDispOutput; + Mutex mExtDispLock; bool mOrientationChanged; #endif #ifdef QCOM_HARDWARE |