pipeline: rkisp1: Properly handle the bufferCount set in the stream configuration
The StreamConfiguration::bufferCount is reset to a hardcoded value of 4 in RkISP1Path::validate(). Keep the minimum value of 4 but do not reset it, if it was set to a larger value. This allows the user to set bufferCount to an arbitrary number of buffers which then can be allocated for example by the FrameBufferAllocator. If the bufferCount is set to a smaller value it gets reset to kRkISP1MinBufferCount again and the configuration is marked as adjusted. Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com> Tested-by: Sven Püschel <s.pueschel@pengutronix.de> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Umang Jain <uajain@igalia.com>
This commit is contained in:
@@ -165,6 +165,8 @@ namespace {
|
||||
*/
|
||||
static constexpr unsigned int kRkISP1MaxQueuedRequests = 4;
|
||||
|
||||
static constexpr unsigned int kRkISP1MinBufferCount = 4;
|
||||
|
||||
} /* namespace */
|
||||
|
||||
class PipelineHandlerRkISP1 : public PipelineHandler
|
||||
@@ -608,6 +610,12 @@ CameraConfiguration::Status RkISP1CameraConfiguration::validate()
|
||||
return false;
|
||||
}
|
||||
|
||||
if (tryCfg.bufferCount < kRkISP1MinBufferCount) {
|
||||
if (expectedStatus == Valid)
|
||||
return false;
|
||||
tryCfg.bufferCount = kRkISP1MinBufferCount;
|
||||
}
|
||||
|
||||
cfg = tryCfg;
|
||||
cfg.setStream(stream);
|
||||
return true;
|
||||
@@ -797,6 +805,7 @@ PipelineHandlerRkISP1::generateConfiguration(Camera *camera,
|
||||
return nullptr;
|
||||
|
||||
cfg.colorSpace = colorSpace;
|
||||
cfg.bufferCount = kRkISP1MinBufferCount;
|
||||
config->addConfiguration(cfg);
|
||||
}
|
||||
|
||||
@@ -1130,14 +1139,14 @@ int PipelineHandlerRkISP1::start(Camera *camera, [[maybe_unused]] const ControlL
|
||||
}
|
||||
|
||||
if (data->mainPath_->isEnabled()) {
|
||||
ret = mainPath_.start();
|
||||
ret = mainPath_.start(data->mainPathStream_.configuration().bufferCount);
|
||||
if (ret)
|
||||
return ret;
|
||||
actions += [&]() { mainPath_.stop(); };
|
||||
}
|
||||
|
||||
if (hasSelfPath_ && data->selfPath_->isEnabled()) {
|
||||
ret = selfPath_.start();
|
||||
ret = selfPath_.start(data->selfPathStream_.configuration().bufferCount);
|
||||
if (ret)
|
||||
return ret;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user