From patchwork Tue Sep 7 14:54:59 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Umang Jain X-Patchwork-Id: 13723 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 6C388BE175 for ; Tue, 7 Sep 2021 14:55:08 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id DDFB660251; Tue, 7 Sep 2021 16:55:07 +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="ggZFp6vX"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 3AC9A60251 for ; Tue, 7 Sep 2021 16:55:06 +0200 (CEST) Received: from perceval.ideasonboard.com (unknown [103.251.226.180]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 258DB24F; Tue, 7 Sep 2021 16:55:04 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1631026505; bh=HgSWKStKEvtiQrOm2jARuliM2eIyFnnKeDkcMfw7Sl8=; h=From:To:Cc:Subject:Date:From; b=ggZFp6vX8ocS/a0/piPDLAveqX014irT/x77BvKs0tFhJ2PRuK1ioqo27yc34hOKL k0gaMDMkHdkI6SEmHSd3VP9nyumT7h3Mqz3DOHlA2ikT7n4ekbKbkCyYCrgspqoSoS MyqFLbs/+eTQkuctOv+TOw7wYeKjzJpWe50+CKRk= From: Umang Jain To: libcamera-devel@lists.libcamera.org Date: Tue, 7 Sep 2021 20:24:59 +0530 Message-Id: <20210907145459.270129-1-umang.jain@ideasonboard.com> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 Subject: [libcamera-devel] [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 --- 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 | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/src/android/mm/cros_camera_buffer.cpp b/src/android/mm/cros_camera_buffer.cpp index ec45e04c..307914c3 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 @@ -138,6 +148,7 @@ size_t CameraBuffer::Private::jpegBufferSize([[maybe_unused]] size_t maxJpegBuff void CameraBuffer::Private::map() { int ret; + LOG(HAL, Error) << "GEtting mapped : " << numPlanes_; switch (numPlanes_) { case 1: { ret = bufferManager_->Lock(handle_, 0, 0, 0, 0, 0, &mem.addr);