diff options
author | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | 2022-06-03 18:05:38 +0000 |
---|---|---|
committer | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | 2022-06-03 18:05:38 +0000 |
commit | 38d60be0687f0be9928693b3d6d5f564b506bf4f (patch) | |
tree | 2912df6ce12eeeec3fbb365f40fd3a2317ae23df | |
parent | d2f46b3ab021173d37816b2d0aaaccec4513a779 (diff) | |
parent | e906482211a84e4bb1f50a0f152576862c0afc65 (diff) | |
download | gchips-38d60be0687f0be9928693b3d6d5f564b506bf4f.tar.gz |
Snap for 8680285 from e906482211a84e4bb1f50a0f152576862c0afc65 to mainline-go-mediaprovider-release
Change-Id: If950e8c09ed8ca9b1f16cb4b7dbd1da90599874f
-rw-r--r-- | gralloc4/service/4.x/Android.bp | 46 | ||||
-rw-r--r-- | gralloc4/service/4.x/android.hardware.graphics.allocator@4.0-service.rc | 7 | ||||
-rw-r--r-- | gralloc4/service/4.x/service.cpp | 45 | ||||
-rw-r--r-- | gralloc4/src/4.x/Android.bp | 19 | ||||
-rw-r--r-- | gralloc4/src/core/mali_gralloc_bufferallocation.cpp | 15 | ||||
-rw-r--r-- | gralloc4/src/hidl_common/Mapper.cpp | 2 |
6 files changed, 16 insertions, 118 deletions
diff --git a/gralloc4/service/4.x/Android.bp b/gralloc4/service/4.x/Android.bp deleted file mode 100644 index dbdfbec..0000000 --- a/gralloc4/service/4.x/Android.bp +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright (C) 2020 Arm Limited. - * SPDX-License-Identifier: Apache-2.0 - * - * 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. - */ - -package { - default_applicable_licenses: ["Android-Apache-2.0"], -} - -cc_binary { - name: "android.hardware.graphics.allocator@4.0-service", - proprietary: true, - relative_install_path: "hw", - srcs: [ - "service.cpp", - ], - init_rc: [ - "android.hardware.graphics.allocator@4.0-service.rc", - ], - header_libs: [ - "libgralloc_headers", - ], - shared_libs: [ - "android.hardware.graphics.allocator@4.0", - "android.hardware.graphics.allocator@4.0-impl", - "android.hardware.graphics.common-V3-ndk", - "libhidlbase", - "liblog", - "libutils", - ], - required: [ - "android.hardware.graphics.allocator@4.0-impl", - ], -} diff --git a/gralloc4/service/4.x/android.hardware.graphics.allocator@4.0-service.rc b/gralloc4/service/4.x/android.hardware.graphics.allocator@4.0-service.rc deleted file mode 100644 index 6523f4e..0000000 --- a/gralloc4/service/4.x/android.hardware.graphics.allocator@4.0-service.rc +++ /dev/null @@ -1,7 +0,0 @@ -service vendor.gralloc-4-0 /vendor/bin/hw/android.hardware.graphics.allocator@4.0-service - class hal animation - interface android.hardware.graphics.allocator@4.0::IAllocator default - user system - group graphics drmrpc - capabilities SYS_NICE - onrestart restart surfaceflinger diff --git a/gralloc4/service/4.x/service.cpp b/gralloc4/service/4.x/service.cpp deleted file mode 100644 index d540086..0000000 --- a/gralloc4/service/4.x/service.cpp +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright (C) 2020 Arm Limited. - * SPDX-License-Identifier: Apache-2.0 - * - * 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. - */ -#define LOG_TAG "android.hardware.graphics.allocator@4.0-service" - -#include <hidl/HidlTransportSupport.h> -#include <hidl/Status.h> -#include <utils/StrongPointer.h> - -#include "4.x/GrallocAllocator.h" - -using android::hardware::configureRpcThreadpool; -using android::hardware::joinRpcThreadpool; -using android::hardware::setMinSchedulerPolicy; -using arm::allocator::GrallocAllocator; - -int main() { - android::sp<GrallocAllocator> service = new GrallocAllocator(); - configureRpcThreadpool(4, true /* callerWillJoin */); - - if (!setMinSchedulerPolicy(service, SCHED_NORMAL, -20)) { - ALOGW("Cannot bump allocator priority"); - } - - if (service->registerAsService() != android::OK) { - ALOGE("Cannot register allocator service"); - return -EINVAL; - } - - joinRpcThreadpool(); - return 0; -} diff --git a/gralloc4/src/4.x/Android.bp b/gralloc4/src/4.x/Android.bp index ab0fead..88c7a01 100644 --- a/gralloc4/src/4.x/Android.bp +++ b/gralloc4/src/4.x/Android.bp @@ -73,25 +73,6 @@ cc_defaults { } cc_library_shared { - name: "android.hardware.graphics.allocator@4.0-impl", - defaults: [ - "arm_gralloc_api_4x_defaults", - ], - shared_libs: [ - "android.hardware.graphics.allocator@4.0", - "android.hardware.graphics.mapper@4.0", - ], - srcs: [ - "GrallocAllocator.cpp", - ":libgralloc_hidl_common_allocator", - ":libgralloc_hidl_common_shared_metadata", - ], - include_dirs: [ - "hardware/google/gchips/include", - ], -} - -cc_library_shared { name: "android.hardware.graphics.mapper@4.0-impl", defaults: [ "arm_gralloc_api_4x_defaults", diff --git a/gralloc4/src/core/mali_gralloc_bufferallocation.cpp b/gralloc4/src/core/mali_gralloc_bufferallocation.cpp index 12e4494..3718816 100644 --- a/gralloc4/src/core/mali_gralloc_bufferallocation.cpp +++ b/gralloc4/src/core/mali_gralloc_bufferallocation.cpp @@ -977,6 +977,16 @@ static int prepare_descriptor_exynos_formats( return 0; } +static bool validate_usage(const uint64_t usage) { + if (usage & GRALLOC_USAGE_FRONT_BUFFER) { + /* TODO(b/218383959): Enable front buffer rendering */ + MALI_GRALLOC_LOGW("Front buffer rendering is disabled."); + return false; + } + + return true; +} + int mali_gralloc_derive_format_and_size(buffer_descriptor_t * const bufDescriptor) { alloc_type_t alloc_type{}; @@ -985,6 +995,11 @@ int mali_gralloc_derive_format_and_size(buffer_descriptor_t * const bufDescripto int alloc_height = bufDescriptor->height; uint64_t usage = bufDescriptor->producer_usage | bufDescriptor->consumer_usage; + if (!validate_usage(usage)) { + MALI_GRALLOC_LOGE("Usage flag validation failed."); + return -EINVAL; + } + /* * Select optimal internal pixel format based upon * usage and requested format. diff --git a/gralloc4/src/hidl_common/Mapper.cpp b/gralloc4/src/hidl_common/Mapper.cpp index e8f5b10..f6ebe6f 100644 --- a/gralloc4/src/hidl_common/Mapper.cpp +++ b/gralloc4/src/hidl_common/Mapper.cpp @@ -563,7 +563,7 @@ void isSupported(const IMapper::BufferDescriptorInfo& description, IMapper::isSu if (result != 0) { MALI_GRALLOC_LOGV("Allocation for the given description will not succeed. error: %d", result); - hidl_cb(Error::NO_RESOURCES, false); + hidl_cb(Error::NONE, false); } else { |