DO NOT MERGE: drm_hwcomposer: Don't composite over protected layers

This patch changes two things with respect to protected layers:

1- It provisions the HW plane in the correct position. ie: if
   the background layer is slated for a HW plane, it will be
   placed on the primary layer and the protected layer will be
   placed on top of it.
2- It punches a hole through the precomposite and squash layers
   such that when they are placed on top of the protected layer,
   they do not obstruct it.

BUG=b/27502957
TEST=Tested on smaug with multi-window with a variety of different
     layouts and visible layers

Change-Id: Ie30939f2bb750dbe3faa558ddb094b677f41f45e
Signed-off-by: Sean Paul <seanpaul@chromium.org>
(cherry picked from commit 8a628b9d22f778fcb4dc445d677f6f028667c885)
diff --git a/separate_rects.h b/separate_rects.h
index de8b660..cb46ecb 100644
--- a/separate_rects.h
+++ b/separate_rects.h
@@ -105,6 +105,14 @@
     bitset &= ~(((TUInt)1) << id);
   }
 
+  void subtract(TId start, TId end) {
+    if (start > end)
+      return;
+    TId start_mask = (1 << start) - 1;
+    TId end_mask = (1 << end) - 1;
+    bitset &= ~(start_mask ^ end_mask);
+  }
+
   bool isEmpty() const {
     return bitset == 0;
   }