libcamera: pipeline: Add FrameBuffer handlers
Extend the pipeline handlers to support the FrameBuffer API with three new methods to handle allocation, importing and freeing of buffers. The new methods will replace allocateBuffers() and freeBuffers(). The FrameBuffer API will use the methods on a stream level and either allocate or import buffers for each active stream controlled from the Camera class and an upcoming FrameBufferAllocator helper. With this new API the implementation in pipeline handlers can be made simpler as all streams don't need to be handled in allocateBuffers(). Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
This commit is contained in:
@@ -82,6 +82,11 @@ public:
|
||||
const StreamRoles &roles) override;
|
||||
int configure(Camera *camera, CameraConfiguration *config) override;
|
||||
|
||||
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 allocateBuffers(Camera *camera,
|
||||
const std::set<Stream *> &streams) override;
|
||||
int freeBuffers(Camera *camera,
|
||||
@@ -259,6 +264,30 @@ int PipelineHandlerVimc::configure(Camera *camera, CameraConfiguration *config)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int PipelineHandlerVimc::exportFrameBuffers(Camera *camera, Stream *stream,
|
||||
std::vector<std::unique_ptr<FrameBuffer>> *buffers)
|
||||
{
|
||||
VimcCameraData *data = cameraData(camera);
|
||||
unsigned int count = stream->configuration().bufferCount;
|
||||
|
||||
return data->video_->exportBuffers(count, buffers);
|
||||
}
|
||||
|
||||
int PipelineHandlerVimc::importFrameBuffers(Camera *camera, Stream *stream)
|
||||
{
|
||||
VimcCameraData *data = cameraData(camera);
|
||||
unsigned int count = stream->configuration().bufferCount;
|
||||
|
||||
return data->video_->importBuffers(count);
|
||||
}
|
||||
|
||||
void PipelineHandlerVimc::freeFrameBuffers(Camera *camera, Stream *stream)
|
||||
{
|
||||
VimcCameraData *data = cameraData(camera);
|
||||
|
||||
data->video_->releaseBuffers();
|
||||
}
|
||||
|
||||
int PipelineHandlerVimc::allocateBuffers(Camera *camera,
|
||||
const std::set<Stream *> &streams)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user