hwc: Handle layers marked as PROTECTED flag as secure

- All secure layers are marked with GRALLOC_USAGE_PROTECTED,
  irrespective of L1/L3, which should not fallback to GPU.
- In HWC, treat this layer as secure so that any fallbacks
  will be avoided.

Change-Id: I399740bfb5910f3fda4c4f395e2f7b49ea8619a9
Crs-fixed: 842071
diff --git a/libhwcomposer/hwc_mdpcomp.cpp b/libhwcomposer/hwc_mdpcomp.cpp
index 43a7a1a..d21533c 100644
--- a/libhwcomposer/hwc_mdpcomp.cpp
+++ b/libhwcomposer/hwc_mdpcomp.cpp
@@ -470,8 +470,10 @@
     }
 
     //XXX: Investigate doing this with pixel phase on MDSS
-    if(!isSecureBuffer(hnd) && isNonIntegralSourceCrop(layer->sourceCropf))
+    if((!isSecureBuffer(hnd) || !isProtectedBuffer(hnd)) &&
+            isNonIntegralSourceCrop(layer->sourceCropf)) {
         return false;
+    }
 
     hwc_rect_t crop = integerizeSourceCrop(layer->sourceCropf);
     hwc_rect_t dst = layer->displayFrame;
@@ -1833,7 +1835,8 @@
         } else {
             if(frame.isFBComposed[nYuvIndex]) {
                 private_handle_t *hnd = (private_handle_t *)layer->handle;
-                if(!secureOnly || isSecureBuffer(hnd)) {
+                if(!secureOnly || isSecureBuffer(hnd) ||
+                        isProtectedBuffer(hnd)) {
                     frame.isFBComposed[nYuvIndex] = false;
                     frame.fbCount--;
                 }