summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNiklas Söderlund <niklas.soderlund@ragnatech.se>2020-12-29 00:23:56 +0100
committerNiklas Söderlund <niklas.soderlund@ragnatech.se>2021-02-05 01:20:32 +0100
commit82549ae253302bf612978282ea3858821465e8ed (patch)
treed85dcc93242ca5c11398b66ad8615dbd26ba1a3c
parent60b5f3b8b9e60c956d6db0ab82ca5a3930e0e3f3 (diff)
libcamera: ipu3: Map buffers in IPA
Map and unmap the parameters and statistic buffers in the IPA when the pipeline handler allocates and frees the buffers. Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
-rw-r--r--src/libcamera/pipeline/ipu3/ipu3.cpp30
1 files changed, 30 insertions, 0 deletions
diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp
index 13af8600..092db638 100644
--- a/src/libcamera/pipeline/ipu3/ipu3.cpp
+++ b/src/libcamera/pipeline/ipu3/ipu3.cpp
@@ -141,6 +141,8 @@ private:
ImgUDevice imgu1_;
MediaDevice *cio2MediaDev_;
MediaDevice *imguMediaDev_;
+
+ std::vector<IPABuffer> ipaBuffers_;
};
IPU3CameraConfiguration::IPU3CameraConfiguration(IPU3CameraData *data)
@@ -586,6 +588,27 @@ int PipelineHandlerIPU3::allocateBuffers(Camera *camera)
if (ret < 0)
return ret;
+ /* Map buffers to the IPA. */
+ unsigned int ipaBufferId = 1;
+
+ for (const std::unique_ptr<FrameBuffer> &buffer : imgu->paramBuffers_) {
+ buffer->setCookie(ipaBufferId++);
+ ipaBuffers_.push_back({
+ .id = buffer->cookie(),
+ .planes = buffer->planes()
+ });
+ }
+
+ for (const std::unique_ptr<FrameBuffer> &buffer : imgu->statBuffers_) {
+ buffer->setCookie(ipaBufferId++);
+ ipaBuffers_.push_back({
+ .id = buffer->cookie(),
+ .planes = buffer->planes()
+ });
+ }
+
+ data->ipa_->mapBuffers(ipaBuffers_);
+
return 0;
}
@@ -593,6 +616,13 @@ int PipelineHandlerIPU3::freeBuffers(Camera *camera)
{
IPU3CameraData *data = cameraData(camera);
+ std::vector<unsigned int> ids;
+ for (IPABuffer &ipabuf : ipaBuffers_)
+ ids.push_back(ipabuf.id);
+
+ data->ipa_->unmapBuffers(ids);
+ ipaBuffers_.clear();
+
data->imgu_->freeBuffers();
return 0;