hwc: Close unused pipes before PAN

If the pipes are closed after PAN a blank screen is
seen when when we transition from MDP composition
to GLES composition.
We close the unused pipes at the beginning of the set
since the decision has already been made in prepare.

Bug: 7188473
Change-Id: I6f946fa3d02f1c84fb2bb8d3b8e5c823c1151fd5
Signed-off-by: Iliyan Malchev <malchev@google.com>
diff --git a/libhwcomposer/hwc.cpp b/libhwcomposer/hwc.cpp
index 9456851..f3911cd 100644
--- a/libhwcomposer/hwc.cpp
+++ b/libhwcomposer/hwc.cpp
@@ -275,6 +275,9 @@
 {
     int ret = 0;
     hwc_context_t* ctx = (hwc_context_t*)(dev);
+    if(!ctx->overlayInUse)
+        ctx->mOverlay->setState(ovutils::OV_CLOSED);
+
     for (uint32_t i = 0; i < numDisplays; i++) {
         hwc_display_contents_1_t* list = displays[i];
         switch(i) {
@@ -286,9 +289,6 @@
                 ret = -EINVAL;
         }
     }
-    if(!ctx->overlayInUse)
-        ctx->mOverlay->setState(ovutils::OV_CLOSED);
-
     return ret;
 }