From patchwork Thu Jun 30 13:39:00 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacopo Mondi X-Patchwork-Id: 16479 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 983F3C3273 for ; Thu, 30 Jun 2022 13:39:56 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id F336F656AF; Thu, 30 Jun 2022 15:39:55 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1656596396; bh=oJGDA59ynjCnTwfOvPazRfGrA9ltGSrJ9yJbKPytX8c=; 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=1bjVYOHCdrDMKvKx9jG6cswhvcRf+8nZK4XnGAF0cia+dEA9ArdcbeadPjGsW/xZW DExEIB/77m349MbFHuGwDH1kkXpPt9NrR8FCTxOQm1wjP173t+tTXGxK8qFbQsKtWS P2/tN9xf91+8kKrfIfBb04+gfHuq24mfgtRg/sQod325NO6iVcyPM8qniS0St1Wbzg tW5d3KDnaUJLq/HKdtfwfCGup+cUaavHJzzlNA//lPiT9Gand4JA/tOomwr9hfBJKX 76Srqi9Yewd33PUcovpMKdym+mB4lPiGRjg5amc/5052SjkM1tnjOp9uSuymAkBe4+ ZcTpDagdmwZwA== Received: from relay1-d.mail.gandi.net (relay1-d.mail.gandi.net [217.70.183.193]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id F223E65650 for ; Thu, 30 Jun 2022 15:39:50 +0200 (CEST) Received: (Authenticated sender: jacopo@jmondi.org) by mail.gandi.net (Postfix) with ESMTPSA id 01590240007; Thu, 30 Jun 2022 13:39:48 +0000 (UTC) To: libcamera-devel@lists.libcamera.org Date: Thu, 30 Jun 2022 15:39:00 +0200 Message-Id: <20220630133902.321099-22-jacopo@jmondi.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220630133902.321099-1-jacopo@jmondi.org> References: <20220630133902.321099-1-jacopo@jmondi.org> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v3 21/23] ipa: ipu3: Add and use LensFocusAbsolute control 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: Jacopo Mondi via libcamera-devel From: Jacopo Mondi Reply-To: Jacopo Mondi Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" Add to the internal controls LensFocusAbsolute as a draft control as it is currently identical to V4L2_CID_FOCUS_ABSOLUTE. Use the newly introduced control in the IPU3 pipeline handler and IPA module. Signed-off-by: Jacopo Mondi --- include/libcamera/ipa/ipu3.mojom | 3 +-- src/ipa/ipu3/ipu3.cpp | 7 ++----- src/libcamera/internal_control_ids.yaml | 13 +++++++++++++ src/libcamera/pipeline/ipu3/ipu3.cpp | 13 +++++-------- 4 files changed, 21 insertions(+), 15 deletions(-) diff --git a/include/libcamera/ipa/ipu3.mojom b/include/libcamera/ipa/ipu3.mojom index 64fe65fdd5fc..bfeadc58c52a 100644 --- a/include/libcamera/ipa/ipu3.mojom +++ b/include/libcamera/ipa/ipu3.mojom @@ -35,8 +35,7 @@ interface IPAIPU3Interface { }; interface IPAIPU3EventInterface { - setSensorControls(uint32 frame, libcamera.ControlList sensorControls, - libcamera.ControlList lensControls); + setSensorControls(uint32 frame, libcamera.ControlList sensorControls); paramsBufferReady(uint32 frame); metadataReady(uint32 frame, libcamera.ControlList metadata); }; diff --git a/src/ipa/ipu3/ipu3.cpp b/src/ipa/ipu3/ipu3.cpp index 6d622b4c290b..2f158df367a8 100644 --- a/src/ipa/ipu3/ipu3.cpp +++ b/src/ipa/ipu3/ipu3.cpp @@ -541,12 +541,9 @@ void IPAIPU3::setControls(unsigned int frame, const IPAActiveState &state) ControlList ctrls(controls::internal::controls); ctrls.set(controls::internal::ExposureTime, state.agc.exposure); ctrls.set(controls::internal::AnalogueGain, static_cast(state.agc.gain)); + ctrls.set(controls::internal::draft::LensFocusAbsolute, state.af.focus); - ControlList lensCtrls(controls::controls); - lensCtrls.set(V4L2_CID_FOCUS_ABSOLUTE, - static_cast(state.af.focus)); - - setSensorControls.emit(frame, ctrls, lensCtrls); + setSensorControls.emit(frame, ctrls); } } /* namespace ipa::ipu3 */ diff --git a/src/libcamera/internal_control_ids.yaml b/src/libcamera/internal_control_ids.yaml index 6d3775afcf67..804c227213a7 100644 --- a/src/libcamera/internal_control_ids.yaml +++ b/src/libcamera/internal_control_ids.yaml @@ -24,4 +24,17 @@ controls: description: | The sensor analogue gain value. + # ---------------------------------------------------------------------------- + # Draft controls section + + - LensFocusAbsolute: + type: int32_t + draft: true + description: | + This control sets the focal point of the camera to the specified + position. The unit is undefined. Positive values set the focus closer to + the camera, negative values towards infinity. + + Currently identical to V4L2_CID_FOCUS_ABSOLUTE. + ... diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp index 55b96137f065..1dbcdd0b56e6 100644 --- a/src/libcamera/pipeline/ipu3/ipu3.cpp +++ b/src/libcamera/pipeline/ipu3/ipu3.cpp @@ -86,8 +86,7 @@ public: private: void metadataReady(unsigned int id, const ControlList &metadata); void paramsBufferReady(unsigned int id); - void setSensorControls(unsigned int id, const ControlList &sensorControls, - const ControlList &lensControls); + void setSensorControls(unsigned int id, const ControlList &sensorControls); }; class IPU3CameraConfiguration : public CameraConfiguration @@ -1247,8 +1246,7 @@ int IPU3CameraData::loadIPA() } void IPU3CameraData::setSensorControls([[maybe_unused]] unsigned int id, - const ControlList &sensorControls, - const ControlList &lensControls) + const ControlList &sensorControls) { CameraSensor *sensor = cio2_.sensor(); @@ -1258,12 +1256,11 @@ void IPU3CameraData::setSensorControls([[maybe_unused]] unsigned int id, if (!focusLens) return; - if (!lensControls.contains(V4L2_CID_FOCUS_ABSOLUTE)) + if (!sensorControls.contains(controls::internal::draft::LensFocusAbsolute)) return; - const ControlValue &focusValue = lensControls.get(V4L2_CID_FOCUS_ABSOLUTE); - - focusLens->setFocusPosition(focusValue.get()); + int32_t focusAbsolute = sensorControls.get(controls::internal::draft::LensFocusAbsolute); + focusLens->setFocusPosition(focusAbsolute); } void IPU3CameraData::paramsBufferReady(unsigned int id)