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

Commit 1dfaa0d2 authored by Treehugger Robot's avatar Treehugger Robot Committed by Automerger Merge Worker
Browse files

Merge "Codec2: Add sys-prop to allow dmabuf heap usage to be forced" am:...

Merge "Codec2: Add sys-prop to allow dmabuf heap usage to be forced" am: a6ccc188 am: 8d44940f am: 780667a0

Original change: https://android-review.googlesource.com/c/platform/frameworks/av/+/1544967

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I325a953a928277d761404d7d8771953e21b85e15
parents 9bb95aad 780667a0
Loading
Loading
Loading
Loading
+20 −6
Original line number Diff line number Diff line
@@ -102,16 +102,30 @@ C2PlatformAllocatorStoreImpl::C2PlatformAllocatorStoreImpl() {
}

static bool using_ion(void) {
    static int cached_result = -1;

    if (cached_result == -1) {
    static int cached_result = []()->int {
        struct stat buffer;
        cached_result = (stat("/dev/ion", &buffer) == 0);
        if (cached_result)
        int ret = (stat("/dev/ion", &buffer) == 0);

        if (property_get_int32("debug.c2.use_dmabufheaps", 0)) {
            /*
             * Double check that the system heap is present so we
             * can gracefully fail back to ION if we cannot satisfy
             * the override
             */
            ret = (stat("/dev/dma_heap/system", &buffer) != 0);
            if (ret)
                ALOGE("debug.c2.use_dmabufheaps set, but no system heap. Ignoring override!");
            else
                ALOGD("debug.c2.use_dmabufheaps set, forcing DMABUF Heaps");
        }

        if (ret)
            ALOGD("Using ION\n");
        else
            ALOGD("Using DMABUF Heaps\n");
    }
        return ret;
    }();

    return (cached_result == 1);
}