@@ -225,6 +225,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)
@@ -981,24 +991,19 @@ 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;
}
/* If the dewarper is being used, allocate internal buffers for ISP. */
if (useDewarper_) {
- ret = mainPath_.exportBuffers(maxCount, &mainPathBuffers_);
+ ret = mainPath_.exportBuffers(kRkISP1InternalBufferCount, &mainPathBuffers_);
if (ret < 0)
goto error;
@@ -487,8 +487,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;
@@ -88,6 +88,8 @@ private:
* which are guaranteed to be supported by the pipeline.
*/
std::map<const CameraSensor *, std::vector<Size>> sensorSizesMap_;
+
+ static constexpr unsigned int kRkISP1BufferSlotCount = 16;
};
class RkISP1MainPath : public RkISP1Path