overlay: mdprot: Call rotator start only on config change.

Call ROTATOR_START ioctl only if the rotator config changes.
Save the last good config when the start succeeds.

Make getSessId()'s return type uint32_t from int to match the member's.
This was causing all methods to think the rotator session id is a negative
invalid number. This ensures ROTATOR_FINISH is called.

Bug: 7320914
Change-Id: I5ca048ea866316f18d8df14dc08218fca2c82bdf
Signed-off-by: Iliyan Malchev <malchev@google.com>
diff --git a/liboverlay/mdpRotator.cpp b/liboverlay/mdpRotator.cpp
index 18d1bec..cb18dac 100755
--- a/liboverlay/mdpRotator.cpp
+++ b/liboverlay/mdpRotator.cpp
@@ -81,12 +81,15 @@
 
 bool MdpRot::commit() {
     doTransform();
-    if(!overlay::mdp_wrapper::startRotator(mFd.getFD(), mRotImgInfo)) {
-        ALOGE("MdpRot commit failed");
-        dump();
-        return false;
+    if(rotConfChanged()) {
+        if(!overlay::mdp_wrapper::startRotator(mFd.getFD(), mRotImgInfo)) {
+            ALOGE("MdpRot commit failed");
+            dump();
+            return false;
+        }
+        save();
+        mRotDataInfo.session_id = mRotImgInfo.session_id;
     }
-    mRotDataInfo.session_id = mRotImgInfo.session_id;
     return true;
 }
 
@@ -156,6 +159,7 @@
 
 void MdpRot::reset() {
     ovutils::memset0(mRotImgInfo);
+    ovutils::memset0(mLSRotImgInfo);
     ovutils::memset0(mRotDataInfo);
     ovutils::memset0(mMem.curr().mRotOffset);
     ovutils::memset0(mMem.prev().mRotOffset);