From patchwork Mon Jun 13 14:28:47 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jean-Michel Hautbois X-Patchwork-Id: 16213 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 C3F82C3276 for ; Mon, 13 Jun 2022 14:29:09 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 80D6F65637; Mon, 13 Jun 2022 16:29:07 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1655130547; bh=kWPYmsC3gArNgGN0Lgmk04URpBFgcaidkxOv3EkffAE=; 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=OOQDcdUAFHlW2jkNNYs0kHBJRPhCJxNGiaVOpYjXHo6QdXe+2Fc3TdpJKvAavHH1K 73e7sWk46ztOMXX1FlmjvSJAgJI8VX9qIdKMBDPTbBnhylLWN7sVBrMM2rJ4rwVcUi RtwzloTXcP+L+kvZy4RxrukYZKiQFRkwK8pXZgUKvUZzeI3mdspnZ8VkdlESIp+Em9 Espm7A2aRRM9uBz+LpIFJ/W/tVo3sl0pCpkw57AgDo8AIGl5FnPRr5eogxNjpBdNvf 2Oozf0wJbPqnj+Z5ySo6QQVfaYV3nBxGoT6ZY8ZtYTa93XOJL8EB1BYyiFDnsLvga9 vP9KPaJFTEMAQ== Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id C472D65635 for ; Mon, 13 Jun 2022 16:29:00 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="SP3rZjTI"; dkim-atps=neutral Received: from tatooine.ideasonboard.com (unknown [IPv6:2a01:e0a:169:7140:a1c7:c28c:7720:9b30]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 7845687B; Mon, 13 Jun 2022 16:29:00 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1655130540; bh=kWPYmsC3gArNgGN0Lgmk04URpBFgcaidkxOv3EkffAE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SP3rZjTI3x4nX6UHx+BTIkqjPv3I7Si0WAGKpkcL97A2RmAx16l4UnJGQhEUtz6CD AwzqaaJRLUTz8cyZHrNC8Ov0TaPKlRXh4idRfPjVu6MlP9SWIxkwm1c+YYXnpT9rJ7 3l4iP6+L0p9nVQ2w+q9knEvgQdZGGsBB7vUUGDv4= To: libcamera-devel@lists.libcamera.org Date: Mon, 13 Jun 2022 16:28:47 +0200 Message-Id: <20220613142853.98484-5-jeanmichel.hautbois@ideasonboard.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220613142853.98484-1-jeanmichel.hautbois@ideasonboard.com> References: <20220613142853.98484-1-jeanmichel.hautbois@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 04/10] 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: Jean-Michel Hautbois via libcamera-devel From: Jean-Michel Hautbois Reply-To: Jean-Michel Hautbois Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" 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 --- include/libcamera/ipa/raspberrypi.h | 3 ++- src/ipa/raspberrypi/raspberrypi.cpp | 13 +++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/include/libcamera/ipa/raspberrypi.h b/include/libcamera/ipa/raspberrypi.h index 6a56b008..519f7160 100644 --- a/include/libcamera/ipa/raspberrypi.h +++ b/include/libcamera/ipa/raspberrypi.h @@ -45,7 +45,8 @@ static const ControlInfoMap Controls({ { &controls::ColourCorrectionMatrix, ControlInfo(-16.0f, 16.0f) }, { &controls::ScalerCrop, ControlInfo(Rectangle{}, Rectangle(65535, 65535, 65535, 65535), Rectangle{}) }, { &controls::FrameDurationLimits, ControlInfo(INT64_C(1000), INT64_C(1000000000)) }, - { &controls::draft::NoiseReductionMode, ControlInfo(controls::draft::NoiseReductionModeValues) } + { &controls::draft::NoiseReductionMode, ControlInfo(controls::draft::NoiseReductionModeValues) }, + { &controls::AfState, ControlInfo(controls::AfStateValues) } }, controls::controls); } /* namespace RPi */ diff --git a/src/ipa/raspberrypi/raspberrypi.cpp b/src/ipa/raspberrypi/raspberrypi.cpp index 1e9e2e61..a4e1c834 100644 --- a/src/ipa/raspberrypi/raspberrypi.cpp +++ b/src/ipa/raspberrypi/raspberrypi.cpp @@ -547,6 +547,11 @@ 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() @@ -1101,6 +1106,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)