hwc/overlay: Video on 4k2k external, 4k2k rotation.
-Add support for Video via overlay on 4k2k external panel.
-Add support for rotating videos on 4k2k panels. We use
pre-rotation in hwc to rotate a video into a single buffer,
irrespective of panel size. Then this buffer is fed to MDP.
Rotator objects are managed by the new RotMgr.
-Cleaup mdpcomp and overlay.
Change-Id: Ifb08534747e8e18b6c58dd8a3e1a9947409100f1
diff --git a/liboverlay/overlayRotator.cpp b/liboverlay/overlayRotator.cpp
index 90a1e7a..3861297 100644
--- a/liboverlay/overlayRotator.cpp
+++ b/liboverlay/overlayRotator.cpp
@@ -70,4 +70,65 @@
return ret;
}
+RotMgr::RotMgr() {
+ for(int i = 0; i < MAX_ROT_SESS; i++) {
+ mRot[i] = 0;
+ }
+ mUseCount = 0;
+}
+
+RotMgr::~RotMgr() {
+ clear();
+}
+
+void RotMgr::configBegin() {
+ //Reset the number of objects used
+ mUseCount = 0;
+}
+
+void RotMgr::configDone() {
+ //Remove the top most unused objects. Videos come and go.
+ for(int i = mUseCount; i < MAX_ROT_SESS; i++) {
+ if(mRot[i]) {
+ delete mRot[i];
+ mRot[i] = 0;
+ }
+ }
+}
+
+Rotator* RotMgr::getNext() {
+ //Return a rot object, creating one if necessary
+ overlay::Rotator *rot = NULL;
+ if(mUseCount >= MAX_ROT_SESS) {
+ ALOGE("%s, MAX rotator sessions reached", __func__);
+ } else {
+ if(mRot[mUseCount] == NULL)
+ mRot[mUseCount] = overlay::Rotator::getRotator();
+ rot = mRot[mUseCount++];
+ }
+ return rot;
+}
+
+void RotMgr::clear() {
+ //Brute force obj destruction, helpful in suspend.
+ for(int i = 0; i < MAX_ROT_SESS; i++) {
+ if(mRot[i]) {
+ delete mRot[i];
+ mRot[i] = 0;
+ }
+ }
+ mUseCount = 0;
+}
+
+void RotMgr::getDump(char *buf, size_t len) {
+ for(int i = 0; i < MAX_ROT_SESS; i++) {
+ if(mRot[i]) {
+ mRot[i]->getDump(buf, len);
+ }
+ }
+ char str[32] = {'\0'};
+ snprintf(str, 32, "\n================\n");
+ strncat(buf, str, strlen(str));
+}
+
}