liboverlay: Call overlay set ioctl, only if input params change.

Change-Id: I753c30be4062be10655d7072c795052ef65f87ae

Conflicts:

	liboverlay/overlayLibUI.cpp
This commit is contained in:
Saurabh Shah 2012-02-24 15:10:54 -08:00 committed by Andrew Sutherland
parent 0358ea0b84
commit 050ef1b611
3 changed files with 46 additions and 16 deletions

View File

@ -2103,15 +2103,15 @@ bool OverlayDataChannel::setCrop(uint32_t x, uint32_t y, uint32_t w, uint32_t h)
}
normalize_crop(x, w);
normalize_crop(y, h);
if ((ov.src_rect.x == x) &&
(ov.src_rect.y == y) &&
(ov.src_rect.w == w) &&
(ov.src_rect.h == h))
return true;
normalize_crop(x, w);
normalize_crop(y, h);
ov.src_rect.x = x;
ov.src_rect.y = y;
ov.src_rect.w = w;

View File

@ -216,7 +216,7 @@ status_t Rotator::rotateBuffer(msm_rotator_data_info& rotData) {
OverlayUI::OverlayUI() : mChannelState(CLOSED), mOrientation(NO_INIT),
mFBNum(NO_INIT), mZorder(NO_INIT), mWaitForVsync(false), mIsFg(false),
mSessionID(NO_INIT) {
mSessionID(NO_INIT), mParamsChanged(false) {
memset(&mOvInfo, 0, sizeof(mOvInfo));
memset(&mRotInfo, 0, sizeof(mRotInfo));
}
@ -235,6 +235,13 @@ void OverlayUI::setSource(const overlay_buffer_info& info, int orientation) {
LOGE("%s: Unsupported format", __func__);
return;
}
mParamsChanged |= (mSource.width ^ info.width) ||
(mSource.height ^ info.height) ||
(mSource.format ^ format) ||
(mSource.size ^ info.size) ||
(mOrientation ^ orientation);
mSource.width = info.width;
mSource.height = info.height;
mSource.format = format;
@ -246,8 +253,6 @@ void OverlayUI::setSource(const overlay_buffer_info& info, int orientation) {
void OverlayUI::setDisplayParams(int fbNum, bool waitForVsync, bool isFg, int
zorder, bool isVGPipe) {
int flags = 0;
mFBNum = fbNum;
mOvInfo.is_fg = isFg;
if(false == waitForVsync)
flags |= MDP_OV_PLAY_NOWAIT;
@ -259,6 +264,13 @@ void OverlayUI::setDisplayParams(int fbNum, bool waitForVsync, bool isFg, int
else
flags &= ~MDP_OV_PIPE_SHARE;
mParamsChanged |= (mFBNum ^ fbNum) ||
(mOvInfo.is_fg ^ isFg) ||
(mOvInfo.flags ^ flags) ||
(mOvInfo.z_order ^ zorder);
mFBNum = fbNum;
mOvInfo.is_fg = isFg;
mOvInfo.flags = flags;
mOvInfo.z_order = zorder;
@ -266,6 +278,11 @@ void OverlayUI::setDisplayParams(int fbNum, bool waitForVsync, bool isFg, int
}
void OverlayUI::setPosition(int x, int y, int w, int h) {
mParamsChanged |= (mOvInfo.dst_rect.x ^ x) ||
(mOvInfo.dst_rect.y ^ y) ||
(mOvInfo.dst_rect.w ^ w) ||
(mOvInfo.dst_rect.h ^ h);
mOvInfo.dst_rect.x = x;
mOvInfo.dst_rect.y = y;
mOvInfo.dst_rect.w = w;
@ -273,6 +290,11 @@ void OverlayUI::setPosition(int x, int y, int w, int h) {
}
void OverlayUI::setCrop(int x, int y, int w, int h) {
mParamsChanged |= (mOvInfo.src_rect.x ^ x) ||
(mOvInfo.src_rect.y ^ y) ||
(mOvInfo.src_rect.w ^ w) ||
(mOvInfo.src_rect.h ^ h);
mOvInfo.src_rect.x = x;
mOvInfo.src_rect.y = y;
mOvInfo.src_rect.w = w;
@ -339,8 +361,6 @@ void OverlayUI::setupOvRotInfo() {
mRotInfo.rotations = mOvInfo.user_data[0];
if (mdp_rotation)
mRotInfo.enable = 1;
mOvInfo.dst_rect.w = mOvInfo.src_rect.w;
mOvInfo.dst_rect.h = mOvInfo.src_rect.h;
}
status_t OverlayUI::commit() {
@ -372,6 +392,7 @@ status_t OverlayUI::closeChannel() {
return BAD_VALUE;
}
mChannelState = CLOSED;
mParamsChanged = false;
memset(&mOvInfo, 0, sizeof(mOvInfo));
memset(&mRotInfo, 0, sizeof(mRotInfo));
return NO_ERROR;
@ -379,15 +400,22 @@ status_t OverlayUI::closeChannel() {
status_t OverlayUI::startOVSession() {
status_t ret = NO_INIT;
mdp_overlay ovInfo = mOvInfo;
ret = mobjDisplay.openDisplay(mFBNum);
if (ioctl(mobjDisplay.getFD(), MSMFB_OVERLAY_SET, &ovInfo)) {
LOGE("%s: Overlay set failed", __FUNCTION__);
ret = BAD_VALUE;
} else {
mSessionID = ovInfo.id;
mOvInfo = ovInfo;
ret = NO_ERROR;
if (ret != NO_ERROR)
return ret;
if(mParamsChanged) {
mParamsChanged = false;
mdp_overlay ovInfo = mOvInfo;
if (ioctl(mobjDisplay.getFD(), MSMFB_OVERLAY_SET, &ovInfo)) {
LOGE("Overlay set failed..");
ret = BAD_VALUE;
} else {
mSessionID = ovInfo.id;
mOvInfo = ovInfo;
ret = NO_ERROR;
}
}
return ret;
}

View File

@ -108,6 +108,8 @@ class OverlayUI {
mdp_overlay mOvInfo;
msm_rotator_img_info mRotInfo;
bool mParamsChanged;
OverlayUI(const OverlayUI& objOverlay);
OverlayUI& operator=(const OverlayUI& objOverlay);