From patchwork Tue Mar 19 12:05:16 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Klug X-Patchwork-Id: 19754 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 E1060C3274 for ; Tue, 19 Mar 2024 12:05:46 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 8FFC362CA7; Tue, 19 Mar 2024 13:05:46 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="flobxmU8"; 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 5B54E62D36 for ; Tue, 19 Mar 2024 13:05:31 +0100 (CET) Received: from jasper.fritz.box (unknown [IPv6:2a00:6020:448c:6c00:1478:344b:8fcb:baf5]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 90BA2480; Tue, 19 Mar 2024 13:05:04 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1710849904; bh=d5uXxDEA4RWOM0Eb7ankorQ6javh8XT2aBCxCfLX1jg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=flobxmU8Vw4lk1poyKBZzWIqifJmDSWo9mAA1xyH4ht3egjm6vJNGTuAmgQZtoErX mtqOz67u4ay2ozadIoXkOu07+Pup3H42/M+eWwPxi3P1Hqu1Eflo4Bftqq8OofeBv7 3Cg9RWsAiQnkEHcqTwwyaNgB3EIFDKcihkjKvww8= From: Stefan Klug To: libcamera-devel@lists.libcamera.org Cc: Stefan Klug Subject: [PATCH v3 15/16] pipeline: rkisp1: Fix per-frame-controls in manual mode Date: Tue, 19 Mar 2024 13:05:16 +0100 Message-Id: <20240319120517.362082-16-stefan.klug@ideasonboard.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20240319120517.362082-1-stefan.klug@ideasonboard.com> References: <20240319120517.362082-1-stefan.klug@ideasonboard.com> MIME-Version: 1.0 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" If the isp is not regulating, it can forward the request directly to the pipeline handler which will then be able to feed the delayed controls early enough. This solutions is quite simplistic and will need more thoughts as soon as other algorithms get implemented. Signed-off-by: Stefan Klug --- src/ipa/rkisp1/rkisp1.cpp | 16 ++++++++++++++-- src/libcamera/pipeline/rkisp1/rkisp1.cpp | 2 +- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/src/ipa/rkisp1/rkisp1.cpp b/src/ipa/rkisp1/rkisp1.cpp index 6bc09198..240e11e6 100644 --- a/src/ipa/rkisp1/rkisp1.cpp +++ b/src/ipa/rkisp1/rkisp1.cpp @@ -322,6 +322,12 @@ void IPARkISP1::queueRequest(const uint32_t frame, const ControlList &controls) continue; algo->queueRequest(context_, frame, frameContext, controls); } + + /* Fast path, if we are not regulating */ + if (!frameContext.agc.autoEnabled) { + ControlList ctrls = getControls(frame); + setSensorControls.emit(frame, ctrls); + } } void IPARkISP1::fillParamsBuffer(const uint32_t frame, const uint32_t bufferId) @@ -370,8 +376,14 @@ void IPARkISP1::processStatsBuffer(const uint32_t frame, const uint32_t bufferId algo->process(context_, frame, frameContext, stats, metadata); } - ControlList ctrls = getControls(frame); - setSensorControls.emit(frame, ctrls); + /* + * Set controls only when we are actually regulation. Otherwise, the controls + * where already set in queueRequest + */ + if (frameContext.agc.autoEnabled) { + ControlList ctrls = getControls(frame); + setSensorControls.emit(frame, ctrls); + } metadataReady.emit(frame, metadata); } diff --git a/src/libcamera/pipeline/rkisp1/rkisp1.cpp b/src/libcamera/pipeline/rkisp1/rkisp1.cpp index abb21968..ab452d8f 100644 --- a/src/libcamera/pipeline/rkisp1/rkisp1.cpp +++ b/src/libcamera/pipeline/rkisp1/rkisp1.cpp @@ -401,7 +401,7 @@ void RkISP1CameraData::paramFilled(unsigned int frame) void RkISP1CameraData::setSensorControls([[maybe_unused]] unsigned int frame, const ControlList &sensorControls) { - delayedCtrls_->push(sensorControls); + delayedCtrls_->push(sensorControls, frame); } void RkISP1CameraData::metadataReady(unsigned int frame, const ControlList &metadata)