diff options
-rw-r--r-- | src/libcamera/pipeline/rkisp1/rkisp1_path.cpp | 30 | ||||
-rw-r--r-- | src/libcamera/pipeline/rkisp1/rkisp1_path.h | 2 |
2 files changed, 27 insertions, 5 deletions
diff --git a/src/libcamera/pipeline/rkisp1/rkisp1_path.cpp b/src/libcamera/pipeline/rkisp1/rkisp1_path.cpp index 1999094e..3ce059a2 100644 --- a/src/libcamera/pipeline/rkisp1/rkisp1_path.cpp +++ b/src/libcamera/pipeline/rkisp1/rkisp1_path.cpp @@ -474,6 +474,31 @@ int RkISP1Path::configure(const StreamConfiguration &config, return 0; } +/* + * NOTE: the 'buffers' will be empty after calling this function. + */ +int RkISP1Path::preQueueBuffers(std::deque<FrameBuffer *> &buffers) +{ + /* \todo Make buffer count user configurable. */ + int ret = video_->importBuffers(RKISP1_BUFFER_COUNT); + if (ret) + return ret; + + /* Pre-queue buffers in the video output. */ + while (!buffers.empty()) { + auto buf = buffers.front(); + buffers.pop_front(); + + ret = video_->queueBuffer(buf); + if (ret) { + LOG(RkISP1, Error) << "Failed to pre-queue capture buffers"; + return ret; + } + } + + return 0; +} + int RkISP1Path::start() { int ret; @@ -481,11 +506,6 @@ int RkISP1Path::start() if (running_) return -EBUSY; - /* \todo Make buffer count user configurable. */ - ret = video_->importBuffers(RKISP1_BUFFER_COUNT); - if (ret) - return ret; - ret = video_->streamOn(); if (ret) { LOG(RkISP1, Error) diff --git a/src/libcamera/pipeline/rkisp1/rkisp1_path.h b/src/libcamera/pipeline/rkisp1/rkisp1_path.h index ce9a5666..4ec7ce5c 100644 --- a/src/libcamera/pipeline/rkisp1/rkisp1_path.h +++ b/src/libcamera/pipeline/rkisp1/rkisp1_path.h @@ -7,6 +7,7 @@ #pragma once +#include <deque> #include <map> #include <memory> #include <set> @@ -57,6 +58,7 @@ public: return video_->exportBuffers(bufferCount, buffers); } + int preQueueBuffers(std::deque<FrameBuffer *> &buffers); int start(); void stop(); |