hwc: Support single ROI for split panels.

For panels that cannot accept commands in both the interfaces, we cannot
send two ROI's (for each half). We merge them into single ROI and split
them across lSplit for MDP mixer use. The ROI's will be merged again
finally before updating the panel in the driver.

 - Reads panel property of dual control path.
 - If dual control path not supported, merge ROI's before
   analysing for composition strategies.

Change-Id: I67e361a299dc5d1adb28b180900e24633eefc4a8
diff --git a/libhwcomposer/hwc_mdpcomp.cpp b/libhwcomposer/hwc_mdpcomp.cpp
index fab9a8b..e72d0ea 100644
--- a/libhwcomposer/hwc_mdpcomp.cpp
+++ b/libhwcomposer/hwc_mdpcomp.cpp
@@ -596,6 +596,16 @@
         }
     }
 
+    /* For panels that cannot accept commands in both the interfaces, we cannot
+     * send two ROI's (for each half). We merge them into single ROI and split
+     * them across lSplit for MDP mixer use. The ROI's will be merged again
+     * finally before udpating the panel in the driver. */
+    if(qdutils::MDPVersion::getInstance().needsROIMerge()) {
+        hwc_rect_t temp_roi = getUnion(l_roi, r_roi);
+        l_roi = getIntersection(temp_roi, l_frame);
+        r_roi = getIntersection(temp_roi, r_frame);
+    }
+
     /* No layer is updating. Still SF wants a refresh. */
     if(!isValidRect(l_roi) && !isValidRect(r_roi))
         return;
diff --git a/libqdutils/mdp_version.cpp b/libqdutils/mdp_version.cpp
index 16505ba..d1d8355 100644
--- a/libqdutils/mdp_version.cpp
+++ b/libqdutils/mdp_version.cpp
@@ -200,6 +200,10 @@
                     mPanelInfo.mMinROIHeight = atoi(tokens[1]);
                     ALOGI("Min ROI Height: %d", mPanelInfo.mMinROIHeight);
                 }
+                if(!strncmp(tokens[0], "roi_merge", strlen("roi_merge"))) {
+                    mPanelInfo.mNeedsROIMerge = atoi(tokens[1]);
+                    ALOGI("Needs ROI Merge: %d", mPanelInfo.mNeedsROIMerge);
+                }
             }
         }
         fclose(panelInfoNodeFP);
diff --git a/libqdutils/mdp_version.h b/libqdutils/mdp_version.h
index fa137c0..8cc789b 100644
--- a/libqdutils/mdp_version.h
+++ b/libqdutils/mdp_version.h
@@ -101,9 +101,10 @@
     int mHeightAlign;            // ROI height alignment restriction
     int mMinROIWidth;            // Min width needed for ROI
     int mMinROIHeight;           // Min height needed for ROI
+    bool mNeedsROIMerge;         // Merge ROI's of both the DSI's
     PanelInfo() : mType(NO_PANEL), mPartialUpdateEnable(0),
     mLeftAlign(0), mWidthAlign(0), mTopAlign(0), mHeightAlign(0),
-    mMinROIWidth(0), mMinROIHeight(0){}
+    mMinROIWidth(0), mMinROIHeight(0), mNeedsROIMerge(false){}
     friend class MDPVersion;
 };
 
@@ -135,6 +136,7 @@
     int getHeightAlign() { return mPanelInfo.mHeightAlign; }
     int getMinROIWidth() { return mPanelInfo.mMinROIWidth; }
     int getMinROIHeight() { return mPanelInfo.mMinROIHeight; }
+    bool needsROIMerge() { return mPanelInfo.mNeedsROIMerge; }
     unsigned long getLowBw() { return mLowBw; }
     unsigned long getHighBw() { return mHighBw; }
     bool isSrcSplit() const;