From patchwork Wed Mar 13 10:56:44 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Klug X-Patchwork-Id: 19699 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 6F867C32A3 for ; Wed, 13 Mar 2024 10:57:14 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 0248662C96; Wed, 13 Mar 2024 11:57:10 +0100 (CET) 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="CyNfWp8v"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 652FF62C90 for ; Wed, 13 Mar 2024 11:56:55 +0100 (CET) Received: from jasper.fritz.box (unknown [IPv6:2a00:6020:448c:6c00:9b07:31b5:38e1:e957]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id DCCEBA8F; Wed, 13 Mar 2024 11:56:32 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1710327393; bh=7OIkJ8llq2WQ664El73vGRKGKvUxgjQIquAjBIulhF4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CyNfWp8v0h+iqXP5I3NOu7Bm8xIsAxhwn0kzBAWXv2sbBaQxHbO2vyQNGtTiBdIUP 8k/KCWcAA5uFGkCB7nQG53iA6jQhoYYdKztAE0fkysXK0cYnsHkxOHxfKAN6expak4 +PozwzgAzwyiAAZ66+qFoOPLizNQe8LluSXRfRCg= From: Stefan Klug To: libcamera-devel@lists.libcamera.org Subject: [PATCH 11/12] pipeline: rkisp1: Fix per-frame-controls in manual mode Date: Wed, 13 Mar 2024 11:56:44 +0100 Message-Id: <20240313105645.120317-13-stefan.klug@ideasonboard.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20240313105645.120317-1-stefan.klug@ideasonboard.com> References: <20240313105645.120317-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 71db2ae7..8780abc9 100644 --- a/src/ipa/rkisp1/rkisp1.cpp +++ b/src/ipa/rkisp1/rkisp1.cpp @@ -321,6 +321,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) @@ -369,8 +375,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 586b46d6..3e061b52 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_->pushForFrame(frame, sensorControls); } void RkISP1CameraData::metadataReady(unsigned int frame, const ControlList &metadata)