diff --git a/libhwcomposer/hwc_utils.cpp b/libhwcomposer/hwc_utils.cpp index 57f94fe3..1367bf73 100644 --- a/libhwcomposer/hwc_utils.cpp +++ b/libhwcomposer/hwc_utils.cpp @@ -670,8 +670,6 @@ static inline void updateSource(eTransform& orient, Whf& whf, Dim srcCrop(crop.left, crop.top, crop.right - crop.left, 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(ovutils::getMdpOrient(orient)); preRotateSource(orient, whf, srcCrop); crop.left = srcCrop.x; diff --git a/liboverlay/overlayMdp.cpp b/liboverlay/overlayMdp.cpp index ee8bf513..e6dcbe98 100644 --- a/liboverlay/overlayMdp.cpp +++ b/liboverlay/overlayMdp.cpp @@ -117,8 +117,6 @@ void MdpCtrl::setPosition(const overlay::utils::Dim& d) { void MdpCtrl::setTransform(const utils::eTransform& orient) { int rot = utils::getMdpOrient(orient); 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(rot); } diff --git a/liboverlay/overlayMdpRot.cpp b/liboverlay/overlayMdpRot.cpp index d1e036c5..ecf31fa8 100755 --- a/liboverlay/overlayMdpRot.cpp +++ b/liboverlay/overlayMdpRot.cpp @@ -104,8 +104,6 @@ void MdpRot::setTransform(const utils::eTransform& rot) { int r = utils::getMdpOrient(rot); 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(r); ALOGE_IF(DEBUG_OVERLAY, "%s: r=%d", __FUNCTION__, r); } diff --git a/liboverlay/overlayMdssRot.cpp b/liboverlay/overlayMdssRot.cpp index cf6d6fab..b9a22a9f 100644 --- a/liboverlay/overlayMdssRot.cpp +++ b/liboverlay/overlayMdssRot.cpp @@ -98,8 +98,6 @@ void MdssRot::setTransform(const utils::eTransform& rot) int flags = utils::getMdpOrient(rot); if (flags != -1) 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(flags); ALOGE_IF(DEBUG_OVERLAY, "%s: rot=%d", __FUNCTION__, flags); } diff --git a/liboverlay/overlayUtils.cpp b/liboverlay/overlayUtils.cpp index 898132f2..edf3cec2 100644 --- a/liboverlay/overlayUtils.cpp +++ b/liboverlay/overlayUtils.cpp @@ -180,6 +180,40 @@ int getHALFormat(int mdpFormat) { 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, const int& dst_w, const int& dst_h) { 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 ); } -//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) { if(tr & OVERLAY_TRANSFORM_FLIP_H) { srcCrop.x = compute(whf.w, srcCrop.x, srcCrop.w); diff --git a/liboverlay/overlayUtils.h b/liboverlay/overlayUtils.h index c189bb78..7b7addef 100644 --- a/liboverlay/overlayUtils.h +++ b/liboverlay/overlayUtils.h @@ -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); } -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 template inline Dim getPositionS3DImpl(const Whf& whf)