From patchwork Wed Feb 3 16:25:58 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Jacopo Mondi X-Patchwork-Id: 11122 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 79C2ABD161 for ; Wed, 3 Feb 2021 16:25:48 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 1CBDB68463; Wed, 3 Feb 2021 17:25:48 +0100 (CET) Received: from relay12.mail.gandi.net (relay12.mail.gandi.net [217.70.178.232]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 8040768456 for ; Wed, 3 Feb 2021 17:25:45 +0100 (CET) Received: from uno.lan (93-34-118-233.ip49.fastwebnet.it [93.34.118.233]) (Authenticated sender: jacopo@jmondi.org) by relay12.mail.gandi.net (Postfix) with ESMTPSA id 30017200005 for ; Wed, 3 Feb 2021 16:25:45 +0000 (UTC) From: Jacopo Mondi To: libcamera-devel@lists.libcamera.org Date: Wed, 3 Feb 2021 17:25:58 +0100 Message-Id: <20210203162600.206297-6-jacopo@jmondi.org> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210203162600.206297-1-jacopo@jmondi.org> References: <20210203162600.206297-1-jacopo@jmondi.org> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 5/7] libcamera: ipu3: Always report crop region 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" Report the crop region for every completed request. The crop region is initialized as the sensor's analogue crop rectangle and updated when a Request with a new region completes. Signed-off-by: Jacopo Mondi Reviewed-by: Niklas Söderlund Reviewed-by: Laurent Pinchart --- src/libcamera/pipeline/ipu3/ipu3.cpp | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp index db0d6b91be70..a9c8e180d1c4 100644 --- a/src/libcamera/pipeline/ipu3/ipu3.cpp +++ b/src/libcamera/pipeline/ipu3/ipu3.cpp @@ -65,6 +65,7 @@ public: Stream rawStream_; uint32_t exposureTime_; + Rectangle cropRegion; }; class IPU3CameraConfiguration : public CameraConfiguration @@ -472,6 +473,10 @@ int PipelineHandlerIPU3::configure(Camera *camera, CameraConfiguration *c) if (ret) return ret; + CameraSensorInfo sensorInfo; + cio2->sensor()->sensorInfo(&sensorInfo); + data->cropRegion = sensorInfo.analogCrop; + /* * If the ImgU gets configured, its driver seems to expect that * buffers will be queued to its outputs, as otherwise the next @@ -967,10 +972,10 @@ void IPU3CameraData::imguOutputBufferReady(FrameBuffer *buffer) /* \todo Move the ExposureTime control to the IPA. */ request->metadata().set(controls::ExposureTime, exposureTime_); /* \todo Actually apply the scaler crop region to the ImgU. */ - if (request->controls().contains(controls::ScalerCrop)) { - Rectangle cropRegion = request->controls().get(controls::ScalerCrop); - request->metadata().set(controls::ScalerCrop, cropRegion); - } + if (request->controls().contains(controls::ScalerCrop)) + cropRegion = request->controls().get(controls::ScalerCrop); + request->metadata().set(controls::ScalerCrop, cropRegion); + pipe_->completeRequest(request); }