summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Tim Van Patten <timvp@google.com> 2021-06-02 16:01:38 -0600
committer Tim Van Patten <timvp@google.com> 2021-06-03 01:19:20 +0000
commitaa8b7ac832440f95e7c37687946c1ae4f84472b4 (patch)
tree729c0541531e7ba01f1e4505754e41b3fb1b81fe
parentf3e492125bf0df905e98a138d972c917d8f028db (diff)
Return error code directly in allocateHelper()
libs/ui/GraphicBufferAllocator falsely maps error != NO_ERROR to NO_MEMORY upon allocation failure. However, from the driver implementation point of view, we need to distinguish unsupported v.s. oom, which is quite natural if the error code is returned directly. Bug: b/189221081 Test: Presubmit Change-Id: I75ce2d0d4c723c0d58ba8c27b9b68404be424ac8
-rw-r--r--libs/ui/GraphicBufferAllocator.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/libs/ui/GraphicBufferAllocator.cpp b/libs/ui/GraphicBufferAllocator.cpp
index 91d2d58df7..3f958ba68f 100644
--- a/libs/ui/GraphicBufferAllocator.cpp
+++ b/libs/ui/GraphicBufferAllocator.cpp
@@ -128,8 +128,9 @@ status_t GraphicBufferAllocator::allocateHelper(uint32_t width, uint32_t height,
}
// Ensure that layerCount is valid.
- if (layerCount < 1)
+ if (layerCount < 1) {
layerCount = 1;
+ }
// TODO(b/72323293, b/72703005): Remove these invalid bits from callers
usage &= ~static_cast<uint64_t>((1 << 10) | (1 << 13));
@@ -140,7 +141,7 @@ status_t GraphicBufferAllocator::allocateHelper(uint32_t width, uint32_t height,
ALOGE("Failed to allocate (%u x %u) layerCount %u format %d "
"usage %" PRIx64 ": %d",
width, height, layerCount, format, usage, error);
- return NO_MEMORY;
+ return error;
}
if (!importBuffer) {