summaryrefslogtreecommitdiff
path: root/gralloc/gr_utils.cpp
diff options
context:
space:
mode:
authorSaurabh Dubey <sdubey@codeaurora.org>2018-06-26 11:31:18 +0530
committerGerrit - the friendly Code Review server <code-review@localhost>2018-07-29 22:46:40 -0700
commit937c4e5f34253275557b19af182cd03115581131 (patch)
tree4ae8b5cdf53bf7f2da863b6febb74d772e8c9fcb /gralloc/gr_utils.cpp
parent0d282436ace29a7df29f59f2e2e129e23331bc9d (diff)
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.cpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/gralloc/gr_utils.cpp b/gralloc/gr_utils.cpp
index d91da928..8b2d4954 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)) {