[libcamera-devel,0/1] Fake Pipeline Handler
mbox series

Message ID 20221012075925.3971538-1-chenghaoyang@google.com
Headers show
Series
  • Fake Pipeline Handler
Related show

Message

Harvey Yang Oct. 12, 2022, 7:59 a.m. UTC
This is a POC PATCH of the fake pipeline handler, which should be used
for tests and validating Android adaptor can pass CTS limited mode.

Signed-off-by: Harvey Yang <chenghaoyang@chromium.org>

Harvey Yang (1):
  Add fake pipeline handler

 meson_options.txt                       |   2 +-
 src/android/camera_capabilities.cpp     |   1 +
 src/libcamera/pipeline/fake/fake.cpp    | 518 ++++++++++++++++++++++++
 src/libcamera/pipeline/fake/meson.build |   3 +
 src/libcamera/pipeline_handler.cpp      |   2 +-
 test/camera/camera_reconfigure.cpp      |   2 +-
 6 files changed, 525 insertions(+), 3 deletions(-)
 create mode 100644 src/libcamera/pipeline/fake/fake.cpp
 create mode 100644 src/libcamera/pipeline/fake/meson.build

Comments

Kieran Bingham Oct. 12, 2022, 9:10 a.m. UTC | #1
Quoting Harvey Yang via libcamera-devel (2022-10-12 08:59:24)
> This is a POC PATCH of the fake pipeline handler, which should be used
> for tests and validating Android adaptor can pass CTS limited mode.
> 

Aha, this is interesting. I've wondered if we should have a virtual/fake
camera too, perhaps with our own internal pattern generator.

There's lots that could be mocked up, perhaps even as far down as a Fake
CameraSensor, and an IPA to support testing of controls too (or perhaps
without an IPA as it could all be internal to the pipeline handler, with
no particular imagery).

There's a lot of commented code in there from the IPU3, so I suspect
that was the source.

There's https://git.libcamera.org/libcamera/vivid.git/log/ which might
be a 'smaller' pipeline handler to consider as a fake pipeline handler
starting point, or even UVC might be simpler comparable starting point.

--
Kieran



> Signed-off-by: Harvey Yang <chenghaoyang@chromium.org>
> 
> Harvey Yang (1):
>   Add fake pipeline handler
> 
>  meson_options.txt                       |   2 +-
>  src/android/camera_capabilities.cpp     |   1 +
>  src/libcamera/pipeline/fake/fake.cpp    | 518 ++++++++++++++++++++++++
>  src/libcamera/pipeline/fake/meson.build |   3 +
>  src/libcamera/pipeline_handler.cpp      |   2 +-
>  test/camera/camera_reconfigure.cpp      |   2 +-
>  6 files changed, 525 insertions(+), 3 deletions(-)
>  create mode 100644 src/libcamera/pipeline/fake/fake.cpp
>  create mode 100644 src/libcamera/pipeline/fake/meson.build
> 
> -- 
> 2.38.0.rc1.362.ged0d419d3c-goog
>
Harvey Yang Oct. 12, 2022, 9:42 a.m. UTC | #2
Thanks Kieran for your thoughts!

On Wed, Oct 12, 2022 at 5:10 PM Kieran Bingham <
kieran.bingham@ideasonboard.com> wrote:

> Quoting Harvey Yang via libcamera-devel (2022-10-12 08:59:24)
> > This is a POC PATCH of the fake pipeline handler, which should be used
> > for tests and validating Android adaptor can pass CTS limited mode.
> >
>
> Aha, this is interesting. I've wondered if we should have a virtual/fake
> camera too, perhaps with our own internal pattern generator.
>
>
This fake pipeline handler actually came from a design in ChromeOS
that tried to do some tests (CTS for example) without involving the real
cameras, like green frames or providing frames from a prepared video file.

We also wonder how the fake pipeline handler could help libcamera scale
and launch on more real devices.


> There's lots that could be mocked up, perhaps even as far down as a Fake
> CameraSensor, and an IPA to support testing of controls too (or perhaps
> without an IPA as it could all be internal to the pipeline handler, with
> no particular imagery).
>
>
Yeah there's a TODO to read a prepared configuration file, which defines
the
fake cameras and maybe a prepared video file as well. True that I was not
sure
why an IPA is needed. Maybe some controls can be applied on the output
frames
(from the video)?

