@@ -200,6 +200,16 @@ private:
Camera *activeCamera_;
const MediaPad *ispSink_;
+
+ /*
+ * This many internal buffers (or rather parameter and statistics buffer
+ * pairs) ensures that the pipeline runs smoothly, without frame drops.
+ * This number considers:
+ * - three buffers queued to the driver, which is also the minimum
+ * required to start streaming
+ * - one buffer being processed on the IPA
+ */
+ static constexpr unsigned int kRkISP1InternalBufferCount = 4;
};
RkISP1Frames::RkISP1Frames(PipelineHandler *pipe)
@@ -836,17 +846,12 @@ int PipelineHandlerRkISP1::allocateBuffers(Camera *camera)
unsigned int ipaBufferId = 1;
int ret;
- unsigned int maxCount = std::max({
- data->mainPathStream_.configuration().bufferCount,
- data->selfPathStream_.configuration().bufferCount,
- });
-
if (!isRaw_) {
- ret = param_->allocateBuffers(maxCount, ¶mBuffers_);
+ ret = param_->allocateBuffers(kRkISP1InternalBufferCount, ¶mBuffers_);
if (ret < 0)
goto error;
- ret = stat_->allocateBuffers(maxCount, &statBuffers_);
+ ret = stat_->allocateBuffers(kRkISP1InternalBufferCount, &statBuffers_);
if (ret < 0)
goto error;
}
@@ -370,8 +370,7 @@ int RkISP1Path::start()
if (running_)
return -EBUSY;
- /* \todo Make buffer count user configurable. */
- ret = video_->importBuffers(RKISP1_BUFFER_COUNT);
+ ret = video_->importBuffers(kRkISP1BufferSlotCount);
if (ret)
return ret;
@@ -76,6 +76,8 @@ private:
std::unique_ptr<V4L2Subdevice> resizer_;
std::unique_ptr<V4L2VideoDevice> video_;
MediaLink *link_;
+
+ static constexpr unsigned int kRkISP1BufferSlotCount = 16;
};
class RkISP1MainPath : public RkISP1Path