Overlay: Switch the flip for MDP, on 90 rotated source
Camera client doesn't factor in the 90-rotated source when setting the flip
Switch the flips when the source is 90-rotated.
Change-Id: Ia5f18afff4384a33b8ad2ca051be1a120aefa4d5
Acked-by: Kinjal Bhavsar <kbhavsar@codeaurora.org>
diff --git a/liboverlay/overlayMdp.cpp b/liboverlay/overlayMdp.cpp
index 2cdd003..6fd1eb8 100644
--- a/liboverlay/overlayMdp.cpp
+++ b/liboverlay/overlayMdp.cpp
@@ -97,9 +97,12 @@
bool MdpCtrl::setTransform(const utils::eTransform& orient,
const bool& rotUsed) {
- mOrientation = 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<utils::eTransform>(rot);
+
//Rotator can be requested by client even if layer has 0 orientation.
mRotUsed = rotUsed;
return true;
diff --git a/liboverlay/overlayRotator.cpp b/liboverlay/overlayRotator.cpp
index 306e28f..5bf7dbc 100644
--- a/liboverlay/overlayRotator.cpp
+++ b/liboverlay/overlayRotator.cpp
@@ -80,10 +80,13 @@
void MdpRot::setTransform(const utils::eTransform& rot, const bool& rotUsed)
{
- mOrientation = rot;
int r = utils::getMdpOrient(rot);
- ALOGE_IF(DEBUG_OVERLAY, "%s: r=%d", __FUNCTION__, 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);
+ ALOGE_IF(DEBUG_OVERLAY, "%s: r=%d", __FUNCTION__, r);
+
setDisable();
if(rotUsed) {
setEnable();
diff --git a/liboverlay/overlayUtils.h b/liboverlay/overlayUtils.h
index a09010c..66c5df7 100644
--- a/liboverlay/overlayUtils.h
+++ b/liboverlay/overlayUtils.h
@@ -640,10 +640,12 @@
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_UD;
- case OVERLAY_TRANSFORM_ROT_90_FLIP_H:
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: