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

Commit 1f9f71e1 authored by Lajos Molnar's avatar Lajos Molnar
Browse files

GraphicBufferMapper: handle devices that do not implement lock_ycbcr

Bug: 19179927
Change-Id: I09ffca954fed3cd2d3466c8396627dc7dbc0052d
parent d6fce7ab
Loading
Loading
Loading
Loading
+9 −2
Original line number Diff line number Diff line
@@ -92,6 +92,10 @@ status_t GraphicBufferMapper::lockYCbCr(buffer_handle_t handle,
    ATRACE_CALL();
    status_t err;

    if (mAllocMod->lock_ycbcr == NULL) {
        return -EINVAL; // do not log failure
    }

    err = mAllocMod->lock_ycbcr(mAllocMod, handle, usage,
            bounds.left, bounds.top, bounds.width(), bounds.height(),
            ycbcr);
@@ -139,16 +143,19 @@ status_t GraphicBufferMapper::lockAsyncYCbCr(buffer_handle_t handle,
    ATRACE_CALL();
    status_t err;

    if (mAllocMod->common.module_api_version >= GRALLOC_MODULE_API_VERSION_0_3) {
    if (mAllocMod->common.module_api_version >= GRALLOC_MODULE_API_VERSION_0_3
            && mAllocMod->lockAsync_ycbcr != NULL) {
        err = mAllocMod->lockAsync_ycbcr(mAllocMod, handle, usage,
                bounds.left, bounds.top, bounds.width(), bounds.height(),
                ycbcr, fenceFd);
    } else {
    } else if (mAllocMod->lock_ycbcr != NULL) {
        sync_wait(fenceFd, -1);
        close(fenceFd);
        err = mAllocMod->lock_ycbcr(mAllocMod, handle, usage,
                bounds.left, bounds.top, bounds.width(), bounds.height(),
                ycbcr);
    } else {
        return -EINVAL; // do not log failure
    }

    ALOGW_IF(err, "lock(...) failed %d (%s)", err, strerror(-err));