Gralloc: Do not use adreno for secure camera and secure display

Avoid using adreno size calculations for secure camera and
secure display buffers.

Change-Id: Ib61d893cbcc57b10070250a63b8fa79106de4af3
CRs-Fixed: 2262355
diff --git a/gralloc/gr_utils.cpp b/gralloc/gr_utils.cpp
index 282bcc2..10bbf27 100644
--- a/gralloc/gr_utils.cpp
+++ b/gralloc/gr_utils.cpp
@@ -998,6 +998,19 @@
   *size = adreno_mem_info->AdrenoGetAlignedGpuBufferSize(graphics_metadata->data);
 }
 
+bool CanUseAdrenoForSize(int buffer_type, uint64_t usage) {
+  if (buffer_type == BUFFER_TYPE_VIDEO || !GetAdrenoSizeAPIStatus()) {
+    return false;
+  }
+
+  if ((usage & BufferUsage::PROTECTED) && ((usage & BufferUsage::CAMERA_OUTPUT) ||
+      (usage & GRALLOC_USAGE_PRIVATE_SECURE_DISPLAY))) {
+    return false;
+  }
+
+  return true;
+}
+
 bool GetAdrenoSizeAPIStatus() {
   AdrenoMemInfo* adreno_mem_info = AdrenoMemInfo::GetInstance();
   if (adreno_mem_info) {