summaryrefslogtreecommitdiff
path: root/src/libcamera/pipeline/vimc.cpp
diff options
context:
space:
mode:
authorJacopo Mondi <jacopo@jmondi.org>2019-03-26 17:25:15 +0100
committerJacopo Mondi <jacopo@jmondi.org>2019-04-17 15:42:24 +0200
commit911bc4aa41c16eeeaf78ddb4c0a4958bdd19fb96 (patch)
treee33d864d746122c0001e5375f34227942951c27b /src/libcamera/pipeline/vimc.cpp
parent4e1dc9004fca89223d54cf22bae09eff7c0c2d4b (diff)
libcamera: camera: Pass the stream set to allocate/freeBuffers()
Pipeline handlers might need to perform allocation of internal buffers, setup operations, or simple sanity check before going into the per-stream buffer allocation. As of now, PipelineHandler::allocateBuffers() is called once for each active stream, leaving no space for stream-independent configuration. Change this by providing to the pipeline handlers the full set of active streams, and ask them to loop over them to perform per-streams memory allocations and freeing. Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
Diffstat (limited to 'src/libcamera/pipeline/vimc.cpp')
-rw-r--r--src/libcamera/pipeline/vimc.cpp13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/libcamera/pipeline/vimc.cpp b/src/libcamera/pipeline/vimc.cpp
index c8bbe2a1..22449e47 100644
--- a/src/libcamera/pipeline/vimc.cpp
+++ b/src/libcamera/pipeline/vimc.cpp
@@ -32,8 +32,10 @@ public:
int configureStreams(Camera *camera,
const CameraConfiguration &config) override;
- int allocateBuffers(Camera *camera, Stream *stream) override;
- int freeBuffers(Camera *camera, Stream *stream) override;
+ int allocateBuffers(Camera *camera,
+ const std::set<Stream *> &streams) override;
+ int freeBuffers(Camera *camera,
+ const std::set<Stream *> &streams) override;
int start(Camera *camera) override;
void stop(Camera *camera) override;
@@ -127,9 +129,11 @@ int PipelineHandlerVimc::configureStreams(Camera *camera,
return 0;
}
-int PipelineHandlerVimc::allocateBuffers(Camera *camera, Stream *stream)
+int PipelineHandlerVimc::allocateBuffers(Camera *camera,
+ const std::set<Stream *> &streams)
{
VimcCameraData *data = cameraData(camera);
+ Stream *stream = *streams.begin();
const StreamConfiguration &cfg = stream->configuration();
LOG(VIMC, Debug) << "Requesting " << cfg.bufferCount << " buffers";
@@ -137,7 +141,8 @@ int PipelineHandlerVimc::allocateBuffers(Camera *camera, Stream *stream)
return data->video_->exportBuffers(&stream->bufferPool());
}
-int PipelineHandlerVimc::freeBuffers(Camera *camera, Stream *stream)
+int PipelineHandlerVimc::freeBuffers(Camera *camera,
+ const std::set<Stream *> &streams)
{
VimcCameraData *data = cameraData(camera);
return data->video_->releaseBuffers();