diff options
author | Solti Ho <solti@google.com> | 2023-08-01 21:47:45 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2023-08-01 21:47:45 +0000 |
commit | 367144e6d57088a9568fa31f8523fdd95b85debc (patch) | |
tree | fc3a5ed76a0d9698797c9ca8910050bdf0b9de58 | |
parent | d5cf4beae4e85ef5a6b49044574956bbe55a4dcb (diff) | |
parent | 18a82cb27995d1381003e8f9b06d0bdfcd19dd13 (diff) | |
download | gchips-367144e6d57088a9568fa31f8523fdd95b85debc.tar.gz |
Merge "block_unsupported_usage" into main
-rw-r--r-- | gralloc4/src/core/mali_gralloc_bufferallocation.cpp | 19 | ||||
-rw-r--r-- | gralloc4/src/mali_gralloc_usages.h | 3 |
2 files changed, 16 insertions, 6 deletions
diff --git a/gralloc4/src/core/mali_gralloc_bufferallocation.cpp b/gralloc4/src/core/mali_gralloc_bufferallocation.cpp index 4a0618b..7a3d3fd 100644 --- a/gralloc4/src/core/mali_gralloc_bufferallocation.cpp +++ b/gralloc4/src/core/mali_gralloc_bufferallocation.cpp @@ -475,11 +475,19 @@ static void update_yv12_stride(int8_t plane, * that point, the allocation is not aborted, just a log is printed to ALOGE * (matched against `VALID_USAGE`). These should be aligned. */ -static bool log_deprecated_usage_flags(uint64_t usage) { +static bool log_obsolete_usage_flags(uint64_t usage) { if (usage & DEPRECATED_MALI_GRALLOC_USAGE_FRONTBUFFER) { MALI_GRALLOC_LOGW("Using deprecated FRONTBUFFER usage bit, please upgrade to BufferUsage::FRONT_BUFFER"); return true; } + if (usage & UNSUPPORTED_MALI_GRALLOC_USAGE_CUBE_MAP) { + MALI_GRALLOC_LOGW("BufferUsage::GPU_CUBE_MAP is unsupported"); + return true; + } + if (usage & UNSUPPORTED_MALI_GRALLOC_USAGE_MIPMAP_COMPLETE) { + MALI_GRALLOC_LOGW("BufferUsage::GPU_MIPMAP_COMPLETE is unsupported"); + return true; + } return false; } @@ -992,6 +1000,10 @@ 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 (log_obsolete_usage_flags(usage)) { + return -EINVAL; + } + /* * Select optimal internal pixel format based upon * usage and requested format. @@ -1157,11 +1169,6 @@ int mali_gralloc_buffer_allocate(const gralloc_buffer_descriptor_t *descriptors, bufDescriptor->consumer_usage = usage; } - if (log_deprecated_usage_flags(usage)) - { - return -EINVAL; - } - /* Derive the buffer size from descriptor parameters */ err = mali_gralloc_derive_format_and_size(bufDescriptor); if (err != 0) diff --git a/gralloc4/src/mali_gralloc_usages.h b/gralloc4/src/mali_gralloc_usages.h index f20900d..4bab4d3 100644 --- a/gralloc4/src/mali_gralloc_usages.h +++ b/gralloc4/src/mali_gralloc_usages.h @@ -112,6 +112,9 @@ typedef enum #define GRALLOC_USAGE_GPU_DATA_BUFFER static_cast<uint64_t>(hidl_common::BufferUsage::GPU_DATA_BUFFER) #define GRALLOC_USAGE_FRONT_BUFFER static_cast<uint64_t>(aidl_common::BufferUsage::FRONT_BUFFER) +#define UNSUPPORTED_MALI_GRALLOC_USAGE_CUBE_MAP static_cast<uint64_t>(aidl_common::BufferUsage::GPU_CUBE_MAP) +#define UNSUPPORTED_MALI_GRALLOC_USAGE_MIPMAP_COMPLETE static_cast<uint64_t>(aidl_common::BufferUsage::GPU_MIPMAP_COMPLETE) + /* Originally (Gralloc 0.x), Android did not provide an explicit DECODER usage. This was rectified in Android N-MR1/7.1 * when Gralloc 1.0 defined GRALLOC1_PRODUCER_USAGE_VIDEO_DECODER. However, libstagefright continues |