From patchwork Tue Sep 7 14:59:49 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Umang Jain X-Patchwork-Id: 13724 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 82BCFBDC71 for ; Tue, 7 Sep 2021 14:59:59 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id E5AFA6916E; Tue, 7 Sep 2021 16:59:58 +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="A9grPaBl"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id E952B60251 for ; Tue, 7 Sep 2021 16:59:57 +0200 (CEST) Received: from perceval.ideasonboard.com (unknown [103.251.226.180]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id AA85824F; Tue, 7 Sep 2021 16:59:56 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1631026797; bh=/vBnmOfn0o8xQoGo2dbK8Q2UfhU8kYH07uhi2MmnroM=; h=From:To:Cc:Subject:Date:From; b=A9grPaBlQaoXGwYqEuhgxHr8rtf9uQsdTVuc4wGztaJcKjsh10ji1LKSBQJe2NQST vxORqxWdXNkDnzsJeUdrAR2iusWfX5hNoN3lKlPfYKEWcX1FJq/8jK0o0KPew+7gtj hBb4tCb0z2LFJ9rzCqTESSm0/yJW7v3k0D6m12cU= From: Umang Jain To: libcamera-devel@lists.libcamera.org Date: Tue, 7 Sep 2021 20:29:49 +0530 Message-Id: <20210907145949.270824-1-umang.jain@ideasonboard.com> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 Subject: [libcamera-devel] [v2 PATCH] android: mm: cros_camera_buffer: Log failure error on cleanup 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" Failure can still happen by CameraBufferManager during Unlock() and/or Deregister() of camera3Buffer handles. We should be logging those errors as well. Signed-off-by: Umang Jain Reviewed-by: Hirokazu Honda Reviewed-by: Kieran Bingham --- Changes in v2: - Remove a debug log that creeped in by mistake I have been able to spot one of the failure which is happening on my in-developement async post-processing. It is due a failure in Deregister(). It is intermittent and non-fatal as far as I can see. Having a failure log in HAL, apart from https://paste.debian.net/1210728/ helps to know the exact place from where the error is originating from libcamera HAL. --- src/android/mm/cros_camera_buffer.cpp | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/src/android/mm/cros_camera_buffer.cpp b/src/android/mm/cros_camera_buffer.cpp index ec45e04c..86770135 100644 --- a/src/android/mm/cros_camera_buffer.cpp +++ b/src/android/mm/cros_camera_buffer.cpp @@ -73,10 +73,20 @@ CameraBuffer::Private::Private([[maybe_unused]] CameraBuffer *cameraBuffer, CameraBuffer::Private::~Private() { - if (mapped_) - bufferManager_->Unlock(handle_); - if (registered_) - bufferManager_->Deregister(handle_); + int ret; + if (mapped_) { + ret = bufferManager_->Unlock(handle_); + if (ret != 0) + LOG(HAL, Error) << "Failed to unlock buffer: " + << strerror(-ret); + } + + if (registered_) { + ret = bufferManager_->Deregister(handle_); + if (ret != 0) + LOG(HAL, Error) << "Failed to deregister buffer: " + << strerror(-ret); + } } unsigned int CameraBuffer::Private::numPlanes() const