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

Commit 0dc64e4d authored by Wonsik Kim's avatar Wonsik Kim Committed by Automerger Merge Worker
Browse files

Merge "C2AllocatorGralloc: Limit Gralloc4Mapper_lock to T and above" am: 47f12cdd

parents bb504043 47f12cdd
Loading
Loading
Loading
Loading
+10 −4
Original line number Diff line number Diff line
@@ -54,6 +54,10 @@ namespace /* unnamed */ {
    static_assert((~C2MemoryUsage::PLATFORM_MASK & PASSTHROUGH_USAGE_MASK) == 0, "");
} // unnamed

static bool isAtLeastT() {
    return android_get_device_api_level() >= __ANDROID_API_T__;
}

C2MemoryUsage C2AndroidMemoryUsage::FromGrallocUsage(uint64_t usage) {
    // gralloc does not support WRITE_PROTECTED
    return C2MemoryUsage(
@@ -760,11 +764,13 @@ c2_status_t C2AllocationGralloc::map(
        default: {
            // We don't know what it is, let's try to lock it with gralloc4
            android_ycbcr ycbcrLayout;
            if (isAtLeastT()) {
                c2_status_t status = Gralloc4Mapper_lock(
                        const_cast<native_handle_t*>(mBuffer), grallocUsage, rect, layout, addr);
                if (status == C2_OK) {
                    break;
                }
            }

            // fallback to lockYCbCr
            status_t err = GraphicBufferMapper::get().lockYCbCr(