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/overlayRotator.h b/liboverlay/overlayRotator.h
index d92bf16..075e46d 100644
--- a/liboverlay/overlayRotator.h
+++ b/liboverlay/overlayRotator.h
@@ -62,7 +62,7 @@
virtual void setSrcFB() = 0;
virtual bool enabled() const = 0;
- virtual int getSessId() const = 0;
+ virtual uint32_t getSessId() const = 0;
virtual int getDstMemId() const = 0;
virtual uint32_t getDstOffset() const = 0;
virtual void dump() const = 0;
@@ -105,7 +105,7 @@
/* Retusn true if rotator enabled */
virtual bool enabled() const = 0;
/* returns rotator session id */
- virtual int getSessId() const = 0;
+ virtual uint32_t getSessId() const = 0;
/* get dst (for offset and memory id) non-virt */
virtual int getDstMemId() const = 0;
virtual uint32_t getDstOffset() const = 0;
@@ -139,7 +139,7 @@
virtual void setEnable();
virtual void setDisable();
virtual bool enabled () const;
- virtual int getSessId() const;
+ virtual uint32_t getSessId() const;
virtual bool queueBuffer(int fd, uint32_t offset);
virtual void dump() const;
};
@@ -164,7 +164,7 @@
virtual void setDisable();
virtual bool enabled () const;
virtual void setSrcFB();
- virtual int getSessId() const;
+ virtual uint32_t getSessId() const;
virtual int getDstMemId() const;
virtual uint32_t getDstOffset() const;
virtual void dump() const;
@@ -226,7 +226,7 @@
void setRotations(uint32_t r);
void setSrcFB();
bool enabled() const;
- int getSessId() const;
+ uint32_t getSessId() const;
int getDstMemId() const;
uint32_t getDstOffset() const;
void dump() const;
@@ -240,8 +240,17 @@
/* reset underlying data, basically memset 0 */
void reset();
+ /* return true if current rotator config is different
+ * than last known config */
+ bool rotConfChanged() const;
+
+ /* save mRotImgInfo to be last known good config*/
+ void save();
+
/* rot info*/
msm_rotator_img_info mRotImgInfo;
+ /* Last saved rot info*/
+ msm_rotator_img_info mLSRotImgInfo;
/* rot data */
msm_rotator_data_info mRotDataInfo;
/* Orientation */
@@ -275,7 +284,7 @@
void setRotations(uint32_t r);
void setSrcFB();
bool enabled() const;
- int getSessId() const;
+ uint32_t getSessId() const;
int getDstMemId() const;
uint32_t getDstOffset() const;
void dump() const;
@@ -358,7 +367,7 @@
inline void Rotator::setRotations(uint32_t rot) {
mRot->setRotations (rot);
}
-inline int Rotator::getSessId() const {
+inline uint32_t Rotator::getSessId() const {
return mRot->getSessId();
}
inline void Rotator::dump() const {
@@ -384,7 +393,7 @@
inline void NullRotator::setEnable() {}
inline void NullRotator::setDisable() {}
inline bool NullRotator::enabled() const { return false; }
-inline int NullRotator::getSessId() const { return -1; }
+inline uint32_t NullRotator::getSessId() const { return 0; }
inline bool NullRotator::queueBuffer(int fd, uint32_t offset) { return true; }
inline void NullRotator::setSrcFB() {}
inline int NullRotator::getDstMemId() const { return -1; }
@@ -407,10 +416,21 @@
inline uint32_t MdpRot::getDstOffset() const {
return mRotDataInfo.dst.offset;
}
-inline int MdpRot::getSessId() const { return mRotImgInfo.session_id; }
+inline uint32_t MdpRot::getSessId() const { return mRotImgInfo.session_id; }
inline void MdpRot::setSrcFB() {
mRotDataInfo.src.flags |= MDP_MEMORY_ID_TYPE_FB;
}
+inline void MdpRot::save() {
+ mLSRotImgInfo = mRotImgInfo;
+}
+inline bool MdpRot::rotConfChanged() const {
+ // 0 means same
+ if(0 == ::memcmp(&mRotImgInfo, &mLSRotImgInfo,
+ sizeof (msm_rotator_img_info))) {
+ return false;
+ }
+ return true;
+}
//// MdssRot ////
@@ -426,7 +446,7 @@
inline uint32_t MdssRot::getDstOffset() const {
return mRotData.dst_data.offset;
}
-inline int MdssRot::getSessId() const { return mRotInfo.id; }
+inline uint32_t MdssRot::getSessId() const { return mRotInfo.id; }
inline void MdssRot::setSrcFB() {
mRotData.data.flags |= MDP_MEMORY_ID_TYPE_FB;
}