overlay: Swap flips on 90 only for older mdp version.

Older mdp rotator does 90 first and flip next,
forcing HAL to swap flips, in presence of 90.

Newer mdp does flip first and 90 next, owing to DMA pipe.
(Also similar to GPU flip handling). So we can pass flips as-is.

Change-Id: I379509a07e45966262005666e7727e7923079d3a
This commit is contained in:
Saurabh Shah
2013-04-10 09:09:45 -07:00
parent b28da24954
commit d1a2278d97
6 changed files with 34 additions and 34 deletions

View File

@@ -670,8 +670,6 @@ static inline void updateSource(eTransform& orient, Whf& whf,
Dim srcCrop(crop.left, crop.top, Dim srcCrop(crop.left, crop.top,
crop.right - crop.left, crop.right - crop.left,
crop.bottom - crop.top); crop.bottom - crop.top);
//getMdpOrient will switch the flips if the source is 90 rotated.
//Clients in Android dont factor in 90 rotation while deciding the flip.
orient = static_cast<eTransform>(ovutils::getMdpOrient(orient)); orient = static_cast<eTransform>(ovutils::getMdpOrient(orient));
preRotateSource(orient, whf, srcCrop); preRotateSource(orient, whf, srcCrop);
crop.left = srcCrop.x; crop.left = srcCrop.x;

View File

@@ -117,8 +117,6 @@ void MdpCtrl::setPosition(const overlay::utils::Dim& d) {
void MdpCtrl::setTransform(const utils::eTransform& orient) { void MdpCtrl::setTransform(const utils::eTransform& orient) {
int rot = utils::getMdpOrient(orient); int rot = utils::getMdpOrient(orient);
setUserData(rot); setUserData(rot);
//getMdpOrient will switch the flips if the source is 90 rotated.
//Clients in Android dont factor in 90 rotation while deciding the flip.
mOrientation = static_cast<utils::eTransform>(rot); mOrientation = static_cast<utils::eTransform>(rot);
} }

View File

@@ -104,8 +104,6 @@ void MdpRot::setTransform(const utils::eTransform& rot)
{ {
int r = utils::getMdpOrient(rot); int r = utils::getMdpOrient(rot);
setRotations(r); setRotations(r);
//getMdpOrient will switch the flips if the source is 90 rotated.
//Clients in Android dont factor in 90 rotation while deciding the flip.
mOrientation = static_cast<utils::eTransform>(r); mOrientation = static_cast<utils::eTransform>(r);
ALOGE_IF(DEBUG_OVERLAY, "%s: r=%d", __FUNCTION__, r); ALOGE_IF(DEBUG_OVERLAY, "%s: r=%d", __FUNCTION__, r);
} }

View File

@@ -98,8 +98,6 @@ void MdssRot::setTransform(const utils::eTransform& rot)
int flags = utils::getMdpOrient(rot); int flags = utils::getMdpOrient(rot);
if (flags != -1) if (flags != -1)
setRotations(flags); setRotations(flags);
//getMdpOrient will switch the flips if the source is 90 rotated.
//Clients in Android dont factor in 90 rotation while deciding the flip.
mOrientation = static_cast<utils::eTransform>(flags); mOrientation = static_cast<utils::eTransform>(flags);
ALOGE_IF(DEBUG_OVERLAY, "%s: rot=%d", __FUNCTION__, flags); ALOGE_IF(DEBUG_OVERLAY, "%s: rot=%d", __FUNCTION__, flags);
} }

View File

@@ -180,6 +180,40 @@ int getHALFormat(int mdpFormat) {
return -1; return -1;
} }
int getMdpOrient(eTransform rotation) {
int retTrans = 0;
bool trans90 = false;
int mdpVersion = qdutils::MDPVersion::getInstance().getMDPVersion();
bool aFamily = (mdpVersion < qdutils::MDSS_V5);
ALOGD_IF(DEBUG_OVERLAY, "%s: In rotation = %d", __FUNCTION__, rotation);
if(rotation & OVERLAY_TRANSFORM_ROT_90) {
retTrans |= MDP_ROT_90;
trans90 = true;
}
if(rotation & OVERLAY_TRANSFORM_FLIP_H) {
if(trans90 && aFamily) {
//Swap for a-family, since its driver does 90 first
retTrans |= MDP_FLIP_UD;
} else {
retTrans |= MDP_FLIP_LR;
}
}
if(rotation & OVERLAY_TRANSFORM_FLIP_V) {
if(trans90 && aFamily) {
//Swap for a-family, since its driver does 90 first
retTrans |= MDP_FLIP_LR;
} else {
retTrans |= MDP_FLIP_UD;
}
}
ALOGD_IF(DEBUG_OVERLAY, "%s: Out rotation = %d", __FUNCTION__, retTrans);
return retTrans;
}
int getDownscaleFactor(const int& src_w, const int& src_h, int getDownscaleFactor(const int& src_w, const int& src_h,
const int& dst_w, const int& dst_h) { const int& dst_w, const int& dst_h) {
int dscale_factor = utils::ROT_DS_NONE; int dscale_factor = utils::ROT_DS_NONE;
@@ -215,9 +249,6 @@ static inline int compute(const uint32_t& x, const uint32_t& y,
return x - ( y + z ); return x - ( y + z );
} }
//Expects transform to be adjusted for clients of Android.
//i.e flips switched if 90 component present.
//See getMdpOrient()
void preRotateSource(const eTransform& tr, Whf& whf, Dim& srcCrop) { void preRotateSource(const eTransform& tr, Whf& whf, Dim& srcCrop) {
if(tr & OVERLAY_TRANSFORM_FLIP_H) { if(tr & OVERLAY_TRANSFORM_FLIP_H) {
srcCrop.x = compute(whf.w, srcCrop.x, srcCrop.w); srcCrop.x = compute(whf.w, srcCrop.x, srcCrop.w);

View File

@@ -537,29 +537,6 @@ inline void Dim::dump() const {
ALOGE("== Dump Dim x=%d y=%d w=%d h=%d start/end ==", x, y, w, h); ALOGE("== Dump Dim x=%d y=%d w=%d h=%d start/end ==", x, y, w, h);
} }
inline int getMdpOrient(eTransform rotation) {
ALOGE_IF(DEBUG_OVERLAY, "%s: rot=%d", __FUNCTION__, rotation);
switch(rotation)
{
case OVERLAY_TRANSFORM_0 : return 0;
case OVERLAY_TRANSFORM_FLIP_V: return MDP_FLIP_UD;
case OVERLAY_TRANSFORM_FLIP_H: return MDP_FLIP_LR;
case OVERLAY_TRANSFORM_ROT_90: return MDP_ROT_90;
//getMdpOrient will switch the flips if the source is 90 rotated.
//Clients in Android dont factor in 90 rotation while deciding flip.
case OVERLAY_TRANSFORM_ROT_90_FLIP_V:
return MDP_ROT_90 | MDP_FLIP_LR;
case OVERLAY_TRANSFORM_ROT_90_FLIP_H:
return MDP_ROT_90 | MDP_FLIP_UD;
case OVERLAY_TRANSFORM_ROT_180: return MDP_ROT_180;
case OVERLAY_TRANSFORM_ROT_270: return MDP_ROT_270;
default:
ALOGE("%s: invalid rotation value (value = 0x%x",
__FUNCTION__, rotation);
}
return -1;
}
// FB0 // FB0
template <int CHAN> template <int CHAN>
inline Dim getPositionS3DImpl(const Whf& whf) inline Dim getPositionS3DImpl(const Whf& whf)