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

Commit 9dd7e5c3 authored by Dan Stoza's avatar Dan Stoza Committed by Android Git Automerger
Browse files

am f9a3b73e: am f0c17b08: Merge "Avoid closing invalid FD in Surface and GraphicBufferMapper"

* commit 'f9a3b73e':
  Avoid closing invalid FD in Surface and GraphicBufferMapper
parents fb28d89b f9a3b73e
Loading
Loading
Loading
Loading
+8 −4
Original line number Original line Diff line number Diff line
@@ -131,8 +131,10 @@ status_t GraphicBufferMapper::lockAsync(buffer_handle_t handle,
                bounds.left, bounds.top, bounds.width(), bounds.height(),
                bounds.left, bounds.top, bounds.width(), bounds.height(),
                vaddr, fenceFd);
                vaddr, fenceFd);
    } else {
    } else {
        if (fenceFd >= 0) {
            sync_wait(fenceFd, -1);
            sync_wait(fenceFd, -1);
            close(fenceFd);
            close(fenceFd);
        }
        err = mAllocMod->lock(mAllocMod, handle, static_cast<int>(usage),
        err = mAllocMod->lock(mAllocMod, handle, static_cast<int>(usage),
                bounds.left, bounds.top, bounds.width(), bounds.height(),
                bounds.left, bounds.top, bounds.width(), bounds.height(),
                vaddr);
                vaddr);
@@ -154,8 +156,10 @@ status_t GraphicBufferMapper::lockAsyncYCbCr(buffer_handle_t handle,
                static_cast<int>(usage), bounds.left, bounds.top,
                static_cast<int>(usage), bounds.left, bounds.top,
                bounds.width(), bounds.height(), ycbcr, fenceFd);
                bounds.width(), bounds.height(), ycbcr, fenceFd);
    } else if (mAllocMod->lock_ycbcr != NULL) {
    } else if (mAllocMod->lock_ycbcr != NULL) {
        if (fenceFd >= 0) {
            sync_wait(fenceFd, -1);
            sync_wait(fenceFd, -1);
            close(fenceFd);
            close(fenceFd);
        }
        err = mAllocMod->lock_ycbcr(mAllocMod, handle, static_cast<int>(usage),
        err = mAllocMod->lock_ycbcr(mAllocMod, handle, static_cast<int>(usage),
                bounds.left, bounds.top, bounds.width(), bounds.height(),
                bounds.left, bounds.top, bounds.width(), bounds.height(),
                ycbcr);
                ycbcr);