[0/2] Move PipelineHandlers to their own thread
mbox series

Message ID 20261130-camera-thread-v1-0-bca905afbeef@ideasonboard.com
Headers show
Series
  • Move PipelineHandlers to their own thread
Related show

Message

Daniel Scally Nov. 30, 2026, 8:29 a.m. UTC
Hello all

In recent work with a multi-camera system we noticed that starting a
camera on a system that already had one camera streaming caused
interruptions to that already-running stream. One reason for this is
that the ioctl()s that are a part of the stream-on path for the
newly-starting camera were quite long running, and they are run in
the same thread as the PipelineHandlers bufferReady / queueBuffer
loops - the CameraManager thread.

To ameliorate this issue this set moves PipelineHandlers into their
own thread. Most calls to functions exposed by the class are called
by the Camera class through invokeMethod(), though as both the Camera
and PipelineHandler lived in the same thread before this change I'm
not sure that was necessary - either way, it hasn't changed. The
CameraManager calls PipelineHandler::match(), which now happens with
invokeMethod() too.

The topic will likely need revisiting when we have multi-context
capable PipelineHandlers, as the same issue will naturally arise then
too, but for now this method should be sufficient.

Thanks
Dan

Signed-off-by: Daniel Scally <dan.scally@ideasonboard.com>
---
Daniel Scally (2):
      libcamera: camera_manager: Allow other threads to create cameras
      libcamera: pipeline_manager: Move PipelineHandlers to unique thread

 include/libcamera/internal/pipeline_handler.h |  2 ++
 src/libcamera/camera_manager.cpp              | 11 ++---------
 src/libcamera/pipeline_handler.cpp            |  8 ++++++++
 3 files changed, 12 insertions(+), 9 deletions(-)
---
base-commit: 7ae183f58d7c2ee8643f002560d3a616e2a77726
change-id: 20261001-camera-thread-f835cf64a08e

Best regards,