summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJacopo Mondi <jacopo@jmondi.org>2020-07-08 14:26:52 +0200
committerJacopo Mondi <jacopo@jmondi.org>2020-08-03 11:16:17 +0200
commit4ecbd0ea5a036eaab168c23e85fc697a7a6f2d85 (patch)
tree820312993db79fa4eae3f1cec5f096e8c9af1ed5
parent968ab9bad0ed392b4c9917bcc5cb5dbf268e1918 (diff)
libcamera: ipu3: Validate the pipe configuration
Collect the desired ImgU pipe configuration while assigning streams in the pipeline handler validate() function and ask the ImgUDevice class to calculate the pipe configuration parameters. If the requested pipe configuration results in a non-valid configuration, return an error from the validate() function. 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>
-rw-r--r--src/libcamera/pipeline/ipu3/ipu3.cpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp
index c20ab3ab..a0df81a0 100644
--- a/src/libcamera/pipeline/ipu3/ipu3.cpp
+++ b/src/libcamera/pipeline/ipu3/ipu3.cpp
@@ -77,6 +77,7 @@ private:
const IPU3CameraData *data_;
StreamConfiguration cio2Configuration_;
+ ImgUDevice::PipeConfig pipeConfig_;
};
class PipelineHandlerIPU3 : public PipelineHandler
@@ -189,6 +190,9 @@ CameraConfiguration::Status IPU3CameraConfiguration::validate()
LOG(IPU3, Debug) << "CIO2 configuration: " << cio2Configuration_.toString();
+ ImgUDevice::Pipe pipe{};
+ pipe.input = cio2Configuration_.size;
+
/*
* Adjust the configurations if needed and assign streams while
* iterating them.
@@ -263,10 +267,15 @@ CameraConfiguration::Status IPU3CameraConfiguration::validate()
cfg->setStream(const_cast<Stream *>(&data_->outStream_));
mainOutputAvailable = false;
+ pipe.main = cfg->size;
+ if (yuvCount == 1)
+ pipe.viewfinder = pipe.main;
+
LOG(IPU3, Debug) << "Assigned " << cfg->toString()
<< " to the main output";
} else {
cfg->setStream(const_cast<Stream *>(&data_->vfStream_));
+ pipe.viewfinder = cfg->size;
LOG(IPU3, Debug) << "Assigned " << cfg->toString()
<< " to the viewfinder output";
@@ -282,6 +291,16 @@ CameraConfiguration::Status IPU3CameraConfiguration::validate()
}
}
+ /* Only compute the ImgU configuration if a YUV stream has been requested. */
+ if (yuvCount) {
+ pipeConfig_ = data_->imgu_->calculatePipeConfig(&pipe);
+ if (pipeConfig_.isNull()) {
+ LOG(IPU3, Error) << "Failed to calculate pipe configuration: "
+ << "unsupported resolutions.";
+ return Invalid;
+ }
+ }
+
return status;
}