Add USAGE_OEM

Allow OEMs to pass data from other HW blocks via internal
extension.

Change-Id: I78c19f5eec462aff7d8a5408f2f16cfc9b78c036
diff --git a/rsAllocation.cpp b/rsAllocation.cpp
index 0e74242..a7601a4 100644
--- a/rsAllocation.cpp
+++ b/rsAllocation.cpp
@@ -70,9 +70,22 @@
         return nullptr;
     }
 
-    Allocation *a = new (allocMem) Allocation(rsc, type, usages, mc, ptr);
+    bool success = false;
+    Allocation *a = nullptr;
+    if (usages & RS_ALLOCATION_USAGE_OEM) {
+        if (rsc->mHal.funcs.allocation.initOem != nullptr) {
+            a = new (allocMem) Allocation(rsc, type, usages, mc, nullptr);
+            success = rsc->mHal.funcs.allocation.initOem(rsc, a, type->getElement()->getHasReferences(), ptr);
+        } else {
+            rsc->setError(RS_ERROR_FATAL_DRIVER, "Allocation Init called with USAGE_OEM but driver does not support it");
+            return nullptr;
+        }
+    } else {
+        a = new (allocMem) Allocation(rsc, type, usages, mc, ptr);
+        success = rsc->mHal.funcs.allocation.init(rsc, a, type->getElement()->getHasReferences());
+    }
 
-    if (!rsc->mHal.funcs.allocation.init(rsc, a, type->getElement()->getHasReferences())) {
+    if (!success) {
         rsc->setError(RS_ERROR_FATAL_DRIVER, "Allocation::Allocation, alloc failure");
         delete a;
         return nullptr;