[libcamera-devel] [PATCH v2 07/14] libcamera: ipu3: Implement camera start/stop
Jacopo Mondi
jacopo at jmondi.org
Tue Mar 12 13:12:35 CET 2019
Start and stop video devices in the pipeline.
Signed-off-by: Jacopo Mondi <jacopo at jmondi.org>
---
src/libcamera/pipeline/ipu3/ipu3.cpp | 54 ++++++++++++++++++++++++----
1 file changed, 48 insertions(+), 6 deletions(-)
diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp
index 3502c39f5e31..363b24ceead2 100644
--- a/src/libcamera/pipeline/ipu3/ipu3.cpp
+++ b/src/libcamera/pipeline/ipu3/ipu3.cpp
@@ -338,12 +338,52 @@ int PipelineHandlerIPU3::freeBuffers(Camera *camera, Stream *stream)
int PipelineHandlerIPU3::start(Camera *camera)
{
IPU3CameraData *data = cameraData(camera);
- V4L2Device *cio2 = data->cio2.output;
int ret;
- ret = cio2->streamOn();
+ /*
+ * Enqueue all available buffers to the CIO2 unit to start frame
+ * capture. Start ImgU video devices and queue buffers to the output
+ * ones at queueRequest() time.
+ */
+ for (Buffer &buffer: data->cio2.pool.buffers()) {
+ ret = data->cio2.output->queueBuffer(&buffer);
+ if (ret)
+ return ret;
+ }
+
+ ret = data->cio2.output->streamOn();
if (ret) {
- LOG(IPU3, Info) << "Failed to start camera " << camera->name();
+ LOG(IPU3, Error) << "Failed to start CIO2";
+ stop(camera);
+ return ret;
+ }
+
+ /* Start the ImgU video devices. */
+ ret = data->imgu->output->streamOn();
+ if (ret) {
+ LOG(IPU3, Error) << "Failed to start ImgU output";
+ stop(camera);
+ return ret;
+ }
+
+ ret = data->imgu->viewfinder->streamOn();
+ if (ret) {
+ LOG(IPU3, Error) << "Failed to start ImgU viewfinder";
+ stop(camera);
+ return ret;
+ }
+
+ ret = data->imgu->stat->streamOn();
+ if (ret) {
+ LOG(IPU3, Error) << "Failed to start ImgU stat";
+ stop(camera);
+ return ret;
+ }
+
+ ret = data->imgu->input->streamOn();
+ if (ret) {
+ LOG(IPU3, Error) << "Failed to start ImgU input";
+ stop(camera);
return ret;
}
@@ -353,10 +393,12 @@ int PipelineHandlerIPU3::start(Camera *camera)
void PipelineHandlerIPU3::stop(Camera *camera)
{
IPU3CameraData *data = cameraData(camera);
- V4L2Device *cio2 = data->cio2.output;
- if (cio2->streamOff())
- LOG(IPU3, Info) << "Failed to stop camera " << camera->name();
+ data->cio2.output->streamOff();
+ data->imgu->output->streamOff();
+ data->imgu->viewfinder->streamOff();
+ data->imgu->stat->streamOff();
+ data->imgu->input->streamOff();
PipelineHandler::stop(camera);
}
--
2.20.1
More information about the libcamera-devel
mailing list