Display: Set WAIT on primary and NO_WAIT on HDMI

When queuing buffers using the overlay:
- Set the NO_WAIT flag for the HDMI channel.
- Set the WAIT flag for the primary channel.
- Queue the buffer on the HDMI first.
- Queue the buffer on the primary.
- Wait for the HDMI Vsync.

Change-Id: Id24e9551230b7a7134bd21a7b3a9e8658f7de222
This commit is contained in:
Naomi Luis 2011-11-28 15:29:08 -08:00
parent 0e8663d5f2
commit e2de425bc4
3 changed files with 29 additions and 5 deletions

View File

@ -768,7 +768,7 @@ static int hwc_prepare(hwc_composer_device_t *dev, hwc_layer_list_t* list) {
continue;
}
if (hnd && (hnd->bufferType == BUFFER_TYPE_VIDEO) && (yuvBufferCount == 1)) {
bool waitForVsync = skipComposition ? true:false;
bool waitForVsync = true;
if (!isValidDestination(hwcModule->fbDevice, list->hwLayers[i].displayFrame)) {
list->hwLayers[i].compositionType = HWC_FRAMEBUFFER;
#ifdef USE_OVERLAY

View File

@ -466,8 +466,8 @@ bool Overlay::updateOverlaySource(const overlay_buffer_info& info, int orientati
int orientHdmi = 0;
int orientPrimary = sHDMIAsPrimary ? 0 : orientation;
int orient[2] = {orientPrimary, orientHdmi};
// enable waitForVsync on HDMI
bool waitForHDMI = true;
// disable waitForVsync on HDMI, since we call the wait ioctl
bool waitForHDMI = false;
bool waitForPrimary = sHDMIAsPrimary ? true : waitForVsync;
bool waitCond[2] = {waitForPrimary, waitForHDMI};
@ -582,7 +582,7 @@ bool Overlay::setSource(const overlay_buffer_info& info, int orientation,
if (FRAMEBUFFER_1 == i) {
// Disable rotation for HDMI
noRot = true;
waitForVsync = true;
waitForVsync = false;
}
if(!startChannel(info, i, noRot, false, mS3DFormat,
i, waitForVsync, num_buffers)) {
@ -715,6 +715,10 @@ bool Overlay::queueBuffer(uint32_t offset, int channel) {
return objOvDataChannel[channel].queueBuffer(offset);
}
bool Overlay::waitForHdmiVsync(int channel) {
return objOvDataChannel[channel].waitForHdmiVsync();
}
bool Overlay::queueBuffer(buffer_handle_t buffer) {
private_handle_t const* hnd = reinterpret_cast
<private_handle_t const*>(buffer);
@ -737,12 +741,17 @@ bool Overlay::queueBuffer(buffer_handle_t buffer) {
case OV_3D_VIDEO_3D_PANEL:
case OV_3D_VIDEO_2D_TV:
case OV_3D_VIDEO_3D_TV:
for (int i=0; i<NUM_CHANNELS; i++) {
for (int i=NUM_CHANNELS-1; i>=0; i--) {
if(!queueBuffer(fd, offset, i)) {
LOGE("%s:failed for channel %d", __FUNCTION__, i);
return false;
}
}
//Wait for HDMI done..
if(!waitForHdmiVsync(VG1_PIPE)) {
LOGE("%s: waitforHdmiVsync failed", __FUNCTION__);
return false;
}
break;
default:
LOGE("%s:Unknown state %d", __FUNCTION__, mState);
@ -1608,6 +1617,19 @@ bool OverlayDataChannel::queue(uint32_t offset) {
reportError("overlay play failed.");
return false;
}
return true;
}
bool OverlayDataChannel::waitForHdmiVsync() {
if (!isChannelUP()) {
reportError("waitForHdmiVsync: channel not up");
return false;
}
if (ioctl(mFD, MSMFB_OVERLAY_PLAY_WAIT, &mOvData)) {
reportError("waitForHdmiVsync: MSMFB_OVERLAY_PLAY_WAIT failed");
return false;
}
return true;
}

View File

@ -250,6 +250,7 @@ public:
bool closeDataChannel();
bool setFd(int fd);
bool queueBuffer(uint32_t offset);
bool waitForHdmiVsync();
bool setCrop(uint32_t x, uint32_t y, uint32_t w, uint32_t h);
bool getCropS3D(overlay_rect *inRect, int channel, int format, overlay_rect *rect);
bool isChannelUP() const { return (mFD > 0); }
@ -297,6 +298,7 @@ public:
bool setSource(const overlay_buffer_info& info, int orientation, bool hdmiConnected,
bool ignoreFB = false, int numBuffers = 2);
bool setCrop(uint32_t x, uint32_t y, uint32_t w, uint32_t h);
bool waitForHdmiVsync(int channel);
int getChannelStatus() const { return (mChannelUP ? OVERLAY_CHANNEL_UP: OVERLAY_CHANNEL_DOWN); }
void setHDMIStatus (bool isHDMIConnected) { mHDMIConnected = isHDMIConnected; mState = -1; }
int getHDMIStatus() const {return (mHDMIConnected ? HDMI_ON : HDMI_OFF); }