There's a lot of commented code in there from the IPU3, so I suspect
> that was the source.
>
> There's https://git.libcamera.org/libcamera/vivid.git/log/ which might
> be a 'smaller' pipeline handler to consider as a fake pipeline handler
> starting point, or even UVC might be simpler comparable starting point.
>
>
Thanks! Will take a look and update on my next patch.


> --
> Kieran
>
>
>
> > Signed-off-by: Harvey Yang <chenghaoyang@chromium.org>
> >
> > Harvey Yang (1):
> >   Add fake pipeline handler
> >
> >  meson_options.txt                       |   2 +-
> >  src/android/camera_capabilities.cpp     |   1 +
> >  src/libcamera/pipeline/fake/fake.cpp    | 518 ++++++++++++++++++++++++
> >  src/libcamera/pipeline/fake/meson.build |   3 +
> >  src/libcamera/pipeline_handler.cpp      |   2 +-
> >  test/camera/camera_reconfigure.cpp      |   2 +-
> >  6 files changed, 525 insertions(+), 3 deletions(-)
> >  create mode 100644 src/libcamera/pipeline/fake/fake.cpp
> >  create mode 100644 src/libcamera/pipeline/fake/meson.build
> >
> > --
> > 2.38.0.rc1.362.ged0d419d3c-goog
> >
>
Kieran Bingham Oct. 12, 2022, 9:56 a.m. UTC | #3
Quoting Cheng-Hao Yang (2022-10-12 10:42:32)
> Thanks Kieran for your thoughts!
> 
> On Wed, Oct 12, 2022 at 5:10 PM Kieran Bingham <
> kieran.bingham@ideasonboard.com> wrote:
> 
> > Quoting Harvey Yang via libcamera-devel (2022-10-12 08:59:24)
> > > This is a POC PATCH of the fake pipeline handler, which should be used
> > > for tests and validating Android adaptor can pass CTS limited mode.
> > >
> >
> > Aha, this is interesting. I've wondered if we should have a virtual/fake
> > camera too, perhaps with our own internal pattern generator.
> >
> >
> This fake pipeline handler actually came from a design in ChromeOS
> that tried to do some tests (CTS for example) without involving the real
> cameras, like green frames or providing frames from a prepared video file.
> 
> We also wonder how the fake pipeline handler could help libcamera scale
> and launch on more real devices.

Is there a reason you couldn't use the VIMC camera?
 (modprobe vimc is perhaps required)

Though I think I've already seen situations where it would be helpful to
have a fake camera that produces a test pattern, without requiring
kernel drivers...


> > There's lots that could be mocked up, perhaps even as far down as a Fake
> > CameraSensor, and an IPA to support testing of controls too (or perhaps
> > without an IPA as it could all be internal to the pipeline handler, with
> > no particular imagery).
> >
> >
> Yeah there's a TODO to read a prepared configuration file, which defines
> the
> fake cameras and maybe a prepared video file as well. True that I was not
> sure
> why an IPA is needed. Maybe some controls can be applied on the output
> frames
> (from the video)?

If there's an internal test pattern generator yes. But I don't think we
should introduce any kind of 'video' decoder.

> There's a lot of commented code in there from the IPU3, so I suspect
> > that was the source.
> >
> > There's https://git.libcamera.org/libcamera/vivid.git/log/ which might
> > be a 'smaller' pipeline handler to consider as a fake pipeline handler
> > starting point, or even UVC might be simpler comparable starting point.
> >
> >
> Thanks! Will take a look and update on my next patch.
> 
> 
> > --
> > Kieran
> >
> >
> >
> > > Signed-off-by: Harvey Yang <chenghaoyang@chromium.org>
> > >
> > > Harvey Yang (1):
> > >   Add fake pipeline handler
> > >
> > >  meson_options.txt                       |   2 +-
> > >  src/android/camera_capabilities.cpp     |   1 +
> > >  src/libcamera/pipeline/fake/fake.cpp    | 518 ++++++++++++++++++++++++
> > >  src/libcamera/pipeline/fake/meson.build |   3 +
> > >  src/libcamera/pipeline_handler.cpp      |   2 +-
> > >  test/camera/camera_reconfigure.cpp      |   2 +-
> > >  6 files changed, 525 insertions(+), 3 deletions(-)
> > >  create mode 100644 src/libcamera/pipeline/fake/fake.cpp
> > >  create mode 100644 src/libcamera/pipeline/fake/meson.build
> > >
> > > --
> > > 2.38.0.rc1.362.ged0d419d3c-goog
> > >
> >
Harvey Yang Oct. 12, 2022, 11:24 a.m. UTC | #4
On Wed, Oct 12, 2022 at 5:56 PM Kieran Bingham <
kieran.bingham@ideasonboard.com> wrote:

