summaryrefslogtreecommitdiff
path: root/neuralnetworks/aidl/utils/src
diff options
context:
space:
mode:
authorRay Hernandez <rayhdez@google.com>2021-08-04 23:46:41 +0000
committerRay Hernandez <rayhdez@google.com>2021-08-04 23:46:41 +0000
commitea89e304395107bced95bf540adb58acf9523d86 (patch)
treee88ef90fcc51410e63271fb909eee6326a9230c1 /neuralnetworks/aidl/utils/src
parenta6d6002431c4b5bc3216827fdf0bf5744229fdea (diff)
Revert "Making NN hardware interface libs "host supported""
Revert "Making NNAPI libraries and tests host supported" Revert submission 1769046-neuralnetworks_host_build Reason for revert: New Build Breakage Reverted Changes: Ib54d5c274:Making NNAPI libraries and tests host supported I1d7c66516:Making NN hardware interface libs "host supported"... Change-Id: I6f65774325889c50b9f8bbab13b557705419b6cf
Diffstat (limited to 'neuralnetworks/aidl/utils/src')
-rw-r--r--neuralnetworks/aidl/utils/src/Conversions.cpp24
1 files changed, 2 insertions, 22 deletions
diff --git a/neuralnetworks/aidl/utils/src/Conversions.cpp b/neuralnetworks/aidl/utils/src/Conversions.cpp
index f0871564d2..0517730849 100644
--- a/neuralnetworks/aidl/utils/src/Conversions.cpp
+++ b/neuralnetworks/aidl/utils/src/Conversions.cpp
@@ -25,6 +25,7 @@
#include <android-base/mapped_file.h>
#include <android-base/unique_fd.h>
#include <android/binder_auto_utils.h>
+#include <android/hardware_buffer.h>
#include <cutils/native_handle.h>
#include <nnapi/OperandTypes.h>
#include <nnapi/OperationTypes.h>
@@ -35,6 +36,7 @@
#include <nnapi/Validation.h>
#include <nnapi/hal/CommonUtils.h>
#include <nnapi/hal/HandleError.h>
+#include <vndk/hardware_buffer.h>
#include <algorithm>
#include <chrono>
@@ -46,11 +48,6 @@
#include "Utils.h"
-#ifdef __ANDROID__
-#include <android/hardware_buffer.h>
-#include <vndk/hardware_buffer.h>
-#endif // __ANDROID__
-
#define VERIFY_NON_NEGATIVE(value) \
while (UNLIKELY(value < 0)) return NN_ERROR()
@@ -122,7 +119,6 @@ struct NativeHandleDeleter {
using UniqueNativeHandle = std::unique_ptr<native_handle_t, NativeHandleDeleter>;
-#ifdef __ANDROID__
GeneralResult<UniqueNativeHandle> nativeHandleFromAidlHandle(const NativeHandle& handle) {
auto nativeHandle = UniqueNativeHandle(dupFromAidl(handle));
if (nativeHandle.get() == nullptr) {
@@ -135,7 +131,6 @@ GeneralResult<UniqueNativeHandle> nativeHandleFromAidlHandle(const NativeHandle&
}
return nativeHandle;
}
-#endif // __ANDROID__
} // anonymous namespace
@@ -376,7 +371,6 @@ GeneralResult<SharedMemory> unvalidatedConvert(const aidl_hal::Memory& memory) {
return createSharedMemoryFromFd(size, prot, fd, offset);
}
case Tag::hardwareBuffer: {
-#ifdef __ANDROID__
const auto& hardwareBuffer = memory.get<Tag::hardwareBuffer>();
const UniqueNativeHandle handle =
@@ -399,11 +393,6 @@ GeneralResult<SharedMemory> unvalidatedConvert(const aidl_hal::Memory& memory) {
}
return createSharedMemoryFromAHWB(ahwb, /*takeOwnership=*/true);
-#else // __ANDROID__
- LOG(FATAL) << "GeneralResult<SharedMemory> unvalidatedConvert(const aidl_hal::Memory& "
- "memory): Not Available on Host Build";
- return NN_ERROR() << "createFromHandle failed";
-#endif // __ANDROID__
}
}
return NN_ERROR() << "Unrecognized Memory::Tag: " << memory.getTag();
@@ -623,7 +612,6 @@ struct overloaded : Ts... {
template <class... Ts>
overloaded(Ts...)->overloaded<Ts...>;
-#ifdef __ANDROID__
nn::GeneralResult<common::NativeHandle> aidlHandleFromNativeHandle(
const native_handle_t& nativeHandle) {
auto handle = ::android::dupToAidl(&nativeHandle);
@@ -633,7 +621,6 @@ nn::GeneralResult<common::NativeHandle> aidlHandleFromNativeHandle(
}
return handle;
}
-#endif // __ANDROID__
nn::GeneralResult<Memory> unvalidatedConvert(const nn::Memory::Ashmem& memory) {
if constexpr (std::numeric_limits<size_t>::max() > std::numeric_limits<int64_t>::max()) {
@@ -681,7 +668,6 @@ nn::GeneralResult<Memory> unvalidatedConvert(const nn::Memory::Fd& memory) {
}
nn::GeneralResult<Memory> unvalidatedConvert(const nn::Memory::HardwareBuffer& memory) {
-#ifdef __ANDROID__
const native_handle_t* nativeHandle = AHardwareBuffer_getNativeHandle(memory.handle.get());
if (nativeHandle == nullptr) {
return (NN_ERROR() << "unvalidatedConvert failed because AHardwareBuffer_getNativeHandle "
@@ -709,12 +695,6 @@ nn::GeneralResult<Memory> unvalidatedConvert(const nn::Memory::HardwareBuffer& m
.handle = std::move(handle),
};
return Memory::make<Memory::Tag::hardwareBuffer>(std::move(hardwareBuffer));
-#else // __ANDROID__
- LOG(FATAL) << "nn::GeneralResult<Memory> unvalidatedConvert(const nn::Memory::HardwareBuffer& "
- "memory): Not Available on Host Build";
- (void)memory;
- return (NN_ERROR() << "unvalidatedConvert failed").operator nn::GeneralResult<Memory>();
-#endif // __ANDROID__
}
nn::GeneralResult<Memory> unvalidatedConvert(const nn::Memory::Unknown& /*memory*/) {