diff options
author | Ankit Goyal <layog@google.com> | 2022-05-26 16:34:01 -0700 |
---|---|---|
committer | Ankit Goyal <layog@google.com> | 2022-05-26 16:35:55 -0700 |
commit | e906482211a84e4bb1f50a0f152576862c0afc65 (patch) | |
tree | 2912df6ce12eeeec3fbb365f40fd3a2317ae23df | |
parent | 84a9217b9aac4dd6809de7be21ebd1b4d390bfb1 (diff) | |
download | gchips-e906482211a84e4bb1f50a0f152576862c0afc65.tar.gz |
Disable support for front buffer allocation
Bug: 218383959
Test: VtsHalGraphicsAllocatorAidl_TargetTest
Change-Id: I3c196846f3698574adb31d34bd403184983943f8
-rw-r--r-- | gralloc4/src/core/mali_gralloc_bufferallocation.cpp | 15 | ||||
-rw-r--r-- | gralloc4/src/hidl_common/Mapper.cpp | 2 |
2 files changed, 16 insertions, 1 deletions
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 { |