From patchwork Thu Oct 31 16:07:41 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Scally X-Patchwork-Id: 21796 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 2B622C330D for ; Thu, 31 Oct 2024 16:08:29 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id C4E65653BB; Thu, 31 Oct 2024 17:08:26 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="PGIxKy40"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 26E626039B for ; Thu, 31 Oct 2024 17:08:14 +0100 (CET) Received: from mail.ideasonboard.com (cpc141996-chfd3-2-0-cust928.12-3.cable.virginm.net [86.13.91.161]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 0F84AF50; Thu, 31 Oct 2024 17:08:10 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1730390890; bh=LXXSy6kSZfGLfSaMmhAWEFpY8azs3ZYlwWXWhT2/uzY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PGIxKy40ailYddioYjYd+nCKLuIYYQJw4DKXJwp08N6HNhBvp/USDJt8dzqW9YpsI jPfIEBHaCN6uhNBuurrBnLJER8ZY4ZSb8aitnxPcjcPCPzWi2adVmm9C0KR2YglID9 IAZTcqwIs1H/4xJSA4hOd2NBvf2u96ucAyuD+l4o= From: Daniel Scally To: libcamera-devel@lists.libcamera.org Cc: mike.rudenko@gmail.com, Daniel Scally Subject: [PATCH 6/6] libcamera: pipelines: Draw control delays from CameraSensor properties Date: Thu, 31 Oct 2024 16:07:41 +0000 Message-Id: <20241031160741.253855-7-dan.scally@ideasonboard.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241031160741.253855-1-dan.scally@ideasonboard.com> References: <20241031160741.253855-1-dan.scally@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" Rather than hard coding default delays for control values in the pipeline handlers, pick up the ones defined in the CameraSensor properties. Signed-off-by: Daniel Scally --- I note that the simple pipeline handler had a Gain delay of 2 rather than the standard 1...I don't think the difference from the norm is correct but thought I would highlight it in case I'm mistaken. src/libcamera/pipeline/ipu3/ipu3.cpp | 11 ++++------- src/libcamera/pipeline/rkisp1/rkisp1.cpp | 12 +++++------- src/libcamera/pipeline/simple/simple.cpp | 7 +++++-- 3 files changed, 14 insertions(+), 16 deletions(-) diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp index 29d3c6c1..ff58ba28 100644 --- a/src/libcamera/pipeline/ipu3/ipu3.cpp +++ b/src/libcamera/pipeline/ipu3/ipu3.cpp @@ -1077,14 +1077,11 @@ int PipelineHandlerIPU3::registerCameras() if (ret) continue; - /* - * \todo Read delay values from the sensor itself or from a - * a sensor database. For now use generic values taken from - * the Raspberry Pi and listed as 'generic values'. - */ + unsigned int gainDelay = data->properties_.get(properties::GainDelay).value(); + unsigned int exposureDelay = data->properties_.get(properties::ExposureDelay).value(); std::unordered_map params = { - { V4L2_CID_ANALOGUE_GAIN, { 1, false } }, - { V4L2_CID_EXPOSURE, { 2, false } }, + { V4L2_CID_ANALOGUE_GAIN, { gainDelay, false } }, + { V4L2_CID_EXPOSURE, { exposureDelay, false } }, }; data->delayedCtrls_ = diff --git a/src/libcamera/pipeline/rkisp1/rkisp1.cpp b/src/libcamera/pipeline/rkisp1/rkisp1.cpp index c7b0b392..43e1315f 100644 --- a/src/libcamera/pipeline/rkisp1/rkisp1.cpp +++ b/src/libcamera/pipeline/rkisp1/rkisp1.cpp @@ -24,6 +24,7 @@ #include #include #include +#include #include #include #include @@ -1240,14 +1241,11 @@ int PipelineHandlerRkISP1::createCamera(MediaEntity *sensor) /* Initialize the camera properties. */ data->properties_ = data->sensor_->properties(); - /* - * \todo Read delay values from the sensor itself or from a - * a sensor database. For now use generic values taken from - * the Raspberry Pi and listed as generic values. - */ + unsigned int gainDelay = data->properties_.get(properties::GainDelay).value(); + unsigned int exposureDelay = data->properties_.get(properties::ExposureDelay).value(); std::unordered_map params = { - { V4L2_CID_ANALOGUE_GAIN, { 1, false } }, - { V4L2_CID_EXPOSURE, { 2, false } }, + { V4L2_CID_ANALOGUE_GAIN, { gainDelay, false } }, + { V4L2_CID_EXPOSURE, { exposureDelay, false } }, }; data->delayedCtrls_ = diff --git a/src/libcamera/pipeline/simple/simple.cpp b/src/libcamera/pipeline/simple/simple.cpp index 3ddce71d..20c97c37 100644 --- a/src/libcamera/pipeline/simple/simple.cpp +++ b/src/libcamera/pipeline/simple/simple.cpp @@ -26,6 +26,7 @@ #include #include +#include #include #include @@ -1286,9 +1287,11 @@ int SimplePipelineHandler::configure(Camera *camera, CameraConfiguration *c) if (outputCfgs.empty()) return 0; + unsigned int gainDelay = data->properties_.get(properties::GainDelay).value(); + unsigned int exposureDelay = data->properties_.get(properties::ExposureDelay).value(); std::unordered_map params = { - { V4L2_CID_ANALOGUE_GAIN, { 2, false } }, - { V4L2_CID_EXPOSURE, { 2, false } }, + { V4L2_CID_ANALOGUE_GAIN, { gainDelay, false } }, + { V4L2_CID_EXPOSURE, { exposureDelay, false } }, }; data->delayedCtrls_ = std::make_unique(data->sensor_->device(),