hwcexternal: fixes in hwc_external

- instead of FBIOPUT_VSCREENINFO ioctl, use the new ioctl
  OVERLAY_PIPE_COMMIT to update the external display
- when MSMFB_OVERLAY_VSYNC_CTRL ioctls fails, return -errno

Change-Id: Ie37309615f7fa39f20fa347fc53c04f7fcab9740
CRs-fixed: 391564
This commit is contained in:
Arun Kumar K.R 2012-09-20 11:01:09 -07:00 committed by andrew.boren
parent 7181de24ab
commit c3dafd1e58
2 changed files with 23 additions and 6 deletions

View File

@ -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;

View File

@ -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;
}
};