From patchwork Mon Oct 18 13:29:22 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Umang Jain X-Patchwork-Id: 14171 X-Patchwork-Delegate: umang.jain@ideasonboard.com Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id ACA70C323E for ; Mon, 18 Oct 2021 13:29:50 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 6B0F268F64; Mon, 18 Oct 2021 15:29:50 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="AOsD7tvU"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id BDDC768F60 for ; Mon, 18 Oct 2021 15:29:48 +0200 (CEST) Received: from perceval.ideasonboard.com (unknown [103.238.109.14]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id D01A28C6; Mon, 18 Oct 2021 15:29:47 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1634563788; bh=Pna2DOMPVmcbBo9n3dA7+M7H4FWppL8o3I67I00q8y0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AOsD7tvUJmuuiu3ExM8hGEpukl0OtUObX2d5UBLCkdiScWTPv9gWqOCVqYh5R+YYu 5jgC+3EbkJtJOXh3J3XEV6l0D0FCzb43J9DiNR1x12QGMgN1SuIRw+SgPY97mfKb9B hV/fJQxyaC8NySsIy6I09dBitdTVxNYZj5mT85oI= From: Umang Jain To: libcamera-devel@lists.libcamera.org Date: Mon, 18 Oct 2021 18:59:22 +0530 Message-Id: <20211018132923.476242-11-umang.jain@ideasonboard.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211018132923.476242-1-umang.jain@ideasonboard.com> References: <20211018132923.476242-1-umang.jain@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 10/11] android: camera_stream: Don't close fence if wait times out X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" From: Laurent Pinchart The camera HAL APIs requires that any acquire fence that hasn't been waited on to be sent back to the framework as a release fence. The CameraDevice already copies the acquire fence to the release fence when signaling request completion, but the CameraStream incorrectly closes the fence when a wait times out and sets it to -1. Fix it. Signed-off-by: Laurent Pinchart Reviewed-by: Umang Jain --- src/android/camera_stream.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/android/camera_stream.cpp b/src/android/camera_stream.cpp index 9b5cd0c4..8e6ccb83 100644 --- a/src/android/camera_stream.cpp +++ b/src/android/camera_stream.cpp @@ -147,16 +147,16 @@ int CameraStream::process(const FrameBuffer &source, Camera3RequestDescriptor *request) { /* Handle waiting on fences on the destination buffer. */ - int fence = dest.fence; - if (fence != -1) { - int ret = waitFence(fence); - ::close(fence); - dest.fence = -1; + if (dest.fence != -1) { + int ret = waitFence(dest.fence); if (ret < 0) { LOG(HAL, Error) << "Failed waiting for fence: " - << fence << ": " << strerror(-ret); + << dest.fence << ": " << strerror(-ret); return ret; } + + ::close(dest.fence); + dest.fence = -1; } if (!postProcessor_)