libcamera: pipeline: rkisp1: Don't rely on bufferCount

Currently the rkisp1 pipeline handler relies on bufferCount to decide on
the number of parameter and statistics buffers to allocate internally.
Instead, the number of internal buffers should be the minimum required
by the pipeline to keep the requests flowing, in order to avoid wasting
memory.

Stop relying on bufferCount for these numbers and instead set them to
kRkISP1MinBufferCount.

Signed-off-by: Nícolas F. R. A. Prado <nfraprado@collabora.com>
Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
Signed-off-by: Sven Püschel <s.pueschel@pengutronix.de>
Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Umang Jain <uajain@igalia.com>
This commit is contained in:
Nícolas F. R. A. Prado
2025-07-17 14:59:25 +02:00
committed by Stefan Klug
parent 521177161a
commit 5fb28bfe74

View File

@@ -165,6 +165,10 @@ namespace {
*/
static constexpr unsigned int kRkISP1MaxQueuedRequests = 4;
/*
* This many internal buffers (or rather parameter and statistics buffer
* pairs) ensures that the pipeline runs smoothly, without frame drops.
*/
static constexpr unsigned int kRkISP1MinBufferCount = 4;
} /* namespace */
@@ -1005,24 +1009,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, &paramBuffers_);
ret = param_->allocateBuffers(kRkISP1MinBufferCount, &paramBuffers_);
if (ret < 0)
goto error;
ret = stat_->allocateBuffers(maxCount, &statBuffers_);
ret = stat_->allocateBuffers(kRkISP1MinBufferCount, &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(kRkISP1MinBufferCount, &mainPathBuffers_);
if (ret < 0)
goto error;