diff options
Diffstat (limited to 'GrallocHAL/src/4.x/GrallocAllocator.cpp')
-rw-r--r-- | GrallocHAL/src/4.x/GrallocAllocator.cpp | 67 |
1 files changed, 0 insertions, 67 deletions
diff --git a/GrallocHAL/src/4.x/GrallocAllocator.cpp b/GrallocHAL/src/4.x/GrallocAllocator.cpp deleted file mode 100644 index 1a1e563..0000000 --- a/GrallocHAL/src/4.x/GrallocAllocator.cpp +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright (C) 2020 Arm Limited. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include <hwbinder/IPCThreadState.h> - -#include "GrallocAllocator.h" -#include "hidl_common/BufferDescriptor.h" -#include "hidl_common/Allocator.h" -#include "allocator/mali_gralloc_ion.h" - -namespace arm -{ -namespace allocator -{ -using android::hardware::graphics::allocator::V4_0::IAllocator; -using android::hardware::graphics::mapper::V4_0::Error; -using android::hardware::Return; -using android::hardware::hidl_handle; -using android::hardware::hidl_vec; -using android::hardware::Void; -using android::hardware::hidl_string; - -unsigned long callingPid() { - android::hardware::IPCThreadState* ipc = android::hardware::IPCThreadState::self(); - return static_cast<unsigned long>(ipc->getCallingPid()); -} - -GrallocAllocator::GrallocAllocator() -{ - MALI_GRALLOC_LOGV("Arm Module IAllocator %d.%d, pid = %d ppid = %d", GRALLOC_VERSION_MAJOR, - (HIDL_ALLOCATOR_VERSION_SCALED - (GRALLOC_VERSION_MAJOR * 100)) / 10, getpid(), getppid()); -} - -GrallocAllocator::~GrallocAllocator() -{ - mali_gralloc_ion_close(); -} - -Return<void> GrallocAllocator::allocate(const BufferDescriptor &descriptor, uint32_t count, allocate_cb hidl_cb) -{ - MALI_GRALLOC_LOGV("Allocation request from process: %lu", callingPid()); - - buffer_descriptor_t bufferDescriptor; - if (!mapper::common::grallocDecodeBufferDescriptor(descriptor, bufferDescriptor)) - { - hidl_cb(Error::BAD_DESCRIPTOR, 0, hidl_vec<hidl_handle>()); - return Void(); - } - common::allocate(bufferDescriptor, count, hidl_cb); - return Void(); -} - -} // namespace allocator -} // namespace arm |