[libcamera-devel] [RFC PATCH v2 4/5] libcamera: ipu3: Apply a requested test pattern mode

Hirokazu Honda hiroh at chromium.org
Wed Jun 23 09:36:07 CEST 2021


Hi Jacopo,

On Tue, Jun 22, 2021 at 7:42 PM Jacopo Mondi <jacopo at jmondi.org> wrote:
>
> Hi Hiro
>
> On Tue, Jun 22, 2021 at 11:36:53AM +0900, Hirokazu Honda wrote:
> > Apply a camera sensor a requested test pattern mode. The test
>
> Apply to the ...
>
> > pattern mode can be specified per frame.
> >
> > Signed-off-by: Hirokazu Honda <hiroh at chromium.org>
> > ---
> >  src/libcamera/pipeline/ipu3/cio2.cpp | 15 +++++++++++++++
> >  1 file changed, 15 insertions(+)
> >
> > diff --git a/src/libcamera/pipeline/ipu3/cio2.cpp b/src/libcamera/pipeline/ipu3/cio2.cpp
> > index 8548f749..9d1ff07d 100644
> > --- a/src/libcamera/pipeline/ipu3/cio2.cpp
> > +++ b/src/libcamera/pipeline/ipu3/cio2.cpp
> > @@ -12,6 +12,7 @@
> >  #include <libcamera/control_ids.h>
> >  #include <libcamera/formats.h>
> >  #include <libcamera/geometry.h>
> > +#include <libcamera/request.h>
> >  #include <libcamera/stream.h>
> >
> >  #include "libcamera/internal/camera_sensor.h"
> > @@ -289,6 +290,20 @@ FrameBuffer *CIO2Device::queueBuffer(Request *request, FrameBuffer *rawBuffer)
> >               buffer->setRequest(request);
> >       }
> >
> > +     if (request->controls().contains(controls::draft::TestPatternMode)) {
> > +             const uint8_t testPatternMode =
> > +                     static_cast<uint8_t>(request->controls().get(
> > +                             controls::draft::TestPatternMode));
> > +             int ret = sensor_->setTestPatternMode(testPatternMode);
> > +             if (ret) {
> > +                     LOG(IPU3, Error)
> > +                             << "Failed to set test pattern mode: " << ret;
> > +             } else {
> > +                     request->metadata().set(controls::draft::TestPatternMode,
> > +                                             testPatternMode);
> > +             }
> > +     }
> > +
>
> Correct me if I'm wrong, but if we have 3 buffers queued to the CIO2,
> we queue a 4th one with test pattern enabled and we enable it on the
> sensor here, won't the 3 frames that complete before this one contain
> the test pattern ? Cc-ed Laurent to rope him in for this question.
>
> Also, can we enable/disable test patter while streaming ? Have you
> tested this ?

I haven't tested that. We don't have such a test.
I have the same question. My guess is applying the test pattern mode
on fly affects the preceding queued buffers.
In intel HAL implementation, it waits until the preceding queued
buffers have been dequeued before applying the test pattern mode.
We have to do that in libcamera too.

-Hiro


>
> >       int ret = output_->queueBuffer(buffer);
> >       if (ret)
> >               return nullptr;
> > --
> > 2.32.0.288.g62a8d224e6-goog
> >


More information about the libcamera-devel mailing list