hwc: clean up overlay on external display blank

- On suspend, SurfaceFlinger calls hwc_blank on primary and
  external separately, inbetween these calls there might be a
  update, which leads to acquiring overlay pipes for external
  which will not be cleared and results in showing up stale
  frame on external display
- This change clears all the overlay pipes used on every blank

Change-Id: I44d62b7d0fcd992cf8a26bb0c21df77952bc1381
CRs-fixed: 464070
diff --git a/libhwcomposer/hwc.cpp b/libhwcomposer/hwc.cpp
index bc705ac..25f7da5 100644
--- a/libhwcomposer/hwc.cpp
+++ b/libhwcomposer/hwc.cpp
@@ -259,12 +259,17 @@
     int ret = 0;
     ALOGD("%s: %s display: %d", __FUNCTION__,
           blank==1 ? "Blanking":"Unblanking", dpy);
+    if(blank) {
+        // free up all the overlay pipes in use
+        // when we get a blank for either display
+        // makes sure that all pipes are freed
+        ctx->mOverlay->configBegin();
+        ctx->mOverlay->configDone();
+        ctx->mRotMgr->clear();
+    }
     switch(dpy) {
         case HWC_DISPLAY_PRIMARY:
             if(blank) {
-                ctx->mOverlay->configBegin();
-                ctx->mOverlay->configDone();
-                ctx->mRotMgr->clear();
                 ret = ioctl(ctx->dpyAttr[dpy].fd, FBIOBLANK,FB_BLANK_POWERDOWN);
 
                 if(ctx->dpyAttr[HWC_DISPLAY_VIRTUAL].connected == true) {