summaryrefslogtreecommitdiff
path: root/src/libcamera/pipeline/rkisp1/rkisp1.cpp
diff options
context:
space:
mode:
authorNiklas Söderlund <niklas.soderlund@ragnatech.se>2020-09-25 00:18:43 +0200
committerNiklas Söderlund <niklas.soderlund@ragnatech.se>2020-09-30 14:24:42 +0200
commit038e2fd66cd07354e2527e7e9aecd8a849f08799 (patch)
treee9d135aaeada84f88dc102656e0f5f830dda7b2d /src/libcamera/pipeline/rkisp1/rkisp1.cpp
parentc2dfdecd056247808a7cb3175df0086cac78ccb2 (diff)
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>
Diffstat (limited to 'src/libcamera/pipeline/rkisp1/rkisp1.cpp')
-rw-r--r--src/libcamera/pipeline/rkisp1/rkisp1.cpp53
1 files changed, 5 insertions, 48 deletions
diff --git a/src/libcamera/pipeline/rkisp1/rkisp1.cpp b/src/libcamera/pipeline/rkisp1/rkisp1.cpp
index 71d10005..1eeff4ac 100644
--- a/src/libcamera/pipeline/rkisp1/rkisp1.cpp
+++ b/src/libcamera/pipeline/rkisp1/rkisp1.cpp
@@ -770,20 +770,6 @@ int PipelineHandlerRkISP1::allocateBuffers(Camera *camera)
data->selfPathStream_.configuration().bufferCount,
});
- if (data->mainPathActive_) {
- ret = mainPath_.video_->importBuffers(
- data->mainPathStream_.configuration().bufferCount);
- if (ret < 0)
- goto error;
- }
-
- if (data->selfPathActive_) {
- ret = selfPath_.video_->importBuffers(
- data->selfPathStream_.configuration().bufferCount);
- if (ret < 0)
- goto error;
- }
-
ret = param_->allocateBuffers(maxCount, &paramBuffers_);
if (ret < 0)
goto error;
@@ -813,8 +799,6 @@ int PipelineHandlerRkISP1::allocateBuffers(Camera *camera)
error:
paramBuffers_.clear();
statBuffers_.clear();
- mainPath_.video_->releaseBuffers();
- selfPath_.video_->releaseBuffers();
return ret;
}
@@ -845,12 +829,6 @@ int PipelineHandlerRkISP1::freeBuffers(Camera *camera)
if (stat_->releaseBuffers())
LOG(RkISP1, Error) << "Failed to release stat buffers";
- if (mainPath_.video_->releaseBuffers())
- LOG(RkISP1, Error) << "Failed to release main path buffers";
-
- if (selfPath_.video_->releaseBuffers())
- LOG(RkISP1, Error) << "Failed to release self path buffers";
-
return 0;
}
@@ -896,15 +874,12 @@ int PipelineHandlerRkISP1::start(Camera *camera)
std::map<unsigned int, IPAStream> streamConfig;
if (data->mainPathActive_) {
- ret = mainPath_.video_->streamOn();
+ ret = mainPath_.start();
if (ret) {
param_->streamOff();
stat_->streamOff();
data->ipa_->stop();
freeBuffers(camera);
-
- LOG(RkISP1, Error)
- << "Failed to start main path " << camera->id();
return ret;
}
@@ -915,18 +890,13 @@ int PipelineHandlerRkISP1::start(Camera *camera)
}
if (data->selfPathActive_) {
- ret = selfPath_.video_->streamOn();
+ ret = selfPath_.start();
if (ret) {
- if (data->mainPathActive_)
- mainPath_.video_->streamOff();
-
+ mainPath_.stop();
param_->streamOff();
stat_->streamOff();
data->ipa_->stop();
freeBuffers(camera);
-
- LOG(RkISP1, Error)
- << "Failed to start self path " << camera->id();
return ret;
}
@@ -963,21 +933,8 @@ void PipelineHandlerRkISP1::stop(Camera *camera)
RkISP1CameraData *data = cameraData(camera);
int ret;
- if (data->selfPathActive_) {
- ret = selfPath_.video_->streamOff();
- if (ret)
- LOG(RkISP1, Warning)
- << "Failed to stop self path for "
- << camera->id();
- }
-
- if (data->mainPathActive_) {
- ret = mainPath_.video_->streamOff();
- if (ret)
- LOG(RkISP1, Warning)
- << "Failed to stop main path for "
- << camera->id();
- }
+ selfPath_.stop();
+ mainPath_.stop();
ret = stat_->streamOff();
if (ret)