overlay: Reset display and mixer tags for unallocated pipes

When clients request pipes and unused pipe-slots are returned (the
ones having DPY_UNUSED, MIXER_UNUSED), they are tagged with requested
display and mixer ids.

If the client releases such pipes without using them (i.e without a
successful driver commit) we need to reset display and mixer tags to
UNUSED, so subsequent requests for a different display/mixer succeed.

Change-Id: I26e9fc4da3c3919ee23b65e2053c762df6c4cf8c
diff --git a/liboverlay/overlay.cpp b/liboverlay/overlay.cpp
index 3a96b71..9320848 100644
--- a/liboverlay/overlay.cpp
+++ b/liboverlay/overlay.cpp
@@ -313,13 +313,7 @@
         ret = true;
         PipeBook::setUse((int)dest);
     } else {
-        int dpy = mPipeBook[dest].mDisplay;
-        for(int i = 0; i < PipeBook::NUM_PIPES; i++) {
-            if (mPipeBook[i].mDisplay == dpy) {
-                PipeBook::resetAllocation(i);
-                PipeBook::resetUse(i);
-            }
-        }
+        clear(mPipeBook[dest].mDisplay);
     }
     return ret;
 }
@@ -529,6 +523,9 @@
             // Mark as available for this round
             PipeBook::resetUse(i);
             PipeBook::resetAllocation(i);
+            if(getPipeId((utils::eDest)i) == -1) {
+                mPipeBook[i].destroy();
+            }
         }
     }
 }