From patchwork Fri Oct 1 10:33:23 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Elder X-Patchwork-Id: 14020 X-Patchwork-Delegate: paul.elder@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 07E68BDC71 for ; Fri, 1 Oct 2021 10:33:49 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id BBDF7691B0; Fri, 1 Oct 2021 12:33:48 +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="lPUkJwOV"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 6823A691BB for ; Fri, 1 Oct 2021 12:33:46 +0200 (CEST) Received: from pyrite.rasen.tech (unknown [IPv6:2400:4051:61:600:2c71:1b79:d06d:5032]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id F3059596; Fri, 1 Oct 2021 12:33:44 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1633084426; bh=DGi34lE8u9nRpPGBnVrApqYb6dEBAYeELfDzkOu+lDU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lPUkJwOVO/dmJLSZKqHqH9/45vaedwcp5Y8ihl3G72kuN5YqvF/IaKHlwg0stTIb0 ScJlNHca7GlSwo6VST8/xYuwumtIHYNAw0Jvwjp+uveqFdEydY1h9QuFA4pklQlR6h hlOYFUAXR5GZEa/ixnv0b5NoHCTBvqctwcy23Dp4= From: Paul Elder To: libcamera-devel@lists.libcamera.org Date: Fri, 1 Oct 2021 19:33:23 +0900 Message-Id: <20211001103325.1077590-6-paul.elder@ideasonboard.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20211001103325.1077590-1-paul.elder@ideasonboard.com> References: <20211001103325.1077590-1-paul.elder@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v2 5/7] libcamera: pipeline: rkisp1: Support the new AE controls 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" Add support for the new AE controls in the rkisp1 pipeline handler, and in the IPA. Bug: https://bugs.libcamera.org/show_bug.cgi?id=42 Bug: https://bugs.libcamera.org/show_bug.cgi?id=43 Signed-off-by: Paul Elder --- No change in v2 Initial version: It seems that the rkisp1 pipeline handler doesn't properly expose its control capabilities? And even though it exposed AeEnable with both true and false it didn't expose or handle AnalogueGain nor ExposureTime either? So I just simply replaced AeEnable with ExposureTimeMode for now. --- src/ipa/rkisp1/rkisp1.cpp | 18 ++++++++++-------- src/libcamera/pipeline/rkisp1/rkisp1.cpp | 4 ++-- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/src/ipa/rkisp1/rkisp1.cpp b/src/ipa/rkisp1/rkisp1.cpp index bf2c13b6..708adfc9 100644 --- a/src/ipa/rkisp1/rkisp1.cpp +++ b/src/ipa/rkisp1/rkisp1.cpp @@ -52,7 +52,7 @@ private: const rkisp1_stat_buffer *stats); void setControls(unsigned int frame); - void metadataReady(unsigned int frame, unsigned int aeState); + void metadataReady(unsigned int frame, int aeState); std::map buffers_; std::map mappedBuffers_; @@ -221,8 +221,9 @@ void IPARkISP1::queueRequest(unsigned int frame, rkisp1_params_cfg *params, memset(params, 0, sizeof(*params)); /* Auto Exposure on/off. */ - if (controls.contains(controls::AeEnable)) { - autoExposure_ = controls.get(controls::AeEnable); + if (controls.contains(controls::ExposureTimeMode)) { + autoExposure_ = (controls.get(controls::ExposureTimeMode) == + controls::ExposureTimeModeAuto); if (autoExposure_) params->module_ens = RKISP1_CIF_ISP_MODULE_AEC; @@ -239,7 +240,7 @@ void IPARkISP1::updateStatistics(unsigned int frame, const rkisp1_stat_buffer *stats) { const rkisp1_cif_isp_stat *params = &stats->params; - unsigned int aeState = 0; + int aeState = controls::AeStateInactive; if (stats->meas_type & RKISP1_CIF_ISP_STAT_AUTOEXP) { const rkisp1_cif_isp_ae_stat *ae = ¶ms->ae; @@ -274,7 +275,9 @@ void IPARkISP1::updateStatistics(unsigned int frame, setControls(frame + 1); } - aeState = fabs(factor - 1.0f) < 0.05f ? 2 : 1; + aeState = fabs(factor - 1.0f) < 0.05f ? + controls::AeStateConverged : + controls::AeStateSearching; } metadataReady(frame, aeState); @@ -293,12 +296,11 @@ void IPARkISP1::setControls(unsigned int frame) queueFrameAction.emit(frame, op); } -void IPARkISP1::metadataReady(unsigned int frame, unsigned int aeState) +void IPARkISP1::metadataReady(unsigned int frame, int aeState) { ControlList ctrls(controls::controls); - if (aeState) - ctrls.set(controls::AeLocked, aeState == 2); + ctrls.set(controls::AeState, aeState); RkISP1Action op; op.op = ActionMetadata; diff --git a/src/libcamera/pipeline/rkisp1/rkisp1.cpp b/src/libcamera/pipeline/rkisp1/rkisp1.cpp index 98008862..1ed4522f 100644 --- a/src/libcamera/pipeline/rkisp1/rkisp1.cpp +++ b/src/libcamera/pipeline/rkisp1/rkisp1.cpp @@ -935,8 +935,8 @@ int PipelineHandlerRkISP1::createCamera(MediaEntity *sensor) ControlInfoMap::Map ctrls; ctrls.emplace(std::piecewise_construct, - std::forward_as_tuple(&controls::AeEnable), - std::forward_as_tuple(false, true)); + std::forward_as_tuple(&controls::ExposureTimeMode), + std::forward_as_tuple(ControlInfo(controls::AeExposureModeValues))); data->controlInfo_ = ControlInfoMap(std::move(ctrls), controls::controls);