From patchwork Thu Dec 1 14:51:32 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Umang Jain X-Patchwork-Id: 17933 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 82CB5BE08B for ; Thu, 1 Dec 2022 14:52:49 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 50F9063348; Thu, 1 Dec 2022 15:52:49 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1669906369; bh=aU2q0UOwCJY4ufftiSrikse4mSAYAiaPIuAJdUjOF4M=; h=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=jE9V/tkTOf4HF+o7XTrK2cmwMP02vnydymkUVNFXH52lLy2V8IAZ06TQwy1+QzyRF u+WBmxTylSE8GHye/75D4WO+2nZ0XkugGhDPn88orUvAC4t+vwimkcoDV6MP1dGP5H vNs/7ppGpEYt+lnovrMgJ8KJT3U/L+v2oimUlqI/nBfKt28BE1W0/+4yE63jNVU1nu UsBpsAfr34DHENOi5zL1lsojjJqiK/PiXEgjndRcR6GUVRc2Tq3WzU6rxzR34bMUmt 5VKsZmOPmkwb0IhuM53gt0fjYUzBrmRky24DK1jZQZcJKhw8QMZKwSClr4cUMETG2w ta5uuZKRjHoPg== Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id DD5D863335 for ; Thu, 1 Dec 2022 15:52:47 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="cNAFj9TI"; dkim-atps=neutral Received: from umang.jainideasonboard.com (unknown [210.186.188.117]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id A41306D0; Thu, 1 Dec 2022 15:52:46 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1669906367; bh=aU2q0UOwCJY4ufftiSrikse4mSAYAiaPIuAJdUjOF4M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cNAFj9TIAOCBlblwlMMOETBIWLfxBTLdr6qmodkY8ZYml+RbHIvkMRYAzZrGc1P4T OfQft+ZyqVyQoe1zoPEWCFLDQ6e2ltkzeVi7rzAjmyCqLZHoGEvwi1PGVi+Tuq7BH5 bT4v0xrDzcQ2XGk4HjENw+WJwl9ewW5PSkpLhkpA= To: libcamera-devel@lists.libcamera.org Date: Thu, 1 Dec 2022 22:51:32 +0800 Message-Id: <20221201145133.479794-5-umang.jain@ideasonboard.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221201145133.479794-1-umang.jain@ideasonboard.com> References: <20221201145133.479794-1-umang.jain@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 4/5] ipa: raspberrypi: Send the AF status back 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: , X-Patchwork-Original-From: Umang Jain via libcamera-devel From: Umang Jain Reply-To: Umang Jain Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" From: Jean-Michel Hautbois The user can read the status for each frame with the AfState control value. Populate the AF status into the metadata when it is available. Signed-off-by: Jean-Michel Hautbois Signed-off-by: Umang Jain --- src/ipa/raspberrypi/raspberrypi.cpp | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/ipa/raspberrypi/raspberrypi.cpp b/src/ipa/raspberrypi/raspberrypi.cpp index 3d1ac8fc..19669600 100644 --- a/src/ipa/raspberrypi/raspberrypi.cpp +++ b/src/ipa/raspberrypi/raspberrypi.cpp @@ -91,7 +91,8 @@ static const ControlInfoMap::Map ipaControls{ { &controls::ColourCorrectionMatrix, ControlInfo(-16.0f, 16.0f) }, { &controls::ScalerCrop, ControlInfo(Rectangle{}, Rectangle(65535, 65535, 65535, 65535), Rectangle{}) }, { &controls::FrameDurationLimits, ControlInfo(INT64_C(33333), INT64_C(120000)) }, - { &controls::draft::NoiseReductionMode, ControlInfo(controls::draft::NoiseReductionModeValues) } + { &controls::draft::NoiseReductionMode, ControlInfo(controls::draft::NoiseReductionModeValues) }, + { &controls::AfState, ControlInfo(controls::AfStateValues) }, }; LOG_DEFINE_CATEGORY(IPARPI) @@ -611,6 +612,10 @@ void IPARPi::reportMetadata() m[i] = ccmStatus->matrix[i]; libcameraMetadata_.set(controls::ColourCorrectionMatrix, m); } + + AfStatus *afStatus = rpiMetadata_.getLocked("af.status"); + if (afStatus) + libcameraMetadata_.set(controls::AfState, afStatus->state); } bool IPARPi::validateSensorControls() @@ -1170,6 +1175,14 @@ void IPARPi::processStats(unsigned int bufferId) setDelayedControls.emit(ctrls); } + + struct AfStatus afStatus; + if (rpiMetadata_.get("af.status", afStatus) == 0) { + ControlList lensCtrls(lensCtrls_); + lensCtrls.set(V4L2_CID_FOCUS_ABSOLUTE, + static_cast(afStatus.lensPosition)); + setLensControls.emit(lensCtrls); + } } void IPARPi::applyAWB(const struct AwbStatus *awbStatus, ControlList &ctrls)