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

Commit f6fc009d authored by Emilian Peev's avatar Emilian Peev Committed by Łukasz Patron
Browse files

Camera: Avoid unnecessary close of buffer acquire fence fds

According to the gralloc lock documentation:
The ownership of acquireFence is always transferred to the callee, even
on errors.

Bug: 241455881
Test: Manual using camera application
Change-Id: Ieec34b54aaa7f0d773eccb593c3daaa3e41bae0b
Merged-In: Ieec34b54aaa7f0d773eccb593c3daaa3e41bae0b
parent ba635998
Loading
Loading
Loading
Loading
+2 −2
Original line number Original line Diff line number Diff line
@@ -331,7 +331,7 @@ status_t Camera3OutputStream::fixUpHidlJpegBlobHeader(ANativeWindowBuffer* anwBu
    status_t res =
    status_t res =
            gbLocker.lockAsync(
            gbLocker.lockAsync(
                    GraphicBuffer::USAGE_SW_READ_OFTEN | GraphicBuffer::USAGE_SW_WRITE_RARELY,
                    GraphicBuffer::USAGE_SW_READ_OFTEN | GraphicBuffer::USAGE_SW_WRITE_RARELY,
                    &mapped, fenceFd.get());
                    &mapped, fenceFd.release());
    if (res != OK) {
    if (res != OK) {
        ALOGE("%s: Failed to lock the buffer: %s (%d)", __FUNCTION__, strerror(-res), res);
        ALOGE("%s: Failed to lock the buffer: %s (%d)", __FUNCTION__, strerror(-res), res);
        return res;
        return res;
@@ -1327,7 +1327,7 @@ void Camera3OutputStream::dumpImageToDisk(nsecs_t timestamp,
    void* mapped = nullptr;
    void* mapped = nullptr;
    base::unique_fd fenceFd(dup(fence));
    base::unique_fd fenceFd(dup(fence));
    status_t res = graphicBuffer->lockAsync(GraphicBuffer::USAGE_SW_READ_OFTEN, &mapped,
    status_t res = graphicBuffer->lockAsync(GraphicBuffer::USAGE_SW_READ_OFTEN, &mapped,
            fenceFd.get());
            fenceFd.release());
    if (res != OK) {
    if (res != OK) {
        ALOGE("%s: Failed to lock the buffer: %s (%d)", __FUNCTION__, strerror(-res), res);
        ALOGE("%s: Failed to lock the buffer: %s (%d)", __FUNCTION__, strerror(-res), res);
        return;
        return;