diff options
author | Saurabh Dubey <sdubey@codeaurora.org> | 2018-06-26 11:31:18 +0530 |
---|---|---|
committer | Gerrit - the friendly Code Review server <code-review@localhost> | 2018-07-13 08:09:42 -0700 |
commit | 91f0c3962ae387ea88ad2ce09d2febe51af55bcc (patch) | |
tree | af8c84d9e5686df89a368370d0eb1d63baab847f /gralloc/gr_utils.cpp | |
parent | e0c168c3f6ec565d9f8050a54a062f7677696fd6 (diff) | |
download | display-91f0c3962ae387ea88ad2ce09d2febe51af55bcc.tar.gz |
Gralloc: Add support to disable AHardwareBuffer
Add property to disable calling into adreno size calculation APIs
Change-Id: I538a880769c4ce55ac42bcccfd5faebfa284d4e0
CRs-Fixed: 2268733
Diffstat (limited to 'gralloc/gr_utils.cpp')
-rw-r--r-- | gralloc/gr_utils.cpp | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/gralloc/gr_utils.cpp b/gralloc/gr_utils.cpp index b6938c76..baba0ec6 100644 --- a/gralloc/gr_utils.cpp +++ b/gralloc/gr_utils.cpp @@ -218,6 +218,21 @@ uint32_t GetDataAlignment(int format, uint64_t usage) { return align; } +bool IsGPUFlagSupported(uint64_t usage) { + bool ret = true; + if ((usage & BufferUsage::GPU_MIPMAP_COMPLETE)) { + ALOGE("GPU_MIPMAP_COMPLETE not supported"); + ret = false; + } + + if ((usage & BufferUsage::GPU_CUBE_MAP)) { + ALOGE("GPU_CUBE_MAP not supported"); + ret = false; + } + + return ret; +} + // Returns the final buffer size meant to be allocated with ion unsigned int GetSize(const BufferInfo &info, unsigned int alignedw, unsigned int alignedh) { unsigned int size = 0; @@ -226,6 +241,11 @@ unsigned int GetSize(const BufferInfo &info, unsigned int alignedw, unsigned int int height = info.height; uint64_t usage = info.usage; + if (!IsGPUFlagSupported(usage)) { + ALOGE("Unsupported GPU usage flags present 0x%" PRIx64, usage); + return 0; + } + if (IsUBwcEnabled(format, usage)) { size = GetUBwcSize(width, height, format, alignedw, alignedh); } else if (IsUncompressedRGBFormat(format)) { |