libcamera: pipeline: rkisp1: Move start and stop of path to RkISP1Path

Move the start and stop of a path to RkISP1Path. This allows the
importing of buffers to be moved closer the path start/stop simplifying
the code. Also by adding a simple running tracker the error logic in
PipelineHandlerRkISP1 can be simplified as stop() can always be called.

This also removes all external users of RkISP1Path::video_ so it can be
made private.

Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
This commit is contained in:
Niklas Söderlund
2020-09-25 00:18:43 +02:00
parent c2dfdecd05
commit 038e2fd66c
3 changed files with 51 additions and 53 deletions
+41 -2
View File
@@ -20,9 +20,9 @@ LOG_DECLARE_CATEGORY(RkISP1)
RkISP1Path::RkISP1Path(const char *name, const Span<const PixelFormat> &formats,
const Size &minResolution, const Size &maxResolution)
: video_(nullptr), name_(name), formats_(formats),
: name_(name), running_(false), formats_(formats),
minResolution_(minResolution), maxResolution_(maxResolution),
resizer_(nullptr)
resizer_(nullptr), video_(nullptr)
{
}
@@ -149,6 +149,45 @@ int RkISP1Path::configure(const StreamConfiguration &config,
return 0;
}
int RkISP1Path::start()
{
int ret;
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)
<< "Failed to start " << name_ << " path";
video_->releaseBuffers();
return ret;
}
running_ = true;
return 0;
}
void RkISP1Path::stop()
{
if (!running_)
return;
if (video_->streamOff())
LOG(RkISP1, Warning) << "Failed to stop " << name_ << " path";
video_->releaseBuffers();
running_ = false;
}
namespace {
constexpr Size RKISP1_RSZ_MP_SRC_MIN{ 32, 16 };
constexpr Size RKISP1_RSZ_MP_SRC_MAX{ 4416, 3312 };