hwc: Allow WB to be active during VDS pause state.

* Revert commit 7a495b3caae0aad3a06ebb9d2621f0d5a88b78e4
"hwc: Call blank IOCTL on virtual as well if it is connected."

* On issuing suspend when WFD is connected, display-hal
receives both pause and blank calls. Calling StopTerminate
ioctls on WB(WB is not active on VDS pause) once blank
is issued on Primay(i.e when iommu is detached) doesn't free
up the buffer nodes resulting in orphaned memory blocks.

* To avoid this, allow WB to be active even during
VDS pause state so that when StopTerminate calls are made as
part of VDS teardown, display will be in unblanked state and
iommu would have been reattached, thus freeing up the buffer
nodes.

* Doing this doesn't clear all references to WB fb node during
VDS pause. Call display commit to unset the pipes rather than
relying on the refcount

Change-Id: I6f89c2ca56ea8a0133e66f3928f6e35ca94d9b52
diff --git a/libhwcomposer/hwc.cpp b/libhwcomposer/hwc.cpp
index e5c7ce7..994b577 100644
--- a/libhwcomposer/hwc.cpp
+++ b/libhwcomposer/hwc.cpp
@@ -424,7 +424,11 @@
         ctx->mOverlay->configBegin();
         ctx->mOverlay->configDone();
         ctx->mRotMgr->clear();
-        overlay::Writeback::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.
     }
     switch(dpy) {
     case HWC_DISPLAY_PRIMARY:
@@ -478,13 +482,6 @@
                     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;