libcamera: pipeline_handler: Decouple buffer import and export

Use the V4L2 buffer orphaning feature, exposed through
V4L2VideoDevice::exportBuffers(), to decouple buffer import and export.
The PipelineHandler::importFrameBuffers() function is now called for all
streams regardless of whether exportFrameBuffers() has been called or
not. This simplifies the Camera implementation slightly, and opens the
door to additional simplifications.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
This commit is contained in:
Laurent Pinchart
2020-03-18 19:15:18 +02:00
parent 7d8604128a
commit 9da27d5d84
8 changed files with 10 additions and 54 deletions
+1 -20
View File
@@ -554,18 +554,6 @@ int Camera::exportFrameBuffers(Stream *stream,
buffers);
}
int Camera::freeFrameBuffers(Stream *stream)
{
int ret = p_->isAccessAllowed(Private::CameraConfigured, true);
if (ret < 0)
return ret;
p_->pipe_->invokeMethod(&PipelineHandler::freeFrameBuffers,
ConnectionTypeBlocking, this, stream);
return 0;
}
/**
* \brief Acquire the camera device for exclusive access
*
@@ -928,9 +916,6 @@ int Camera::start()
LOG(Camera, Debug) << "Starting capture";
for (Stream *stream : p_->activeStreams_) {
if (allocator_ && !allocator_->buffers(stream).empty())
continue;
ret = p_->pipe_->invokeMethod(&PipelineHandler::importFrameBuffers,
ConnectionTypeDirect, this, stream);
if (ret < 0)
@@ -974,13 +959,9 @@ int Camera::stop()
p_->pipe_->invokeMethod(&PipelineHandler::stop, ConnectionTypeBlocking,
this);
for (Stream *stream : p_->activeStreams_) {
if (allocator_ && !allocator_->buffers(stream).empty())
continue;
for (Stream *stream : p_->activeStreams_)
p_->pipe_->invokeMethod(&PipelineHandler::freeFrameBuffers,
ConnectionTypeBlocking, this, stream);
}
return 0;
}