From patchwork Thu Nov 7 10:25:08 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Scally X-Patchwork-Id: 21832 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 590CDC32CE for ; Thu, 7 Nov 2024 10:25:36 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id E03436546F; Thu, 7 Nov 2024 11:25:32 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="W550fsYs"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id F298360363 for ; Thu, 7 Nov 2024 11:25:25 +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 22C1A9FF; Thu, 7 Nov 2024 11:25:17 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1730975117; bh=oIO8NS20PsRhy5yCC95Lbt4CQ1IGfsZ2f3/md1179YM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=W550fsYsApKM1rGib5mub+s6Dt35BLoDrdJXSrcugDtoAPWwCEx2oHV+f/PKXc82U Ie2oDcTs6k28S0YXDlPG/Ontvk6yx2U/w94LPISsWczKbSZ9K/PtsVLrCAYWzrl2mG Rw4ffKvExGvcBH1NmekqLEcBYy6yDmVsfYM1uyNI= From: Daniel Scally To: libcamera-devel@lists.libcamera.org Cc: mike.rudenko@gmail.com, Daniel Scally Subject: [PATCH v2 6/6] libcamera: pipelines: Draw control delays from CameraSensor properties Date: Thu, 7 Nov 2024 10:25:08 +0000 Message-Id: <20241107102508.48322-7-dan.scally@ideasonboard.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241107102508.48322-1-dan.scally@ideasonboard.com> References: <20241107102508.48322-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 --- Changes in v2: - Switched to use the new getSensorDelays() function src/libcamera/pipeline/ipu3/ipu3.cpp | 12 +++++------- src/libcamera/pipeline/rkisp1/rkisp1.cpp | 13 ++++++------- src/libcamera/pipeline/simple/simple.cpp | 8 ++++++-- 3 files changed, 17 insertions(+), 16 deletions(-) diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp index 29d3c6c1..50f887c6 100644 --- a/src/libcamera/pipeline/ipu3/ipu3.cpp +++ b/src/libcamera/pipeline/ipu3/ipu3.cpp @@ -1077,14 +1077,12 @@ 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'. - */ + uint8_t exposureDelay, gainDelay, vblankDelay, hblankDelay; + cio2->sensor()->getSensorDelays(exposureDelay, gainDelay, + vblankDelay, hblankDelay); 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..a73cb6f2 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,12 @@ 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. - */ + uint8_t exposureDelay, gainDelay, vblankDelay, hblankDelay; + data->sensor_->getSensorDelays(exposureDelay, gainDelay, vblankDelay, + hblankDelay); 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..81dd9379 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,12 @@ int SimplePipelineHandler::configure(Camera *camera, CameraConfiguration *c) if (outputCfgs.empty()) return 0; + uint8_t exposureDelay, gainDelay, vblankDelay, hblankDelay; + data->sensor_->getSensorDelays(exposureDelay, gainDelay, vblankDelay, + hblankDelay); 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(),