diff options
author | Niklas Söderlund <niklas.soderlund@ragnatech.se> | 2020-11-04 03:12:29 +0100 |
---|---|---|
committer | Niklas Söderlund <niklas.soderlund@ragnatech.se> | 2021-02-05 01:20:32 +0100 |
commit | 60b5f3b8b9e60c956d6db0ab82ca5a3930e0e3f3 (patch) | |
tree | 7a5400be423720a25e8e75bfc75ff77bbe2fa526 | |
parent | 9cdad8461e61e815ddb7378e87cb047ab168d290 (diff) |
libcamera: ipu3: imgu: Allocate buffers for stats and param
Instead of preparing for buffer importing allocate buffers that can be
used by an IPA.
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/imgu.cpp | 14 | ||||
-rw-r--r-- | src/libcamera/pipeline/ipu3/imgu.h | 3 |
2 files changed, 8 insertions, 9 deletions
diff --git a/src/libcamera/pipeline/ipu3/imgu.cpp b/src/libcamera/pipeline/ipu3/imgu.cpp index c8610220..d5cf05b0 100644 --- a/src/libcamera/pipeline/ipu3/imgu.cpp +++ b/src/libcamera/pipeline/ipu3/imgu.cpp @@ -552,20 +552,13 @@ int ImgUDevice::allocateBuffers(unsigned int bufferCount) return ret; } - ret = param_->importBuffers(bufferCount); + ret = param_->allocateBuffers(bufferCount, ¶mBuffers_); if (ret < 0) { LOG(IPU3, Error) << "Failed to allocate ImgU param buffers"; goto error; } - /* - * The kernel fails to start if buffers are not either imported or - * allocated for the statistics video device. As statistics buffers are - * not yet used by the pipeline import buffers to save memory. - * - * \todo To be revised when we'll actually use the stat node. - */ - ret = stat_->importBuffers(bufferCount); + ret = stat_->allocateBuffers(bufferCount, &statBuffers_); if (ret < 0) { LOG(IPU3, Error) << "Failed to allocate ImgU stat buffers"; goto error; @@ -603,6 +596,9 @@ void ImgUDevice::freeBuffers() { int ret; + paramBuffers_.clear(); + statBuffers_.clear(); + ret = output_->releaseBuffers(); if (ret) LOG(IPU3, Error) << "Failed to release ImgU output buffers"; diff --git a/src/libcamera/pipeline/ipu3/imgu.h b/src/libcamera/pipeline/ipu3/imgu.h index 4a1896e2..9d491511 100644 --- a/src/libcamera/pipeline/ipu3/imgu.h +++ b/src/libcamera/pipeline/ipu3/imgu.h @@ -76,6 +76,9 @@ public: std::unique_ptr<V4L2VideoDevice> viewfinder_; std::unique_ptr<V4L2VideoDevice> stat_; + std::vector<std::unique_ptr<FrameBuffer>> paramBuffers_; + std::vector<std::unique_ptr<FrameBuffer>> statBuffers_; + private: static constexpr unsigned int PAD_INPUT = 0; static constexpr unsigned int PAD_PARAM = 1; |