summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gralloc4/service/4.x/Android.bp46
-rw-r--r--gralloc4/service/4.x/android.hardware.graphics.allocator@4.0-service.rc7
-rw-r--r--gralloc4/service/4.x/service.cpp45
-rw-r--r--gralloc4/src/4.x/Android.bp19
-rw-r--r--gralloc4/src/core/mali_gralloc_bufferallocation.cpp31
-rw-r--r--gralloc4/src/hidl_common/Mapper.cpp2
6 files changed, 26 insertions, 124 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..7656fcf 100644
--- a/gralloc4/src/core/mali_gralloc_bufferallocation.cpp
+++ b/gralloc4/src/core/mali_gralloc_bufferallocation.cpp
@@ -535,6 +535,7 @@ static void calc_allocation_size(const int width,
const bool has_cpu_usage,
const bool has_hw_usage,
const bool has_gpu_usage,
+ const bool has_camera_usage,
int * const pixel_stride,
uint64_t * const size,
plane_info_t plane_info[MAX_PLANES])
@@ -606,15 +607,17 @@ static void calc_allocation_size(const int width,
uint32_t cpu_align = 0;
+ if (!(has_camera_usage && !has_cpu_usage && format.id == MALI_GRALLOC_FORMAT_INTERNAL_RAW10)) {
#if CAN_SKIP_CPU_ALIGN == 1
- if (has_cpu_usage)
+ if (has_cpu_usage)
#endif
- {
- assert((format.bpp[plane] * format.align_w_cpu) % 8 == 0);
- const bool is_primary_plane = (plane == 0 || !format.planes_contiguous);
- if (is_primary_plane)
{
- cpu_align = (format.bpp[plane] * format.align_w_cpu) / 8;
+ assert((format.bpp[plane] * format.align_w_cpu) % 8 == 0);
+ const bool is_primary_plane = (plane == 0 || !format.planes_contiguous);
+ if (is_primary_plane)
+ {
+ cpu_align = (format.bpp[plane] * format.align_w_cpu) / 8;
+ }
}
}
@@ -977,6 +980,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 +998,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.
@@ -1048,6 +1066,7 @@ int mali_gralloc_derive_format_and_size(buffer_descriptor_t * const bufDescripto
usage & (GRALLOC_USAGE_SW_READ_MASK | GRALLOC_USAGE_SW_WRITE_MASK),
usage & ~(GRALLOC_USAGE_PRIVATE_MASK | GRALLOC_USAGE_SW_READ_MASK | GRALLOC_USAGE_SW_WRITE_MASK),
usage & (GRALLOC_USAGE_HW_TEXTURE | GRALLOC_USAGE_HW_RENDER | GRALLOC_USAGE_GPU_DATA_BUFFER),
+ usage & (GRALLOC_USAGE_HW_CAMERA_WRITE | GRALLOC_USAGE_HW_CAMERA_READ),
&bufDescriptor->pixel_stride,
&bufDescriptor->alloc_sizes[0],
bufDescriptor->plane_info);
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
{