> Quoting Cheng-Hao Yang (2022-10-12 10:42:32)
> > Thanks Kieran for your thoughts!
> >
> > On Wed, Oct 12, 2022 at 5:10 PM Kieran Bingham <
> > kieran.bingham@ideasonboard.com> wrote:
> >
> > > Quoting Harvey Yang via libcamera-devel (2022-10-12 08:59:24)
> > > > This is a POC PATCH of the fake pipeline handler, which should be
> used
> > > > for tests and validating Android adaptor can pass CTS limited mode.
> > > >
> > >
> > > Aha, this is interesting. I've wondered if we should have a
> virtual/fake
> > > camera too, perhaps with our own internal pattern generator.
> > >
> > >
> > This fake pipeline handler actually came from a design in ChromeOS
> > that tried to do some tests (CTS for example) without involving the real
> > cameras, like green frames or providing frames from a prepared video
> file.
> >
> > We also wonder how the fake pipeline handler could help libcamera scale
> > and launch on more real devices.
>
> Is there a reason you couldn't use the VIMC camera?
>  (modprobe vimc is perhaps required)
>
> Though I think I've already seen situations where it would be helpful to
> have a fake camera that produces a test pattern, without requiring
> kernel drivers...
>
>
That's exactly the point. ChromeOS models have different kernel versions.
Tomasz
told me that vimc only works after a specific linux kernel version (5.10?).

It'd be preferred if the fake pipeline handler can be used on all ChromeOS
models.


>
> > > There's lots that could be mocked up, perhaps even as far down as a
> Fake
> > > CameraSensor, and an IPA to support testing of controls too (or perhaps
> > > without an IPA as it could all be internal to the pipeline handler,
> with
> > > no particular imagery).
> > >
> > >
> > Yeah there's a TODO to read a prepared configuration file, which defines
> > the
> > fake cameras and maybe a prepared video file as well. True that I was not
> > sure
> > why an IPA is needed. Maybe some controls can be applied on the output
> > frames
> > (from the video)?
>
> If there's an internal test pattern generator yes. But I don't think we
> should introduce any kind of 'video' decoder.
>
> > There's a lot of commented code in there from the IPU3, so I suspect
> > > that was the source.
> > >
> > > There's https://git.libcamera.org/libcamera/vivid.git/log/ which might
> > > be a 'smaller' pipeline handler to consider as a fake pipeline handler
> > > starting point, or even UVC might be simpler comparable starting point.
> > >
> > >
> > Thanks! Will take a look and update on my next patch.
> >
> >
> > > --
> > > Kieran
> > >
> > >
> > >
> > > > Signed-off-by: Harvey Yang <chenghaoyang@chromium.org>
> > > >
> > > > Harvey Yang (1):
> > > >   Add fake pipeline handler
> > > >
> > > >  meson_options.txt                       |   2 +-
> > > >  src/android/camera_capabilities.cpp     |   1 +
> > > >  src/libcamera/pipeline/fake/fake.cpp    | 518
> ++++++++++++++++++++++++
> > > >  src/libcamera/pipeline/fake/meson.build |   3 +
> > > >  src/libcamera/pipeline_handler.cpp      |   2 +-
> > > >  test/camera/camera_reconfigure.cpp      |   2 +-
> > > >  6 files changed, 525 insertions(+), 3 deletions(-)
> > > >  create mode 100644 src/libcamera/pipeline/fake/fake.cpp
> > > >  create mode 100644 src/libcamera/pipeline/fake/meson.build
> > > >
> > > > --
> > > > 2.38.0.rc1.362.ged0d419d3c-goog
> > > >
> > >
>