From 9da27d5d844fa1378a4897a637c45ade275cc7e5 Mon Sep 17 00:00:00 2001 From: Laurent Pinchart Date: Sat, 14 Mar 2020 16:14:27 +0200 Subject: libcamera: pipeline_handler: Decouple buffer import and export MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Reviewed-by: Niklas Söderlund --- src/libcamera/camera.cpp | 21 +-------------------- 1 file changed, 1 insertion(+), 20 deletions(-) (limited to 'src/libcamera/camera.cpp') diff --git a/src/libcamera/camera.cpp b/src/libcamera/camera.cpp index 9c432adb..3192dfb4 100644 --- a/src/libcamera/camera.cpp +++ b/src/libcamera/camera.cpp @@ -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; } -- cgit v1.2.1