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>
This commit is contained in:
@@ -647,13 +647,11 @@ int Camera::allocateBuffers()
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
for (Stream *stream : activeStreams_) {
|
||||
int ret = pipe_->allocateBuffers(this, stream);
|
||||
if (ret) {
|
||||
LOG(Camera, Error) << "Failed to allocate buffers";
|
||||
freeBuffers();
|
||||
return ret;
|
||||
}
|
||||
int ret = pipe_->allocateBuffers(this, activeStreams_);
|
||||
if (ret) {
|
||||
LOG(Camera, Error) << "Failed to allocate buffers";
|
||||
freeBuffers();
|
||||
return ret;
|
||||
}
|
||||
|
||||
state_ = CameraPrepared;
|
||||
@@ -683,12 +681,11 @@ int Camera::freeBuffers()
|
||||
* by the V4L2 device that has allocated them.
|
||||
*/
|
||||
stream->bufferPool().destroyBuffers();
|
||||
pipe_->freeBuffers(this, stream);
|
||||
}
|
||||
|
||||
state_ = CameraConfigured;
|
||||
|
||||
return 0;
|
||||
return pipe_->freeBuffers(this, activeStreams_);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user