[libcamera-devel,v3,0/9] Virtual pipeline handler
mbox series

Message ID 20230105043726.679968-1-chenghaoyang@google.com
Headers show
Series
  • Virtual pipeline handler
Related show

Message

Cheng-Hao Yang Jan. 5, 2023, 4:37 a.m. UTC
Hi all,

This is the third version of POC patches of the virtual/fake pipeline
handler. Thanks to Kieran's comments, I split the patches and added a
base class MediaDeviceBase. Still need to work on the buffer allocation,
virtual config file, and virtual video for testing.

Please take a look and let me know if the design makes sense.

BR,
Harvey

Harvey Yang (9):
  libcamera: pipeline: Introduce skeleton Virtual Pipeline
  libcamera: Add MediaDeviceBase
  libcamera: Use MediaDeviceBase in base classes
  libcamera: Add MediaDeviceVirtual
  libcamera: pipeline: virtual: Add MediaDeviceVirtual
  libcamera: pipeline: virtual: Create a Camera
  libcamera: pipeline: virtual: Generate and validate
    StreamConfigurations
  libcamera: pipeline: virtual: Queue requests
  libcamera: pipeline: virtual: Set camera properties & controls

 .../libcamera/internal/device_enumerator.h    |  12 +-
 .../internal/device_enumerator_sysfs.h        |   4 +-
 .../internal/device_enumerator_udev.h         |   8 +-
 include/libcamera/internal/media_device.h     |  35 +-
 .../libcamera/internal/media_device_base.h    |  68 ++++
 .../libcamera/internal/media_device_virtual.h |  21 ++
 include/libcamera/internal/meson.build        |   2 +
 include/libcamera/internal/pipeline_handler.h |  12 +-
 meson_options.txt                             |   2 +-
 src/libcamera/device_enumerator.cpp           |  30 +-
 src/libcamera/device_enumerator_sysfs.cpp     |   4 +-
 src/libcamera/device_enumerator_udev.cpp      |   4 +-
 src/libcamera/media_device.cpp                |  97 +-----
 src/libcamera/media_device_base.cpp           | 140 ++++++++
 src/libcamera/media_device_virtual.cpp        |  22 ++
 src/libcamera/meson.build                     |   2 +
 src/libcamera/pipeline/imx8-isi/imx8-isi.cpp  |   2 +-
 src/libcamera/pipeline/ipu3/ipu3.cpp          |   4 +-
 .../pipeline/raspberrypi/raspberrypi.cpp      |   4 +-
 src/libcamera/pipeline/rkisp1/rkisp1.cpp      |   2 +-
 src/libcamera/pipeline/simple/simple.cpp      |   4 +-
 src/libcamera/pipeline/uvcvideo/uvcvideo.cpp  |   2 +-
 src/libcamera/pipeline/vimc/vimc.cpp          |   2 +-
 src/libcamera/pipeline/virtual/meson.build    |   5 +
 src/libcamera/pipeline/virtual/virtual.cpp    | 301 ++++++++++++++++++
 src/libcamera/pipeline_handler.cpp            |  18 +-
 26 files changed, 629 insertions(+), 178 deletions(-)
 create mode 100644 include/libcamera/internal/media_device_base.h
 create mode 100644 include/libcamera/internal/media_device_virtual.h
 create mode 100644 src/libcamera/media_device_base.cpp
 create mode 100644 src/libcamera/media_device_virtual.cpp
 create mode 100644 src/libcamera/pipeline/virtual/meson.build
 create mode 100644 src/libcamera/pipeline/virtual/virtual.cpp

Comments

Kieran Bingham Jan. 5, 2023, 9:49 p.m. UTC | #1
Hi Harvey,

