libcamera: ipu3: Always report crop region

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 <niklas.soderlund@ragnatech.se>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
This commit is contained in:
Jacopo Mondi 2021-02-03 16:38:43 +01:00
parent 9690d082ec
commit d77233be82

View file

@ -73,6 +73,7 @@ public:
Stream rawStream_;
uint32_t exposureTime_;
Rectangle cropRegion_;
std::unique_ptr<DelayedControls> 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;