diff options
author | Priyanka Advani <padvani@google.com> | 2023-07-24 19:52:02 +0000 |
---|---|---|
committer | Liana Kazanova <lkazanova@google.com> | 2023-07-24 20:11:13 +0000 |
commit | b04e88e3f68b9d6f42bbde910756380386663a68 (patch) | |
tree | ec2360f6d62f6f2b0047fb93d13a05963b5b1bc2 | |
parent | c73acb2d163f395a327e41483f5b939641ee2105 (diff) | |
download | gchips-b04e88e3f68b9d6f42bbde910756380386663a68.tar.gz |
Revert "gralloc4: Upgrade Allocator to AIDL2"
Revert submission 23772493-allocator-aidl2
Reason for revert: Probable culprit for b/292565867, b/292569168
Reverted changes: /q/submissionid:23772493-allocator-aidl2
Change-Id: I41c525992f5d6e3f367f15fe261dc28b225c93f3
-rw-r--r-- | gralloc4/service/aidl/Android.bp | 5 | ||||
-rw-r--r-- | gralloc4/service/aidl/android.hardware.graphics.allocator-aidl-service.rc | 2 | ||||
-rw-r--r-- | gralloc4/service/aidl/manifest_gralloc_aidl.xml | 1 | ||||
-rw-r--r-- | gralloc4/src/aidl/Android.bp | 2 | ||||
-rw-r--r-- | gralloc4/src/aidl/GrallocAllocator.cpp | 87 | ||||
-rw-r--r-- | gralloc4/src/aidl/GrallocAllocator.h | 11 | ||||
-rw-r--r-- | gralloc4/src/hidl_common/Allocator.cpp | 5 | ||||
-rw-r--r-- | gralloc4/src/hidl_common/Allocator.h | 2 |
8 files changed, 5 insertions, 110 deletions
diff --git a/gralloc4/service/aidl/Android.bp b/gralloc4/service/aidl/Android.bp index 4262685..a3d7a87 100644 --- a/gralloc4/service/aidl/Android.bp +++ b/gralloc4/service/aidl/Android.bp @@ -3,7 +3,7 @@ package { } cc_binary { - name: "android.hardware.graphics.allocator-V2-service", + name: "android.hardware.graphics.allocator-V1-service", proprietary: true, relative_install_path: "hw", srcs: [ @@ -17,7 +17,7 @@ cc_binary { "libgralloc_headers", ], shared_libs: [ - "android.hardware.graphics.allocator-V2-ndk", + "android.hardware.graphics.allocator-V1-ndk", "android.hardware.graphics.allocator-aidl-impl", "libbinder_ndk", "liblog", @@ -28,6 +28,5 @@ cc_binary { ], required: [ "android.hardware.graphics.allocator-aidl-impl", - "android.hardware.graphics.mapper@4.0-impl", ], } diff --git a/gralloc4/service/aidl/android.hardware.graphics.allocator-aidl-service.rc b/gralloc4/service/aidl/android.hardware.graphics.allocator-aidl-service.rc index 723fab6..e86b68d 100644 --- a/gralloc4/service/aidl/android.hardware.graphics.allocator-aidl-service.rc +++ b/gralloc4/service/aidl/android.hardware.graphics.allocator-aidl-service.rc @@ -1,4 +1,4 @@ -service vendor.graphics.allocator-default /vendor/bin/hw/android.hardware.graphics.allocator-V2-service +service vendor.graphics.allocator-default /vendor/bin/hw/android.hardware.graphics.allocator-V1-service class hal animation user system group graphics drmrpc diff --git a/gralloc4/service/aidl/manifest_gralloc_aidl.xml b/gralloc4/service/aidl/manifest_gralloc_aidl.xml index c29d370..6848a99 100644 --- a/gralloc4/service/aidl/manifest_gralloc_aidl.xml +++ b/gralloc4/service/aidl/manifest_gralloc_aidl.xml @@ -1,7 +1,6 @@ <manifest version="1.0" type="device"> <hal format="aidl"> <name>android.hardware.graphics.allocator</name> - <version>2</version> <fqname>IAllocator/default</fqname> </hal> </manifest> diff --git a/gralloc4/src/aidl/Android.bp b/gralloc4/src/aidl/Android.bp index 3c0fc26..e2d9d04 100644 --- a/gralloc4/src/aidl/Android.bp +++ b/gralloc4/src/aidl/Android.bp @@ -10,7 +10,7 @@ cc_library_shared { "arm_gralloc_api_4x_defaults", ], shared_libs: [ - "android.hardware.graphics.allocator-V2-ndk", + "android.hardware.graphics.allocator-V1-ndk", "android.hardware.graphics.allocator@4.0", "android.hardware.graphics.mapper@4.0", "libbinder_ndk", diff --git a/gralloc4/src/aidl/GrallocAllocator.cpp b/gralloc4/src/aidl/GrallocAllocator.cpp index f535379..fb1d5b7 100644 --- a/gralloc4/src/aidl/GrallocAllocator.cpp +++ b/gralloc4/src/aidl/GrallocAllocator.cpp @@ -7,6 +7,7 @@ #include <cutils/android_filesystem_config.h> #include <hidl/HidlSupport.h> +#include "allocator/mali_gralloc_ion.h" #include "hidl_common/Allocator.h" namespace pixel::allocator { @@ -87,92 +88,6 @@ ndk::ScopedAStatus GrallocAllocator::allocate(const std::vector<uint8_t>& descri return ndk::ScopedAStatus::ok(); } -buffer_descriptor_t decodeBufferDescriptorInfo( - const AidlAllocator::BufferDescriptorInfo& descriptor) { - buffer_descriptor_t bufferDescriptor; - bufferDescriptor.width = descriptor.width; - bufferDescriptor.height = descriptor.height; - bufferDescriptor.layer_count = descriptor.layerCount; - bufferDescriptor.hal_format = static_cast<uint64_t>(descriptor.format); - bufferDescriptor.producer_usage = static_cast<uint64_t>(descriptor.usage); - bufferDescriptor.consumer_usage = bufferDescriptor.producer_usage; - bufferDescriptor.format_type = MALI_GRALLOC_FORMAT_TYPE_USAGE; - bufferDescriptor.signature = sizeof(buffer_descriptor_t); - bufferDescriptor.reserved_size = descriptor.reservedSize; - bufferDescriptor.name = std::string(std::begin(descriptor.name), std::end(descriptor.name)); - return bufferDescriptor; -} - -ndk::ScopedAStatus GrallocAllocator::allocate2( - const AidlAllocator::BufferDescriptorInfo& descriptor, int32_t count, - AidlAllocator::AllocationResult* result) { - MALI_GRALLOC_LOGV("Allocation request from process: %lu", callingPid()); - - buffer_descriptor_t bufferDescriptor = decodeBufferDescriptorInfo(descriptor); - - HidlError error = HidlError::NONE; - auto hidl_cb = [&](HidlError _error, int _stride, hidl_vec<hidl_handle> _buffers) { - if (_error != HidlError::NONE) { - error = _error; - return; - } - - const uint32_t size = _buffers.size(); - - result->stride = _stride; - result->buffers.resize(size); - for (uint32_t i = 0; i < size; i++) { - // Dup here is necessary. After this callback returns common::allocate - // will free the buffer which will destroy the older fd. - result->buffers[i] = android::dupToAidl(static_cast<const native_handle*>(_buffers[i])); - } - }; - - arm::allocator::common::allocate(bufferDescriptor, count, hidl_cb); - - switch (error) { - case HidlError::NONE: - break; - - case HidlError::BAD_DESCRIPTOR: - return ndk::ScopedAStatus::fromServiceSpecificError( - static_cast<int32_t>(AidlAllocator::AllocationError::BAD_DESCRIPTOR)); - - case HidlError::NO_RESOURCES: - return ndk::ScopedAStatus::fromServiceSpecificError( - static_cast<int32_t>(AidlAllocator::AllocationError::NO_RESOURCES)); - - case HidlError::UNSUPPORTED: - return ndk::ScopedAStatus::fromServiceSpecificError( - static_cast<int32_t>(AidlAllocator::AllocationError::UNSUPPORTED)); - - default: - return ndk::ScopedAStatus::fromStatus(STATUS_UNKNOWN_ERROR); - } - - return ndk::ScopedAStatus::ok(); -} - -ndk::ScopedAStatus GrallocAllocator::isSupported( - const AidlAllocator::BufferDescriptorInfo& descriptor, bool* result) { - buffer_descriptor_t bufferDescriptor = decodeBufferDescriptorInfo(descriptor); - - *result = arm::allocator::common::isSupported(&bufferDescriptor); - - if (*result) { - MALI_GRALLOC_LOGV("Allocation for the given description will not succeed. error %d", - *result); - return ndk::ScopedAStatus::fromServiceSpecificError( - static_cast<int32_t>(AidlAllocator::AllocationError::UNSUPPORTED)); - } - return ndk::ScopedAStatus::ok(); -} - -ndk::ScopedAStatus GrallocAllocator::getIMapperLibrarySuffix(std::string* result) { - *result = ""; - return ndk::ScopedAStatus::fromStatus(STATUS_UNKNOWN_ERROR); -} - binder_status_t GrallocAllocator::dump(int fd, const char** /* args */, uint32_t numArgs) { if (callingUid() != AID_ROOT) { const std::string permission_denied = "Permission Denied\n"; diff --git a/gralloc4/src/aidl/GrallocAllocator.h b/gralloc4/src/aidl/GrallocAllocator.h index 91655a7..dadd4b9 100644 --- a/gralloc4/src/aidl/GrallocAllocator.h +++ b/gralloc4/src/aidl/GrallocAllocator.h @@ -2,11 +2,9 @@ #include <aidl/android/hardware/graphics/allocator/AllocationResult.h> #include <aidl/android/hardware/graphics/allocator/BnAllocator.h> -#include <aidl/android/hardware/graphics/allocator/BufferDescriptorInfo.h> #include <aidlcommonsupport/NativeHandle.h> #include <cstdint> -#include <string> #include <vector> namespace pixel { @@ -23,15 +21,6 @@ public: virtual ndk::ScopedAStatus allocate(const std::vector<uint8_t>& descriptor, int32_t count, AidlAllocator::AllocationResult* result) override; - virtual ndk::ScopedAStatus allocate2(const AidlAllocator::BufferDescriptorInfo& descriptor, - int32_t count, - AidlAllocator::AllocationResult* result) override; - - virtual ndk::ScopedAStatus isSupported(const AidlAllocator::BufferDescriptorInfo& descriptor, - bool* result) override; - - virtual ndk::ScopedAStatus getIMapperLibrarySuffix(std::string* result) override; - virtual binder_status_t dump(int fd, const char** args, uint32_t numArgs) override; }; diff --git a/gralloc4/src/hidl_common/Allocator.cpp b/gralloc4/src/hidl_common/Allocator.cpp index a7d789d..abca841 100644 --- a/gralloc4/src/hidl_common/Allocator.cpp +++ b/gralloc4/src/hidl_common/Allocator.cpp @@ -247,11 +247,6 @@ const std::string dump() { return ss.str(); } -int isSupported(buffer_descriptor_t *const bufDescriptor) { - // this is used as the criteria to determine which allocations succeed. - return mali_gralloc_derive_format_and_size(bufDescriptor); -} - } // namespace common } // namespace allocator } // namespace arm diff --git a/gralloc4/src/hidl_common/Allocator.h b/gralloc4/src/hidl_common/Allocator.h index e5ce174..079457c 100644 --- a/gralloc4/src/hidl_common/Allocator.h +++ b/gralloc4/src/hidl_common/Allocator.h @@ -56,8 +56,6 @@ void allocate(const buffer_descriptor_t &bufferDescriptor, uint32_t count, IAllo const std::string dump(); -int isSupported(buffer_descriptor_t *const bufDescriptor); - } // namespace common } // namespace allocator } // namespace arm |