summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJacopo Mondi <jacopo@jmondi.org>2020-09-24 15:54:16 +0200
committerJacopo Mondi <jacopo@jmondi.org>2020-09-29 17:53:53 +0200
commitbe9feda2ad0aab53f8c79abcc750bddf31240dcd (patch)
tree80d205c34c6401fa5b89129dc87aca18a90ea32c /src
parent4c2bfc317a062bb84d7221acda8b67ec70bd2ffd (diff)
libcamera: ipu3: Fix RAW+YUV capture
When requesting one RAW stream and one YUV stream the StreamConfiguration assigned to the RAW stream is the first one added to the CameraConfiguration, while the YUV stream gets assigned to the main output. At configure() time the viewfinder output needs to be configured with the same format as the main output, but since the introduction of RAW capture support, the pipeline has not been updated and still assumes the main output configuration is the first one in the CameraConfiguration. This causes the viewfinder to be configured with the same format as the raw stream, breaking capture operations. Before this commit the following command fails and the ImgU does not produce frames: cam -srole=stillraw -srole=viewfinder -c2 -C Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
Diffstat (limited to 'src')
-rw-r--r--src/libcamera/pipeline/ipu3/ipu3.cpp20
1 files changed, 9 insertions, 11 deletions
diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp
index 7bb05efa..f6e7ab46 100644
--- a/src/libcamera/pipeline/ipu3/ipu3.cpp
+++ b/src/libcamera/pipeline/ipu3/ipu3.cpp
@@ -481,25 +481,23 @@ int PipelineHandlerIPU3::configure(Camera *camera, CameraConfiguration *c)
return ret;
/* Apply the format to the configured streams output devices. */
- bool outActive = false;
- bool vfActive = false;
+ StreamConfiguration *mainCfg = nullptr;
+ StreamConfiguration *vfCfg = nullptr;
for (unsigned int i = 0; i < config->size(); ++i) {
StreamConfiguration &cfg = (*config)[i];
Stream *stream = cfg.stream();
if (stream == outStream) {
+ mainCfg = &cfg;
ret = imgu->configureOutput(cfg, &outputFormat);
if (ret)
return ret;
-
- outActive = true;
} else if (stream == vfStream) {
+ vfCfg = &cfg;
ret = imgu->configureViewfinder(cfg, &outputFormat);
if (ret)
return ret;
-
- vfActive = true;
}
}
@@ -508,14 +506,14 @@ int PipelineHandlerIPU3::configure(Camera *camera, CameraConfiguration *c)
* the configuration of the active one for that purpose (there should
* be at least one active stream in the configuration request).
*/
- if (!outActive) {
- ret = imgu->configureOutput(config->at(0), &outputFormat);
+ if (!mainCfg) {
+ ret = imgu->configureOutput(*vfCfg, &outputFormat);
if (ret)
return ret;
}
- if (!vfActive) {
- ret = imgu->configureViewfinder(config->at(0), &outputFormat);
+ if (!vfCfg) {
+ ret = imgu->configureViewfinder(*mainCfg, &outputFormat);
if (ret)
return ret;
}
@@ -534,7 +532,7 @@ int PipelineHandlerIPU3::configure(Camera *camera, CameraConfiguration *c)
/* Apply the "pipe_mode" control to the ImgU subdevice. */
ControlList ctrls(imgu->imgu_->controls());
ctrls.set(V4L2_CID_IPU3_PIPE_MODE,
- static_cast<int32_t>(vfActive ? IPU3PipeModeVideo :
+ static_cast<int32_t>(vfCfg ? IPU3PipeModeVideo :
IPU3PipeModeStillCapture));
ret = imgu->imgu_->setControls(&ctrls);
if (ret) {