summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Plowman <david.plowman@raspberrypi.com>2020-12-08 20:51:17 +0000
committerLaurent Pinchart <laurent.pinchart@ideasonboard.com>2020-12-11 23:31:10 +0200
commita93775cab61961ac5f79f5a7a3408fde67a89da1 (patch)
tree74cffe88ad1c2f50f4773e0f0553145372216701
parent26d90af082d1d810a75ba73472cce2950fc94284 (diff)
libcamera: pipeline: raspberrypi: Allow ScalerCrop to work when passed in Camera::start
The ScalerCrop control is handled by the pipeline handler, not the IPA, so must be handled explicitly in the Camera::start method. The ScalerCrop code used when processing requests has been factored out to make it easy to reuse. Signed-off-by: David Plowman <david.plowman@raspberrypi.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
-rw-r--r--src/libcamera/pipeline/raspberrypi/raspberrypi.cpp45
1 files changed, 28 insertions, 17 deletions
diff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp
index 2ec1f6e7..593fd7ac 100644
--- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp
+++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp
@@ -156,6 +156,7 @@ public:
void handleStreamBuffer(FrameBuffer *buffer, RPi::Stream *stream);
void handleExternalBuffer(FrameBuffer *buffer, RPi::Stream *stream);
void handleState();
+ void applyScalerCrop(const ControlList &controls);
CameraSensor *sensor_;
/* Array of Unicam and ISP device streams and associated buffers/streams. */
@@ -751,6 +752,10 @@ int PipelineHandlerRPi::start(Camera *camera, [[maybe_unused]] ControlList *cont
return ret;
}
+ /* Check if a ScalerCrop control was specified. */
+ if (controls)
+ data->applyScalerCrop(*controls);
+
/* Start the IPA. */
IPAOperationData ipaData = {};
IPAOperationData result = {};
@@ -1610,24 +1615,10 @@ void RPiCameraData::checkRequestCompleted()
}
}
-void RPiCameraData::tryRunPipeline()
+void RPiCameraData::applyScalerCrop(const ControlList &controls)
{
- FrameBuffer *bayerBuffer, *embeddedBuffer;
- IPAOperationData op;
-
- /* If any of our request or buffer queues are empty, we cannot proceed. */
- if (state_ != State::Idle || requestQueue_.empty() ||
- bayerQueue_.empty() || embeddedQueue_.empty())
- return;
-
- if (!findMatchingBuffers(bayerBuffer, embeddedBuffer))
- return;
-
- /* Take the first request from the queue and action the IPA. */
- Request *request = requestQueue_.front();
-
- if (request->controls().contains(controls::ScalerCrop)) {
- Rectangle nativeCrop = request->controls().get<Rectangle>(controls::ScalerCrop);
+ if (controls.contains(controls::ScalerCrop)) {
+ Rectangle nativeCrop = controls.get<Rectangle>(controls::ScalerCrop);
if (!nativeCrop.width || !nativeCrop.height)
nativeCrop = { 0, 0, 1, 1 };
@@ -1654,6 +1645,26 @@ void RPiCameraData::tryRunPipeline()
updateScalerCrop_ = true;
}
}
+}
+
+void RPiCameraData::tryRunPipeline()
+{
+ FrameBuffer *bayerBuffer, *embeddedBuffer;
+ IPAOperationData op;
+
+ /* If any of our request or buffer queues are empty, we cannot proceed. */
+ if (state_ != State::Idle || requestQueue_.empty() ||
+ bayerQueue_.empty() || embeddedQueue_.empty())
+ return;
+
+ if (!findMatchingBuffers(bayerBuffer, embeddedBuffer))
+ return;
+
+ /* Take the first request from the queue and action the IPA. */
+ Request *request = requestQueue_.front();
+
+ /* See if a new ScalerCrop value needs to be applied. */
+ applyScalerCrop(request->controls());
/*
* Process all the user controls by the IPA. Once this is complete, we