Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit aa8b7ac8 authored by Tim Van Patten's avatar Tim Van Patten
Browse files

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
parent f3e49212
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -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) {