[PATCH v14 0/7] Add VirtualPipelineHandler

Kieran Bingham kieran.bingham at ideasonboard.com
Thu Oct 3 12:37:44 CEST 2024


Quoting Cheng-Hao Yang (2024-10-03 11:06:58)
> Hi Kieran,
> 
> On Thu, Oct 3, 2024 at 5:48 PM Kieran Bingham
> <kieran.bingham at ideasonboard.com> wrote:
> >
> > Quoting Harvey Yang (2024-09-30 07:29:41)
> > > Hi all,
> > >
> > > This series adds virtual pipeline handler, which doesn't depend on any
> > > hardware, like camera sensor or ISP. Currently the configuration
> > > supports test patterns and images.
> > >
> > > It passed the gitlab pipeline:
> > > https://gitlab.freedesktop.org/chenghaoyang/libcamera/-/pipelines/1280687
> > >
> > > I've also checked that it works on qcam.
> > >
> > > I failed to pass multi_stream_test when trying to enable multiple
> > > streams though. Please give me some hints what it tests and what I
> > > missed:
> > > ```
> > > [295:43:43.910237144] [1441841]  INFO IPAManager ipa_manager.cpp:137 libcamera is not installed. Adding '/usr/local/google/home/chenghaoyang/Workspace/libca
> > > mera/build/src/ipa' to the IPA search path
> > > [295:43:43.914030564] [1441841]  INFO Camera camera_manager.cpp:325 libcamera v0.3.1+79-8ca4f033-dirty (2024-08-29T19:18:51UTC)
> > > [295:43:43.915493754] [1441844] ERROR DmaBufAllocator dma_buf_allocator.cpp:120 Could not open any dma-buf provider
> > > [295:43:43.919118835] [1441841]  INFO IPAManager ipa_manager.cpp:137 libcamera is not installed. Adding '/usr/local/google/home/chenghaoyang/Workspace/libca
> > > mera/build/src/ipa' to the IPA search path
> > > [295:43:43.922245825] [1441841]  INFO Camera camera_manager.cpp:325 libcamera v0.3.1+79-8ca4f033-dirty (2024-08-29T19:18:51UTC)
> > > [295:43:43.922820175] [1441846] ERROR DmaBufAllocator dma_buf_allocator.cpp:120 Could not open any dma-buf provider
> > > Unable to set the pipeline to the playing state.
> >
> > Is this the error you get when you enable multiple streams in the
> > virtual pipeline handler?
> 
> Correct :)
> 
> >
> > I still think that looks like an issue in the configuration of the VM
> > not having udmabuf which you use.
> 
> Hmm, as I shared before, the pipeline unit test still fails when I
> support a workaround memfd_create:
> https://gitlab.freedesktop.org/chenghaoyang/libcamera/-/pipelines/1279655
> , which contains:
> https://gitlab.freedesktop.org/chenghaoyang/libcamera/-/commit/9f032290fc97dae1fbace2314420a73251169cee

Your patch tries to use Memfd instead. Did you check if the CI kernel
has support for MEMFD? Is that a configuration option in the kernel ?

Isn't udmabuf constructed from a memfd ultimately ?

If you export a memfd file descriptor - will that break elsewhere
because it's not a DMABuf handle? (That's the whole point of udmabuf
right ?)

I think changing to memfd to test if that's the cause of the udmabuf
issue is just changing one set of issues for another.



> 
> At least it works on my gLinux environment.
> Doesn't that imply that it's not because of DmaBufAllocator?

No ? Maybe your gLinux environment has the appropriate / required
features enabled!


> Also, single_stream_test passed. I assume it also tests on the
> buffers if multi_stream_test does?

I'm not sure I understand this question...

--
Kieran


> 
> BR,
> Harvey
> 
> >
> >
> > To fix this, you would probably need to fork the CI scripts:
> >
> >  - https://gitlab.freedesktop.org/camera/libcamera-ci
> >
> > And direct your local
> > https://gitlab.freedesktop.org/chenghaoyang/libcamera to use that while
> > you work out the issue.
> >
> > I suspect you need to add something at
> >
> > https://gitlab.freedesktop.org/camera/libcamera-ci/-/blob/master/.gitlab-ci/build-kernel.sh?ref_type=heads#L41
> >
> > to enable the uDMA config options...
> >
> > --
> > Kieran
> >
> >
> >
> > > ```
> > >
> > > Gitlab pipeline failure:
> > > https://gitlab.freedesktop.org/chenghaoyang/libcamera/-/pipelines/1260412
> > >
> > > Updates in v14:
> > > - Refactored ImageFrames to keep a list of filepaths directly.
> > >
> > > Updates in v13:
> > > - Returned an errno in `FrameGenerete::generateFrame()`
> > >
> > > Updates in v12:
> > > - Added ImageFrameGenerator first, then add Parser.
> > > - Removed ScaleMode argument, as only Fill is supported now.
> > > - Fixed bug of Stream's configuration usage in configure().
> > >
> > > Updates in v11:
> > > - Allowed a single value in the config file's frame_rates field.
> > >
> > > Updates in v10:
> > > Apply fixes according to Jacopo's and Barnabás' comments.
> > > - Split test_pattern and path fields in the yaml format.
> > > - Let FrameGenerators control frameCount_.
> > > - Fixed match() returning values.
> > >
> > > Updates in v9: Allocate contiguous memory for planes in the same
> > > FrameBuffer.
> > >
> > > BR,
> > > Harvey
> > >
> > > Harvey Yang (6):
> > >   libcamera: add DmaBufAllocator::exportBuffers()
> > >   libcamera: Remove PipelineHandler Fatal check of non-empty
> > >     MediaDevices
> > >   libcamera: virtual: Add VirtualPipelineHandler
> > >   libcamera: virtual: Add ImageFrameGenerator
> > >   libcamera: virtual: Read config and register cameras based on the
> > >     config
> > >   libcamera: software_isp: Refactor SoftwareIsp to use
> > >     DmaBufAllocator::exportBuffers
> > >
> > > Konami Shu (1):
> > >   libcamera: pipeline: Add test pattern for VirtualPipelineHandler
> > >
> > >  .../libcamera/internal/dma_buf_allocator.h    |  13 +
> > >  meson.build                                   |   1 +
> > >  meson_options.txt                             |   3 +-
> > >  src/android/meson.build                       |  19 -
> > >  src/libcamera/dma_buf_allocator.cpp           |  57 +++
> > >  src/libcamera/pipeline/virtual/README.md      |  48 +++
> > >  .../pipeline/virtual/data/virtual.yaml        |  36 ++
> > >  .../pipeline/virtual/frame_generator.h        |  29 ++
> > >  .../virtual/image_frame_generator.cpp         | 169 ++++++++
> > >  .../pipeline/virtual/image_frame_generator.h  |  50 +++
> > >  src/libcamera/pipeline/virtual/meson.build    |  13 +
> > >  src/libcamera/pipeline/virtual/parser.cpp     | 260 ++++++++++++
> > >  src/libcamera/pipeline/virtual/parser.h       |  39 ++
> > >  .../virtual/test_pattern_generator.cpp        | 137 +++++++
> > >  .../pipeline/virtual/test_pattern_generator.h |  53 +++
> > >  src/libcamera/pipeline/virtual/virtual.cpp    | 382 ++++++++++++++++++
> > >  src/libcamera/pipeline/virtual/virtual.h      |  61 +++
> > >  src/libcamera/pipeline_handler.cpp            |  11 +-
> > >  src/libcamera/software_isp/software_isp.cpp   |  20 +-
> > >  src/meson.build                               |  19 +
> > >  20 files changed, 1378 insertions(+), 42 deletions(-)
> > >  create mode 100644 src/libcamera/pipeline/virtual/README.md
> > >  create mode 100644 src/libcamera/pipeline/virtual/data/virtual.yaml
> > >  create mode 100644 src/libcamera/pipeline/virtual/frame_generator.h
> > >  create mode 100644 src/libcamera/pipeline/virtual/image_frame_generator.cpp
> > >  create mode 100644 src/libcamera/pipeline/virtual/image_frame_generator.h
> > >  create mode 100644 src/libcamera/pipeline/virtual/meson.build
> > >  create mode 100644 src/libcamera/pipeline/virtual/parser.cpp
> > >  create mode 100644 src/libcamera/pipeline/virtual/parser.h
> > >  create mode 100644 src/libcamera/pipeline/virtual/test_pattern_generator.cpp
> > >  create mode 100644 src/libcamera/pipeline/virtual/test_pattern_generator.h
> > >  create mode 100644 src/libcamera/pipeline/virtual/virtual.cpp
> > >  create mode 100644 src/libcamera/pipeline/virtual/virtual.h
> > >
> > > --
> > > 2.46.1.824.gd892dcdcdd-goog
> > >


More information about the libcamera-devel mailing list