From d77233be822b1abf6ae79e44307f08fc9d06ae41 Mon Sep 17 00:00:00 2001 From: Jacopo Mondi Date: Wed, 3 Feb 2021 16:38:43 +0100 Subject: libcamera: ipu3: Always report crop region MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. Reviewed-by: Niklas Söderlund Reviewed-by: Laurent Pinchart Signed-off-by: Jacopo Mondi --- src/libcamera/pipeline/ipu3/ipu3.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'src/libcamera/pipeline') diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp index c3763507..3a9d7a5e 100644 --- a/src/libcamera/pipeline/ipu3/ipu3.cpp +++ b/src/libcamera/pipeline/ipu3/ipu3.cpp @@ -73,6 +73,7 @@ public: Stream rawStream_; uint32_t exposureTime_; + Rectangle cropRegion_; std::unique_ptr delayedCtrls_; IPU3Frames frameInfos_; @@ -487,6 +488,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 @@ -1121,10 +1126,9 @@ 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_); if (buffer->metadata().status == FrameMetadata::FrameCancelled) info->metadataProcessed = true; -- cgit v1.2.1