diff --git a/libhwcomposer/hwc.cpp b/libhwcomposer/hwc.cpp index 205e5e7..9957a71 100644 --- a/libhwcomposer/hwc.cpp +++ b/libhwcomposer/hwc.cpp @@ -169,6 +169,7 @@ static int hwc_eventControl(struct hwc_composer_device* dev, if(ctx->mExtDisplay->isHDMIConfigured() && (ctx->mExtDisplay->getExternalDisplay()==EXTERN_DISPLAY_FB1)) { + // enableHDMIVsync will return -errno on error ret = ctx->mExtDisplay->enableHDMIVsync(value); } break; diff --git a/libhwcomposer/hwc_external.cpp b/libhwcomposer/hwc_external.cpp index 5ecb72e..e862ef2 100644 --- a/libhwcomposer/hwc_external.cpp +++ b/libhwcomposer/hwc_external.cpp @@ -249,9 +249,12 @@ const char* msmFbDevicePath[2] = { "/dev/graphics/fb1", bool ExternalDisplay::openFrameBuffer(int fbNum) { if (mFd == -1) { + ALOGD_IF(DEBUG, "In %s: opening the framebuffer device = %d", + __FUNCTION__, fbNum); mFd = open(msmFbDevicePath[fbNum-1], O_RDWR); if (mFd < 0) - ALOGE("%s: %s not available", __FUNCTION__, msmFbDevicePath[fbNum-1]); + ALOGE("%s: %s not available", __FUNCTION__, + msmFbDevicePath[fbNum-1]); } return (mFd > 0); } @@ -499,6 +502,8 @@ void ExternalDisplay::setExternalDisplay(int connected) connected); // Store the external display mExternalDisplay = connected; + ALOGD_IF(DEBUG, "In %s: mExternalDisplay = %d", __FUNCTION__, + mExternalDisplay); const char* prop = (connected) ? "1" : "0"; // set system property property_set("hw.hdmiON", prop); @@ -542,30 +547,41 @@ bool ExternalDisplay::writeHPDOption(int userOption) const return ret; } +/* + * commits the changes to the external display + * mExternalDisplay has the mixer number(1-> HDMI 2-> WFD) + */ bool ExternalDisplay::commit() { if(mFd == -1) { return false; - } else if(ioctl(mFd, FBIOPUT_VSCREENINFO, &mVInfo) == -1) { - ALOGE("%s: FBIOPUT_VSCREENINFO failed, str: %s", __FUNCTION__, - strerror(errno)); - return false; + } else if(ioctl(mFd, MSMFB_OVERLAY_COMMIT, &mExternalDisplay) == -1) { + ALOGE("%s: MSMFB_OVERLAY_COMMIT failed errno: %d , str: %s", + __FUNCTION__, errno, strerror(errno)); + return false; } return true; } +/* + * return 0 on success + * return -errno on ioctl failure as the hwc_eventControl need + * to return -errno. + */ int ExternalDisplay::enableHDMIVsync(int enable) { + int ret = 0; #ifndef NO_HW_VSYNC if(mFd > 0) { int ret = ioctl(mFd, MSMFB_OVERLAY_VSYNC_CTRL, &enable); if (ret<0) { ALOGE("%s: enabling HDMI vsync failed, str: %s", __FUNCTION__, strerror(errno)); + ret = -errno; } } #endif - return -errno; + return ret; } };