hwc: Call blank IOCTL on virtual as well if it is connected.

- If virtual display is connected, call blank IOCTL on it as well
- Clear writeback object on blank, as pause/resume functionality
implemented in VDS takes care of sending black frame on suspend.

Change-Id: Ibce682beaf6e58200fc963202aa5b1905fcf1257
CRs-Fixed: 661438
diff --git a/libhwcomposer/hwc.cpp b/libhwcomposer/hwc.cpp
index 0396c91..83966b8 100644
--- a/libhwcomposer/hwc.cpp
+++ b/libhwcomposer/hwc.cpp
@@ -424,11 +424,7 @@
         ctx->mOverlay->configBegin();
         ctx->mOverlay->configDone();
         ctx->mRotMgr->clear();
-        // If VDS is connected, do not clear WB object as it
-        // will end up detaching IOMMU. This is required
-        // to send black frame to WFD sink on power suspend.
-        // Note: With this change, we keep the WriteBack object
-        // alive on power suspend for AD use case.
+        overlay::Writeback::clear();
     }
     switch(dpy) {
     case HWC_DISPLAY_PRIMARY:
@@ -482,6 +478,13 @@
                     ret = -1;
                 }
             }
+            value = blank ? FB_BLANK_POWERDOWN : FB_BLANK_UNBLANK;
+            if(ioctl(ctx->dpyAttr[HWC_DISPLAY_VIRTUAL].fd, FBIOBLANK, value) < 0
+                    ) {
+                ALOGE("%s: Failed to handle blank event(%d) for virtual!!",
+                        __FUNCTION__, blank );
+                return -1;
+            }
             ctx->dpyAttr[HWC_DISPLAY_VIRTUAL].isActive = !blank;
         }
         break;