Merge "hwc/overlay: Introduce padding round between DMA modes."
diff --git a/libhwcomposer/hwc_mdpcomp.cpp b/libhwcomposer/hwc_mdpcomp.cpp
index 6381f59..cfc2558 100644
--- a/libhwcomposer/hwc_mdpcomp.cpp
+++ b/libhwcomposer/hwc_mdpcomp.cpp
@@ -333,6 +333,12 @@
         return false;
     }
 
+    if(ctx->isPaddingRound) {
+        ctx->isPaddingRound = false;
+        ALOGD_IF(isDebug(), "%s: padding round",__FUNCTION__);
+        return false;
+    }
+
     return true;
 }
 
diff --git a/libhwcomposer/hwc_utils.cpp b/libhwcomposer/hwc_utils.cpp
index 746f0c3..4f87ac4 100644
--- a/libhwcomposer/hwc_utils.cpp
+++ b/libhwcomposer/hwc_utils.cpp
@@ -344,6 +344,9 @@
             yuvCount++;
 
             if(layer->transform & HWC_TRANSFORM_ROT_90) {
+                if(ctx->mOverlay->isPipeTypeAttached(OV_MDP_PIPE_DMA)) {
+                    ctx->isPaddingRound = true;
+                }
                 Overlay::setDMAMode(Overlay::DMA_BLOCK_MODE);
             }
         }
diff --git a/libhwcomposer/hwc_utils.h b/libhwcomposer/hwc_utils.h
index d4f5d94..e0fff77 100644
--- a/libhwcomposer/hwc_utils.h
+++ b/libhwcomposer/hwc_utils.h
@@ -273,6 +273,8 @@
     mutable Locker mExtSetLock;
     //Vsync
     struct vsync_state vstate;
+    //Drawing round when we use GPU
+    bool isPaddingRound;
 };
 
 namespace qhwc {
diff --git a/liboverlay/overlay.cpp b/liboverlay/overlay.cpp
index 3563cbc..8aca0f6 100644
--- a/liboverlay/overlay.cpp
+++ b/liboverlay/overlay.cpp
@@ -124,6 +124,16 @@
     return dest;
 }
 
+bool Overlay::isPipeTypeAttached(eMdpPipeType type) {
+    for(int i = 0; i < PipeBook::NUM_PIPES; i++) {
+        if(type == PipeBook::getPipeType((eDest)i) &&
+                mPipeBook[i].mDisplay != PipeBook::DPY_UNUSED) {
+            return true;
+        }
+    }
+    return false;
+}
+
 bool Overlay::commit(utils::eDest dest) {
     bool ret = false;
     int index = (int)dest;
diff --git a/liboverlay/overlay.h b/liboverlay/overlay.h
index 0cedac9..bf85b70 100644
--- a/liboverlay/overlay.h
+++ b/liboverlay/overlay.h
@@ -78,6 +78,10 @@
     static Overlay* getInstance();
     /* Returns available ("unallocated") pipes for a display */
     int availablePipes(int dpy);
+    /* Returns if any of the requested pipe type is attached to any of the
+     * displays
+     */
+    bool isPipeTypeAttached(utils::eMdpPipeType type);
     /* set the framebuffer index for external display */
     void setExtFbNum(int fbNum);
     /* Returns framebuffer index of the current external display */