From patchwork Mon Feb 22 10:52:18 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacopo Mondi X-Patchwork-Id: 11357 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 655DCBD1F1 for ; Mon, 22 Feb 2021 10:52:01 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id E5CCE68A10; Mon, 22 Feb 2021 11:51:59 +0100 (CET) Received: from relay11.mail.gandi.net (relay11.mail.gandi.net [217.70.178.231]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 5DC89602F3 for ; Mon, 22 Feb 2021 11:51:58 +0100 (CET) Received: from uno.lan (93-34-118-233.ip49.fastwebnet.it [93.34.118.233]) (Authenticated sender: jacopo@jmondi.org) by relay11.mail.gandi.net (Postfix) with ESMTPSA id 2A8F6100017 for ; Mon, 22 Feb 2021 10:51:57 +0000 (UTC) From: Jacopo Mondi To: libcamera-devel@lists.libcamera.org Date: Mon, 22 Feb 2021 11:52:18 +0100 Message-Id: <20210222105222.393677-2-jacopo@jmondi.org> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210222105222.393677-1-jacopo@jmondi.org> References: <20210222105222.393677-1-jacopo@jmondi.org> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v3 1/5] libcamera: ipu3: Initialize controls using sensor resolution 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" The controls' limits initialized by the IPU3 pipeline handler depend on the sensor configuration. In order to compute controls using a known state apply to the sensor a configuration equal to its own resolution. Signed-off-by: Jacopo Mondi Reviewed-by: Laurent Pinchart --- src/libcamera/pipeline/ipu3/ipu3.cpp | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp index b8a655ce0b68..f867b5913b27 100644 --- a/src/libcamera/pipeline/ipu3/ipu3.cpp +++ b/src/libcamera/pipeline/ipu3/ipu3.cpp @@ -805,10 +805,21 @@ bool PipelineHandlerIPU3::match(DeviceEnumerator *enumerator) */ int PipelineHandlerIPU3::initControls(IPU3CameraData *data) { + /* + * \todo The here intialized controls depend on sensor configuration. + * + * Initialize the sensor using its resolution and compute the control + * limits. + */ CameraSensor *sensor = data->cio2_.sensor(); - CameraSensorInfo sensorInfo{}; + V4L2SubdeviceFormat sensorFormat = {}; + sensorFormat.size = sensor->resolution(); + int ret = sensor->setFormat(&sensorFormat); + if (ret) + return ret; - int ret = sensor->sensorInfo(&sensorInfo); + CameraSensorInfo sensorInfo{}; + ret = sensor->sensorInfo(&sensorInfo); if (ret) return ret; @@ -851,17 +862,6 @@ int PipelineHandlerIPU3::initControls(IPU3CameraData *data) * sensor's full frame as ImgU input). */ - /* Re-fetch the sensor info updated to use the largest resolution. */ - V4L2SubdeviceFormat sensorFormat = {}; - sensorFormat.size = sensor->resolution(); - ret = sensor->setFormat(&sensorFormat); - if (ret) - return ret; - - ret = sensor->sensorInfo(&sensorInfo); - if (ret) - return ret; - /* * The maximum scaler crop rectangle is the analogue crop used to * produce the maximum frame size.