[libcamera-devel,00/10] Hotplug support and object lifetime management
mbox series

Message ID 20190124101651.9993-1-laurent.pinchart@ideasonboard.com
Headers show
Series
  • Hotplug support and object lifetime management
Related show

Message

Laurent Pinchart Jan. 24, 2019, 10:16 a.m. UTC
Hello everybody,

This patch series implements hotplug support in libcamera, and handles
all the lifetime management-related fallouts.

The first two patches, 01/10 and 02/10, are simple cleanups. The real
fun begins with pPatch 03/10 that stores a reference to the pipeline
handler in the camera, turning PipelineHandler into shared pointers.
Patch 04/10 turns MediaDevice into shared pointers as well, due to the
need to support hot-unplug when references to the media device can still
exist. This results in all three core objects related to hotplug,
MediaDevice, PipelineHandler and Camera, being managed as shared
pointers.

The next four patches, 05/10 to 08/10, add disconnection support to
MediaDevice, Camera, CameraManager and PipelineHandler through signals
and slots. Patch 09/10 marks the media device used by the UVC pipeline
handler as hot-pluggable, and patch 10/10 implements unplug detection in
the udev enumerator for the last piece of the puzzle.

While I hope the architecture is fine, I'm sure there will be lots of
various issues that will be discussed, and I expect a few more versions
of this series before merging it in the master branch. If the
architecture is approved, I would however recommend already depending on
this series as it addresses lots of lifetime management problems.

Laurent Pinchart (7):
  libcamera: pipeline_handler: Store the camera manager pointer
  libcamera: pipeline_handler: Declare factory children classes as final
  libcamera: device_enumerator: Reference-count MediaDevice instances
  libcamera: media_device: Add disconnected signal
  libcamera: camera_manager: Add method to unregister a camera
  libcamera: pipeline: uvc: Mark the media device as hotpluggable
  libcamera: device_enumerator: Add hotplug support

Niklas Söderlund (3):
  libcamera: camera: Associate cameras with their pipeline handler
  libcamera: camera: Add disconnection notification
  libcamera: pipeline_handler: Add camera disconnection support

 include/libcamera/camera.h                   |  15 ++-
 include/libcamera/camera_manager.h           |   3 +-
 src/libcamera/camera.cpp                     |  47 +++++++-
 src/libcamera/camera_manager.cpp             |  38 ++++--
 src/libcamera/device_enumerator.cpp          | 106 ++++++++++++++---
 src/libcamera/include/device_enumerator.h    |  10 +-
 src/libcamera/include/media_device.h         |   4 +
 src/libcamera/include/pipeline_handler.h     |  33 ++++--
 src/libcamera/media_device.cpp               |  10 ++
 src/libcamera/pipeline/ipu3/ipu3.cpp         |  32 +++--
 src/libcamera/pipeline/uvcvideo.cpp          |  20 ++--
 src/libcamera/pipeline/vimc.cpp              |  26 ++---
 src/libcamera/pipeline_handler.cpp           | 117 ++++++++++++++++++-
 test/media_device/media_device_link_test.cpp |   2 +-
 test/pipeline/ipu3/ipu3_pipeline_test.cpp    |   2 +-
 15 files changed, 372 insertions(+), 93 deletions(-)