summaryrefslogtreecommitdiff
path: root/src/libcamera/pipeline/rkisp1
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>2020-03-14 16:14:27 +0200
committerLaurent Pinchart <laurent.pinchart@ideasonboard.com>2020-03-18 19:15:18 +0200
commit33fedea818e2b6a9ed68ac86acf194b1a2da8828 (patch)
treeb350f4bc1710775cfe82af3bd7b1f36ce9ee5d2a /src/libcamera/pipeline/rkisp1
parent9da27d5d844fa1378a4897a637c45ade275cc7e5 (diff)
libcamera: pipeline_handler: Fold buffer management with start/stop
There's no need anymore to have the Camera object control how and when pipeline handlers allocate and free the buffers for the application-facing video devices. Fold those operations, currently performed by importFrameBuffers() and freeFrameBuffers(), into the start() and stop() functions. This simplifies the pipeline handler API, its implementation, and the implementation of the Camera class. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Diffstat (limited to 'src/libcamera/pipeline/rkisp1')
-rw-r--r--src/libcamera/pipeline/rkisp1/rkisp1.cpp20
1 files changed, 7 insertions, 13 deletions
diff --git a/src/libcamera/pipeline/rkisp1/rkisp1.cpp b/src/libcamera/pipeline/rkisp1/rkisp1.cpp
index eafb6d91..737e3314 100644
--- a/src/libcamera/pipeline/rkisp1/rkisp1.cpp
+++ b/src/libcamera/pipeline/rkisp1/rkisp1.cpp
@@ -174,8 +174,6 @@ public:
int exportFrameBuffers(Camera *camera, Stream *stream,
std::vector<std::unique_ptr<FrameBuffer>> *buffers) override;
- int importFrameBuffers(Camera *camera, Stream *stream) override;
- void freeFrameBuffers(Camera *camera, Stream *stream) override;
int start(Camera *camera) override;
void stop(Camera *camera) override;
@@ -667,17 +665,6 @@ int PipelineHandlerRkISP1::exportFrameBuffers(Camera *camera, Stream *stream,
return video_->exportBuffers(count, buffers);
}
-int PipelineHandlerRkISP1::importFrameBuffers(Camera *camera, Stream *stream)
-{
- unsigned int count = stream->configuration().bufferCount;
- return video_->importBuffers(count);
-}
-
-void PipelineHandlerRkISP1::freeFrameBuffers(Camera *camera, Stream *stream)
-{
- video_->releaseBuffers();
-}
-
int PipelineHandlerRkISP1::allocateBuffers(Camera *camera)
{
RkISP1CameraData *data = cameraData(camera);
@@ -688,6 +675,10 @@ int PipelineHandlerRkISP1::allocateBuffers(Camera *camera)
for (const Stream *s : camera->streams())
maxBuffers = std::max(maxBuffers, s->configuration().bufferCount);
+ ret = video_->importBuffers(count);
+ if (ret < 0)
+ goto error;
+
ret = param_->allocateBuffers(maxBuffers, &paramBuffers_);
if (ret < 0)
goto error;
@@ -748,6 +739,9 @@ int PipelineHandlerRkISP1::freeBuffers(Camera *camera)
if (stat_->releaseBuffers())
LOG(RkISP1, Error) << "Failed to release stat buffers";
+ if (video_->releaseBuffers())
+ LOG(RkISP1, Error) << "Failed to release video buffers";
+
return 0;
}