Quoting Harvey Yang via libcamera-devel (2023-01-05 04:37:17)
> Hi all,
> 
> This is the third version of POC patches of the virtual/fake pipeline
> handler. Thanks to Kieran's comments, I split the patches and added a
> base class MediaDeviceBase. Still need to work on the buffer allocation,
> virtual config file, and virtual video for testing.
> 
> Please take a look and let me know if the design makes sense.
> 
> BR,
> Harvey
> 
> Harvey Yang (9):
>   libcamera: pipeline: Introduce skeleton Virtual Pipeline
>   libcamera: Add MediaDeviceBase
>   libcamera: Use MediaDeviceBase in base classes
>   libcamera: Add MediaDeviceVirtual
>   libcamera: pipeline: virtual: Add MediaDeviceVirtual
>   libcamera: pipeline: virtual: Create a Camera
>   libcamera: pipeline: virtual: Generate and validate
>     StreamConfigurations
>   libcamera: pipeline: virtual: Queue requests
>   libcamera: pipeline: virtual: Set camera properties & controls

Aha, I see you took the patches from the vivid series quite literally.
Those are broken down into a distinct series to help guide the developer
creating a new pipeline handler from scratch.

I'd be interested to know how you found going through the development in
that way, but for posting of a virtual pipeline handler, I think
squashing patches 1, 5, 6, 7, 8 and 9 would be appropriate.

I'm much happier seeing this development start from a clean base, than
the IPU3 handler, so I no longer have comments regarding stripping out
of various IPU3 specific items.

I'm weary of the need to interact with MediaDeviceBase and
MediaDeviceVirtual though. Those are quite intrusive, however I
understand the desire to be able to instantiate the pipeline handler
without having a real underlying device.

What issues block this implementation without creating a new base class?

I'm aware of the issue in PipelineHandler::registerCamera() where the
base PipelineHandler expects to have a list of mediaDevices_.

Is this just for handling PipelineHandler::acquire()?


> 
>  .../libcamera/internal/device_enumerator.h    |  12 +-
>  .../internal/device_enumerator_sysfs.h        |   4 +-
>  .../internal/device_enumerator_udev.h         |   8 +-
>  include/libcamera/internal/media_device.h     |  35 +-
>  .../libcamera/internal/media_device_base.h    |  68 ++++
>  .../libcamera/internal/media_device_virtual.h |  21 ++
>  include/libcamera/internal/meson.build        |   2 +
>  include/libcamera/internal/pipeline_handler.h |  12 +-
>  meson_options.txt                             |   2 +-
>  src/libcamera/device_enumerator.cpp           |  30 +-
>  src/libcamera/device_enumerator_sysfs.cpp     |   4 +-
>  src/libcamera/device_enumerator_udev.cpp      |   4 +-
>  src/libcamera/media_device.cpp                |  97 +-----
>  src/libcamera/media_device_base.cpp           | 140 ++++++++
>  src/libcamera/media_device_virtual.cpp        |  22 ++
>  src/libcamera/meson.build                     |   2 +
>  src/libcamera/pipeline/imx8-isi/imx8-isi.cpp  |   2 +-
>  src/libcamera/pipeline/ipu3/ipu3.cpp          |   4 +-
>  .../pipeline/raspberrypi/raspberrypi.cpp      |   4 +-
>  src/libcamera/pipeline/rkisp1/rkisp1.cpp      |   2 +-
>  src/libcamera/pipeline/simple/simple.cpp      |   4 +-
>  src/libcamera/pipeline/uvcvideo/uvcvideo.cpp  |   2 +-
>  src/libcamera/pipeline/vimc/vimc.cpp          |   2 +-
>  src/libcamera/pipeline/virtual/meson.build    |   5 +
>  src/libcamera/pipeline/virtual/virtual.cpp    | 301 ++++++++++++++++++
>  src/libcamera/pipeline_handler.cpp            |  18 +-
>  26 files changed, 629 insertions(+), 178 deletions(-)
>  create mode 100644 include/libcamera/internal/media_device_base.h
>  create mode 100644 include/libcamera/internal/media_device_virtual.h
>  create mode 100644 src/libcamera/media_device_base.cpp
>  create mode 100644 src/libcamera/media_device_virtual.cpp
>  create mode 100644 src/libcamera/pipeline/virtual/meson.build
>  create mode 100644 src/libcamera/pipeline/virtual/virtual.cpp
> 
> -- 
> 2.39.0.314.g84b9a713c41-goog
>