patches/frameworks/av/0005-Camera-Avoid-unnecessary-close-of-buffer-acquire-fen.patch

44 lines
1.9 KiB
Diff

From d68bf009f5f9065163ae6ece838cdb77784e3595 Mon Sep 17 00:00:00 2001
From: Emilian Peev <epeev@google.com>
Date: Fri, 5 Aug 2022 17:28:06 -0700
Subject: [PATCH 5/5] 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
---
.../camera/libcameraservice/device3/Camera3OutputStream.cpp | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/services/camera/libcameraservice/device3/Camera3OutputStream.cpp b/services/camera/libcameraservice/device3/Camera3OutputStream.cpp
index 1e20ee0eb8..f23a2de340 100644
--- a/services/camera/libcameraservice/device3/Camera3OutputStream.cpp
+++ b/services/camera/libcameraservice/device3/Camera3OutputStream.cpp
@@ -327,7 +327,7 @@ status_t Camera3OutputStream::fixUpHidlJpegBlobHeader(ANativeWindowBuffer* anwBu
status_t res =
gbLocker.lockAsync(
GraphicBuffer::USAGE_SW_READ_OFTEN | GraphicBuffer::USAGE_SW_WRITE_RARELY,
- &mapped, fenceFd.get());
+ &mapped, fenceFd.release());
if (res != OK) {
ALOGE("%s: Failed to lock the buffer: %s (%d)", __FUNCTION__, strerror(-res), res);
return res;
@@ -1298,7 +1298,7 @@ void Camera3OutputStream::dumpImageToDisk(nsecs_t timestamp,
void* mapped = nullptr;
base::unique_fd fenceFd(dup(fence));
status_t res = graphicBuffer->lockAsync(GraphicBuffer::USAGE_SW_READ_OFTEN, &mapped,
- fenceFd.get());
+ fenceFd.release());
if (res != OK) {
ALOGE("%s: Failed to lock the buffer: %s (%d)", __FUNCTION__, strerror(-res), res);
return;
--
2.37.2