liboverlay: Set mdp src format as rotator output format.

* Set mdp source format as rotator output format
rather than determine it from a fixed mapping of
input/output formats.

* This is needed since for the same input format
to rotator, fastyuv mode if enabled may result in
a different output format than the one if the mode
is not enabled.

* Do the inline optimization for rotator where possible

CRs-fixed: 451064
Change-Id: If0bb2f3a44df10968383ab3f5c3625257518934d
diff --git a/liboverlay/overlayMdp.cpp b/liboverlay/overlayMdp.cpp
index ee1aae7..8bca85f 100644
--- a/liboverlay/overlayMdp.cpp
+++ b/liboverlay/overlayMdp.cpp
@@ -1,6 +1,6 @@
 /*
 * Copyright (C) 2008 The Android Open Source Project
-* Copyright (c) 2010-2012, The Linux Foundation. All rights reserved.
+* Copyright (c) 2010-2013, The Linux Foundation. All rights reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
@@ -15,6 +15,7 @@
 * limitations under the License.
 */
 
+#include <mdp_version.h>
 #include "overlayUtils.h"
 #include "overlayMdp.h"
 
@@ -249,10 +250,24 @@
             whf.w = utils::alignup(whf.w, 64);
             whf.h = utils::alignup(whf.h, 32);
         }
-        //For example: If original format is tiled, rotator outputs non-tiled,
-        //so update mdp's src fmt to that.
+        /*For example: If original format is tiled, rotator outputs non-tiled,
+         *so update mdp's src fmt to that.
+         */
         whf.format = utils::getRotOutFmt(whf.format);
         setSrcWhf(whf);
+        /* The above format will be overwritten in function updateSrcformat
+         * after doing rotator start. Format is then set depending on
+         * whether the fastyuv mode is used by the rotator.
+         */
+    }
+}
+
+void MdpCtrl::updateSrcformat(const uint32_t& inputformat) {
+    int version = qdutils::MDPVersion::getInstance().getMDPVersion();
+    if ((version >= qdutils::MDP_V4_2) && (version < qdutils::MDSS_V5)) {
+        utils::Whf whf = getSrcWhf();
+        whf.format =  inputformat;
+        setSrcWhf(whf);
     }
 }